Files
angular__angular/aio/scripts/fast-serve-and-watch.mjs
Paul Gschwendtner 13d3039c7d refactor: convert AIO tooling scripts used in Bazel to ESM (#48521)
Since the Bazel setup in this repo will now always use ESM,
the tooling scripts/binaries in AIO need to be switched to ESM
too. Most of the scripts are already ESM, but a few had to be converted.

Note that the Dgeni generation does not use ESM because it's unaffected
and the Dgeni CLI is used. In the future we could also update the Dgeni
setup to ESM but there is no need currently.

PR Close #48521
2022-12-19 19:50:44 +00:00

34 lines
781 B
JavaScript

/*
This script serves the aio app, watches for changes,
and runs a fast dgeni build on any changed files.
*/
import spawn from 'cross-spawn';
import watchr from '../tools/transforms/authors-package/watchr.js';
const architectCli = require.resolve('@angular-devkit/architect-cli/bin/architect');
const serve = spawn(
process.execPath,
[
'--preserve-symlinks',
architectCli,
'site:serve',
'--open',
'--poll=1000',
'--live-reload',
'--watch',
],
{stdio: 'inherit'}
);
serve.on('error', (error) => {
console.error('architect serve script failed');
console.error(error);
process.exit(1);
});
serve.on('close', (code) => {
console.error(`architect serve script exited with code ${code}`);
process.exit(1);
});
watchr.watch(true);