Type check scripts/

This commit is contained in:
Alex Gleason 2024-11-21 10:25:15 -06:00
parent e38392b269
commit ceddcce4cf
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7
5 changed files with 8 additions and 5 deletions

View file

@ -10,7 +10,7 @@
"nostr:pull": "deno run -A --env-file --deny-read=.env scripts/nostr-pull.ts",
"debug": "deno run -A --env-file --deny-read=.env --inspect src/server.ts",
"test": "deno test -A --env-file=.env.test --deny-read=.env --junit-path=./deno-test.xml",
"check": "deno check --allow-import src/server.ts",
"check": "deno check --allow-import .",
"nsec": "deno run scripts/nsec.ts",
"admin:event": "deno run -A --env-file --deny-read=.env scripts/admin-event.ts",
"admin:role": "deno run -A --env-file --deny-read=.env scripts/admin-role.ts",

View file

@ -30,7 +30,7 @@ for await (const line of readable) {
await store.event(event);
console.warn(`(${count}) Event<${event.kind}> ${event.id}`);
} catch (error) {
if (error.message.includes('violates unique constraint')) {
if (error instanceof Error && error.message.includes('violates unique constraint')) {
console.warn(`(${count}) Skipping existing event... ${event.id}`);
} else {
console.error(error);

View file

@ -12,9 +12,12 @@ for await (const msg of store.req([{ kinds: [0] }])) {
const search = [name, nip05].filter(Boolean).join(' ').trim();
try {
await kysely.insertInto('author_search').values({
await kysely.insertInto('author_stats').values({
pubkey,
search,
followers_count: 0,
following_count: 0,
notes_count: 0,
}).onConflict(
(oc) =>
oc.column('pubkey')

View file

@ -31,7 +31,7 @@ const importUsers = async (
try {
await doEvent(event);
} catch (error) {
if (error.message.includes('violates unique constraint')) {
if (error instanceof Error && error.message.includes('violates unique constraint')) {
console.warn(`Skipping existing event ${event.id}...`);
} else {
console.error(error);

View file

@ -56,7 +56,7 @@ if (import.meta.main) {
})
.then(async (blob) =>
await pngToIco(Buffer.from(await blob.arrayBuffer()))
.then(async (buf) => await Deno.writeFile('./public/favicon.ico', buf))
.then(async (buf) => await Deno.writeFile('./public/favicon.ico', new Uint8Array(buf)))
);
} catch (e) {
die(1, `Error generating favicon from url ${image}: "${e}". Please check this or try again without --image.`);