1
0
mirror of https://github.com/hotomoe/hotomoe synced 2024-12-11 21:28:14 +09:00
hotomoe/scripts/dev.js
CyberRex bd3d75df6b
Update chokidar and use pnpm exec (#9640)
* Fix for dev mode

* Update packages/frontend/package.json

Co-authored-by: tamaina <tamaina@hotmail.co.jp>

Co-authored-by: tamaina <tamaina@hotmail.co.jp>
2023-01-21 18:41:30 +09:00

59 lines
1.2 KiB
JavaScript

const execa = require('execa');
const fs = require('fs');
(async () => {
await execa('pnpm', ['clean'], {
cwd: __dirname + '/../',
stdout: process.stdout,
stderr: process.stderr,
});
await execa('pnpm', ['build-pre'], {
cwd: __dirname + '/../',
stdout: process.stdout,
stderr: process.stderr,
});
execa('pnpm', ['exec', 'gulp', 'watch'], {
cwd: __dirname + '/../',
stdout: process.stdout,
stderr: process.stderr,
});
execa('pnpm', ['--filter', 'backend', 'watch'], {
cwd: __dirname + '/../',
stdout: process.stdout,
stderr: process.stderr,
});
execa('pnpm', ['--filter', 'frontend', 'watch'], {
cwd: __dirname + '/../',
stdout: process.stdout,
stderr: process.stderr,
});
execa('pnpm', ['--filter', 'sw', 'watch'], {
cwd: __dirname + '/../',
stdout: process.stdout,
stderr: process.stderr,
});
const start = async () => {
try {
const exist = fs.existsSync(__dirname + '/../packages/backend/built/boot/index.js')
if (!exist) throw new Error('not exist yet');
await execa('pnpm', ['start'], {
cwd: __dirname + '/../',
stdout: process.stdout,
stderr: process.stderr,
});
} catch (e) {
await new Promise(resolve => setTimeout(resolve, 3000));
start();
}
};
start();
})();