Skip to content

Commit b064023

Browse files
committed
chore(script): fix promise task & types
1 parent 50cc05e commit b064023

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

scripts/telegram-notify.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import { downloadFile } from "./utils/download";
77
import path from "path";
88
import { TEMP_DIR } from "./utils/env";
99
import { GIT_SHORT_HASH } from "./utils/shell";
10+
import { existsSync } from "fs";
11+
import { mkdirp } from "fs-extra";
1012

1113
const nightlyBuild = process.argv.includes("--nightly");
1214

@@ -76,14 +78,25 @@ const isValidFormat = (fileName: string): boolean => {
7678
}
7779
});
7880

79-
await Promise.all(downloadTasks);
81+
try {
82+
mkdirp(TEMP_DIR);
83+
84+
await Promise.all(downloadTasks);
85+
} catch (error) {
86+
consola.error(error);
87+
throw new Error("Error during download or upload tasks");
88+
}
89+
90+
reourceMappping.forEach((item) => {
91+
consola.log(`exited ${item}:`, existsSync(item));
92+
});
8093

8194
consola.start("Staring upload tasks (nightly)");
8295

8396
await client.sendFile(TELEGRAM_TO_NIGHTLY, {
8497
file: reourceMappping,
8598
forceDocument: true,
86-
caption: `Clash Nyanpasu Nighly Build ${GIT_SHORT_HASH}`,
99+
caption: `Clash Nyanpasu Nightly Build ${GIT_SHORT_HASH}`,
87100
});
88101

89102
consola.success("Upload finished (nightly)");

0 commit comments

Comments
 (0)