2021-11-18 21:48:59 -08:00
|
|
|
const execa = require('execa');
|
2022-12-19 20:05:36 -08:00
|
|
|
const fs = require('fs');
|
2021-11-18 21:48:59 -08:00
|
|
|
|
|
|
|
(async () => {
|
2023-01-15 13:08:42 -08:00
|
|
|
await execa('pnpm', ['clean'], {
|
2022-02-05 15:39:30 -08:00
|
|
|
cwd: __dirname + '/../',
|
|
|
|
stdout: process.stdout,
|
|
|
|
stderr: process.stderr,
|
|
|
|
});
|
|
|
|
|
2023-01-15 13:08:42 -08:00
|
|
|
await execa('pnpm', ['build-pre'], {
|
2022-12-19 20:05:36 -08:00
|
|
|
cwd: __dirname + '/../',
|
|
|
|
stdout: process.stdout,
|
|
|
|
stderr: process.stderr,
|
|
|
|
});
|
|
|
|
|
2023-01-21 01:41:30 -08:00
|
|
|
execa('pnpm', ['exec', 'gulp', 'watch'], {
|
2021-11-18 21:48:59 -08:00
|
|
|
cwd: __dirname + '/../',
|
|
|
|
stdout: process.stdout,
|
|
|
|
stderr: process.stderr,
|
|
|
|
});
|
|
|
|
|
2023-01-15 13:08:42 -08:00
|
|
|
execa('pnpm', ['--filter', 'backend', 'watch'], {
|
2022-11-23 22:39:00 -08:00
|
|
|
cwd: __dirname + '/../',
|
2021-11-18 21:48:59 -08:00
|
|
|
stdout: process.stdout,
|
|
|
|
stderr: process.stderr,
|
|
|
|
});
|
|
|
|
|
2023-01-15 13:08:42 -08:00
|
|
|
execa('pnpm', ['--filter', 'frontend', 'watch'], {
|
2022-11-23 22:39:00 -08:00
|
|
|
cwd: __dirname + '/../',
|
2021-11-18 21:48:59 -08:00
|
|
|
stdout: process.stdout,
|
|
|
|
stderr: process.stderr,
|
|
|
|
});
|
|
|
|
|
2023-01-15 13:08:42 -08:00
|
|
|
execa('pnpm', ['--filter', 'sw', 'watch'], {
|
2022-11-23 22:39:00 -08:00
|
|
|
cwd: __dirname + '/../',
|
2022-04-30 05:52:07 -07:00
|
|
|
stdout: process.stdout,
|
|
|
|
stderr: process.stderr,
|
|
|
|
});
|
|
|
|
|
2021-11-18 21:48:59 -08:00
|
|
|
const start = async () => {
|
|
|
|
try {
|
2023-03-04 21:33:23 -08:00
|
|
|
const stat = fs.statSync(__dirname + '/../packages/backend/built/boot/index.js');
|
|
|
|
if (!stat) throw new Error('not exist yet');
|
|
|
|
if (stat.size === 0) throw new Error('not built yet');
|
2022-12-19 20:05:36 -08:00
|
|
|
|
2023-05-28 14:37:13 -07:00
|
|
|
const subprocess = await execa('pnpm', ['start'], {
|
2021-11-18 21:48:59 -08:00
|
|
|
cwd: __dirname + '/../',
|
|
|
|
stdout: process.stdout,
|
|
|
|
stderr: process.stderr,
|
|
|
|
});
|
2023-05-28 14:37:13 -07:00
|
|
|
|
|
|
|
// なぜかworkerだけが終了してmasterが残るのでその対策
|
|
|
|
process.on('SIGINT', () => {
|
|
|
|
subprocess.kill('SIGINT');
|
|
|
|
process.exit(0);
|
|
|
|
});
|
2021-11-18 21:48:59 -08:00
|
|
|
} catch (e) {
|
|
|
|
await new Promise(resolve => setTimeout(resolve, 3000));
|
|
|
|
start();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
start();
|
|
|
|
})();
|