fix: localesのファイル変更イベントが取れないのを修正
This commit is contained in:
parent
50ceb52e2a
commit
e87b1a7155
|
@ -91,21 +91,16 @@ async function build() {
|
||||||
await build();
|
await build();
|
||||||
|
|
||||||
if (process.argv.includes("--watch")) {
|
if (process.argv.includes("--watch")) {
|
||||||
const watchers = [
|
const watcher = fs.watch('./', { recursive: true });
|
||||||
fs.watch('./packages', { recursive: true }),
|
|
||||||
fs.watch('./locales'),
|
|
||||||
];
|
|
||||||
|
|
||||||
while (true) {
|
for await (const event of watcher) {
|
||||||
const event = (await Promise.race(watchers.map(watcher => watcher.next())))?.value;
|
const filename = event.filename.replaceAll('\\', '/');
|
||||||
if (!event) continue;
|
|
||||||
const filename = event.filename?.replaceAll('\\', '/');
|
|
||||||
|
|
||||||
if (/^[a-z]+\/src/.test(filename)) {
|
if (/^packages\/[a-z]+\/src/.test(filename)) {
|
||||||
await build();
|
await build();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (/[a-z]+-[A-Z]+\.yml/.test(filename)) {
|
if (/^locales\/[a-z]+-[A-Z]+\.yml/.test(filename)) {
|
||||||
locales = buildLocales();
|
locales = buildLocales();
|
||||||
await copyFrontendLocales()
|
await copyFrontendLocales()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue