FoundKey/scripts/dev.mjs
Norm 8f782f8ce5
All checks were successful
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/push/lint-backend Pipeline was successful
ci/woodpecker/push/lint-foundkey-js Pipeline was successful
ci/woodpecker/push/lint-client Pipeline was successful
ci/woodpecker/push/lint-sw Pipeline was successful
ci/woodpecker/push/test Pipeline was successful
scripts: convert to ESM and deduplicate (#290)
This makes it a bit easier to add any new files that may need to be
cleaned up in the future.

Also allows us to use top-level await for the `yarn dev` task.

Co-authored-by: Francis Dinh <normandy@biribiri.dev>
Reviewed-on: #290
2022-12-16 17:15:25 +00:00

52 lines
1 KiB
JavaScript

import execa from 'execa';
import { __dirname } from './common.mjs';
await execa('npm', ['run', 'clean'], {
cwd: __dirname + '/../',
stdout: process.stdout,
stderr: process.stderr,
});
await execa('npm', ['run', 'build'], {
cwd: __dirname + '/../packages/foundkey-js',
stdout: process.stdout,
stderr: process.stderr,
});
execa('npx', ['gulp', 'watch'], {
cwd: __dirname + '/../',
stdout: process.stdout,
stderr: process.stderr,
});
execa('npm', ['run', 'watch'], {
cwd: __dirname + '/../packages/backend',
stdout: process.stdout,
stderr: process.stderr,
});
execa('npm', ['run', 'watch'], {
cwd: __dirname + '/../packages/client',
stdout: process.stdout,
stderr: process.stderr,
});
execa('npm', ['run', 'watch'], {
cwd: __dirname + '/../packages/sw',
stdout: process.stdout,
stderr: process.stderr,
});
const start = async () => {
try {
await execa('npm', ['run', 'start'], {
cwd: __dirname + '/../',
stdout: process.stdout,
stderr: process.stderr,
});
} catch (e) {
setTimeout(start, 3000);
}
};
start();