2021-11-19 07:48:59 +02:00
|
|
|
const execa = require('execa');
|
2022-12-20 06:05:36 +02:00
|
|
|
const fs = require('fs');
|
2021-11-19 07:48:59 +02:00
|
|
|
|
|
|
|
(async () => {
|
2023-01-15 23:08:42 +02:00
|
|
|
await execa('pnpm', ['clean'], {
|
2022-02-06 01:39:30 +02:00
|
|
|
cwd: __dirname + '/../',
|
|
|
|
stdout: process.stdout,
|
|
|
|
stderr: process.stderr,
|
|
|
|
});
|
|
|
|
|
2023-01-15 23:08:42 +02:00
|
|
|
await execa('pnpm', ['build-pre'], {
|
2022-12-20 06:05:36 +02:00
|
|
|
cwd: __dirname + '/../',
|
|
|
|
stdout: process.stdout,
|
|
|
|
stderr: process.stderr,
|
|
|
|
});
|
|
|
|
|
2023-01-21 11:41:30 +02:00
|
|
|
execa('pnpm', ['exec', 'gulp', 'watch'], {
|
2021-11-19 07:48:59 +02:00
|
|
|
cwd: __dirname + '/../',
|
|
|
|
stdout: process.stdout,
|
|
|
|
stderr: process.stderr,
|
|
|
|
});
|
|
|
|
|
2023-01-15 23:08:42 +02:00
|
|
|
execa('pnpm', ['--filter', 'backend', 'watch'], {
|
2022-11-24 08:39:00 +02:00
|
|
|
cwd: __dirname + '/../',
|
2021-11-19 07:48:59 +02:00
|
|
|
stdout: process.stdout,
|
|
|
|
stderr: process.stderr,
|
|
|
|
});
|
|
|
|
|
2023-01-15 23:08:42 +02:00
|
|
|
execa('pnpm', ['--filter', 'frontend', 'watch'], {
|
2022-11-24 08:39:00 +02:00
|
|
|
cwd: __dirname + '/../',
|
2021-11-19 07:48:59 +02:00
|
|
|
stdout: process.stdout,
|
|
|
|
stderr: process.stderr,
|
|
|
|
});
|
|
|
|
|
2023-01-15 23:08:42 +02:00
|
|
|
execa('pnpm', ['--filter', 'sw', 'watch'], {
|
2022-11-24 08:39:00 +02:00
|
|
|
cwd: __dirname + '/../',
|
2022-04-30 15:52:07 +03:00
|
|
|
stdout: process.stdout,
|
|
|
|
stderr: process.stderr,
|
|
|
|
});
|
|
|
|
|
2021-11-19 07:48:59 +02:00
|
|
|
const start = async () => {
|
|
|
|
try {
|
2023-03-05 07:33:23 +02: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-20 06:05:36 +02:00
|
|
|
|
2023-05-29 00:37:13 +03:00
|
|
|
const subprocess = await execa('pnpm', ['start'], {
|
2021-11-19 07:48:59 +02:00
|
|
|
cwd: __dirname + '/../',
|
|
|
|
stdout: process.stdout,
|
|
|
|
stderr: process.stderr,
|
|
|
|
});
|
2023-05-29 00:37:13 +03:00
|
|
|
|
|
|
|
// なぜかworkerだけが終了してmasterが残るのでその対策
|
|
|
|
process.on('SIGINT', () => {
|
|
|
|
subprocess.kill('SIGINT');
|
|
|
|
process.exit(0);
|
|
|
|
});
|
2021-11-19 07:48:59 +02:00
|
|
|
} catch (e) {
|
|
|
|
await new Promise(resolve => setTimeout(resolve, 3000));
|
|
|
|
start();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
start();
|
|
|
|
})();
|