create-node-template
Version:
Create node.js or express boilerplate with one command
36 lines • 1.16 kB
JavaScript
import { runner } from './config/index.js';
import { runWithCommander } from './runners/commander/index.js';
import { runWithInquirer } from './runners/inquirer/index.js';
import { runWithNode } from './runners/vanilla-node/index.js';
import { underline } from './utils/index.js';
const handleSigTerm = () => process.exit(0); // move to utils?
process.on('SIGINT', handleSigTerm);
process.on('SIGTERM', handleSigTerm);
/**
* CLI entry point
* runMode decides which implementation to run
* Choices are: vanilla-node, inquirer, commander
*/
const run = async (runMode) => {
try {
console.log(`\nRunning script with: ${underline.green(runMode)}🧪...`);
switch (runMode) {
case 'inquirer':
await runWithInquirer();
break;
case 'commander':
await runWithCommander();
break;
default:
await runWithNode();
}
process.exit(0);
}
catch (error) {
console.error('Something went wrong:', error);
process.exit(1);
}
};
void run(runner);
//# sourceMappingURL=index.js.map