refactor: generalize nodeArgs

This commit is contained in:
cha0s 2022-04-04 03:11:40 -05:00
parent 1ade8294a1
commit 976969683f
2 changed files with 5 additions and 16 deletions

View File

@ -8,13 +8,9 @@ export default {
*/ */
hot: false, hot: false,
/** /**
* Whether the Node.js inspector is enabled. * Arguments to pass along to node. See: https://nodejs.org/api/cli.html
*/ */
inspect: false, nodeArgs: [],
/**
* Whether Node.js profiling is enabled.
*/
profile: false,
/** /**
* Whether to start the server after building. * Whether to start the server after building.
*/ */

View File

@ -14,8 +14,7 @@ const {
module.exports = async (flecks) => { module.exports = async (flecks) => {
const { const {
hot, hot,
inspect, nodeArgs,
profile,
start: isStarting, start: isStarting,
} = flecks.get('@flecks/server'); } = flecks.get('@flecks/server');
@ -79,14 +78,8 @@ module.exports = async (flecks) => {
options.keyboard = false; options.keyboard = false;
// HMR. // HMR.
options.signal = !!hot; options.signal = !!hot;
// Debugging. // Node args.
if (inspect) { options.nodeArgs.push(...nodeArgs);
options.nodeArgs.push('--inspect');
}
// Profiling.
if (profile) {
options.nodeArgs.push('--prof');
}
// Bail hard on unhandled rejections and report. // Bail hard on unhandled rejections and report.
options.nodeArgs.push('--unhandled-rejections=strict'); options.nodeArgs.push('--unhandled-rejections=strict');
options.nodeArgs.push('--trace-uncaught'); options.nodeArgs.push('--trace-uncaught');