Skip to content

Commit f44c96e

Browse files
committed
no need for this to be async
1 parent 9b1b941 commit f44c96e

File tree

1 file changed

+2
-20
lines changed
  • packages/svelte/scripts/process-messages

1 file changed

+2
-20
lines changed

packages/svelte/scripts/process-messages/index.js

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,7 @@ const [, , watch_flag] = process.argv;
1111

1212
const watch = watch_flag === '-w';
1313

14-
/**
15-
* @type {((value?: any) => void) | undefined}
16-
*/
17-
let resolve_writing_promise;
18-
19-
async function run() {
14+
function run() {
2015
/** @type {Record<string, Record<string, { messages: string[], details: string | null }>>} */
2116
const messages = {};
2217
const seen = new Set();
@@ -67,18 +62,10 @@ async function run() {
6762

6863
sorted.sort((a, b) => (a.code < b.code ? -1 : 1));
6964

70-
const writing_promise = watch
71-
? new Promise((resolve) => {
72-
resolve_writing_promise = resolve;
73-
})
74-
: Promise.resolve();
75-
7665
fs.writeFileSync(
7766
`messages/${category}/${file}`,
7867
sorted.map((x) => x._.trim()).join('\n\n') + '\n'
7968
);
80-
81-
await writing_promise;
8269
}
8370

8471
fs.writeFileSync(
@@ -435,15 +422,10 @@ async function run() {
435422

436423
if (watch) {
437424
fs.watch('messages', { recursive: true }, () => {
438-
if (resolve_writing_promise) {
439-
resolve_writing_promise();
440-
resolve_writing_promise = undefined;
441-
return;
442-
}
443425
// eslint-disable-next-line no-console
444426
console.log('Regenerating messages...');
445427
run();
446428
});
447429
}
448430

449-
await run();
431+
run();

0 commit comments

Comments
 (0)