firefish/scripts/dev.mjs

53 lines
1.1 KiB
JavaScript
Raw Normal View History

2023-11-06 10:30:00 +09:00
import path, { join } from "node:path";
import { fileURLToPath } from "node:url";
import { execa } from "execa";
2023-07-20 04:17:05 +09:00
(async () => {
2023-11-06 10:30:00 +09:00
const __dirname = path.dirname(fileURLToPath(import.meta.url));
2023-07-20 04:17:05 +09:00
await execa("pnpm", ["clean"], {
2023-11-06 10:30:00 +09:00
cwd: join(__dirname, "/../"),
2023-07-20 04:17:05 +09:00
stdout: process.stdout,
stderr: process.stderr,
});
execa("pnpm", ["dlx", "gulp", "watch"], {
2023-11-06 10:30:00 +09:00
cwd: join(__dirname, "/../"),
2023-07-20 04:17:05 +09:00
stdout: process.stdout,
stderr: process.stderr,
});
execa("pnpm", ["--filter", "backend", "watch"], {
2023-11-06 10:30:00 +09:00
cwd: join(__dirname, "/../"),
2023-07-20 04:17:05 +09:00
stdout: process.stdout,
stderr: process.stderr,
});
execa("pnpm", ["--filter", "client", "watch"], {
2023-11-06 10:30:00 +09:00
cwd: join(__dirname, "/../"),
2023-07-20 04:17:05 +09:00
stdout: process.stdout,
stderr: process.stderr,
});
execa("pnpm", ["--filter", "sw", "watch"], {
2023-11-06 10:30:00 +09:00
cwd: join(__dirname, "/../"),
2023-07-20 04:17:05 +09:00
stdout: process.stdout,
stderr: process.stderr,
});
const start = async () => {
try {
await execa("pnpm", ["start"], {
2023-11-06 10:30:00 +09:00
cwd: join(__dirname, "/../"),
2023-07-20 04:17:05 +09:00
stdout: process.stdout,
stderr: process.stderr,
});
} catch (e) {
await new Promise((resolve) => setTimeout(resolve, 3000));
start();
}
};
start();
})();