mirror of
https://github.com/aljazceru/ditto.git
synced 2026-02-01 11:34:26 +01:00
Type check scripts/
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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')
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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.`);
|
||||
|
||||
Reference in New Issue
Block a user