neex 0.6.68 → 0.6.71
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/src/cli.js
CHANGED
|
@@ -11,6 +11,12 @@ const figures_1 = __importDefault(require("figures"));
|
|
|
11
11
|
const { version } = require('../../package.json');
|
|
12
12
|
function cli() {
|
|
13
13
|
const program = new commander_1.Command();
|
|
14
|
+
// Special handling for the 'init' command to avoid conflicts
|
|
15
|
+
if (process.argv[2] === 'init') {
|
|
16
|
+
(0, index_js_1.addInitCommand)(program);
|
|
17
|
+
program.parse(process.argv);
|
|
18
|
+
return; // Exit early
|
|
19
|
+
}
|
|
14
20
|
// Initialize cleanup handlers
|
|
15
21
|
const cleanupHandlers = [];
|
|
16
22
|
program
|
|
@@ -18,6 +24,7 @@ function cli() {
|
|
|
18
24
|
.description('Professional script runner with nodemon and PM2 functionality')
|
|
19
25
|
.version(version);
|
|
20
26
|
// Add all command groups
|
|
27
|
+
(0, index_js_1.addInitCommand)(program); // Keep it for --help
|
|
21
28
|
(0, index_js_1.addRunCommands)(program);
|
|
22
29
|
(0, index_js_1.addServerCommands)(program);
|
|
23
30
|
const devCommands = (0, index_js_1.addDevCommands)(program);
|
|
@@ -20,3 +20,4 @@ __exportStar(require("./dev-commands.js"), exports);
|
|
|
20
20
|
__exportStar(require("./server-commands.js"), exports);
|
|
21
21
|
__exportStar(require("./start-commands.js"), exports);
|
|
22
22
|
__exportStar(require("./build-commands"), exports);
|
|
23
|
+
__exportStar(require("./init-commands.js"), exports);
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.addInitCommand = void 0;
|
|
7
|
+
const child_process_1 = require("child_process");
|
|
8
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
9
|
+
const figures_1 = __importDefault(require("figures"));
|
|
10
|
+
function addInitCommand(program) {
|
|
11
|
+
program
|
|
12
|
+
.command('init [projectName]', { isDefault: false })
|
|
13
|
+
.description('Initialize a new neex project by running `npm create neex@latest`')
|
|
14
|
+
.action((projectName) => {
|
|
15
|
+
console.log(chalk_1.default.green(`${figures_1.default.pointer} Running npm create neex@latest...`));
|
|
16
|
+
const command = 'npm';
|
|
17
|
+
// Use 'create' which is an alias for 'init' in modern npm versions
|
|
18
|
+
const args = ['create', 'neex@latest'];
|
|
19
|
+
if (projectName) {
|
|
20
|
+
args.push(projectName);
|
|
21
|
+
}
|
|
22
|
+
// Use spawn to execute the command and stream the output
|
|
23
|
+
const child = (0, child_process_1.spawn)(command, args, {
|
|
24
|
+
stdio: 'inherit',
|
|
25
|
+
shell: true // Needed for 'npm' on some systems, especially Windows
|
|
26
|
+
});
|
|
27
|
+
child.on('close', (code) => {
|
|
28
|
+
if (code !== 0) {
|
|
29
|
+
console.error(chalk_1.default.red(`${figures_1.default.cross} Error initializing project. 'npm create neex@latest' exited with code ${code}`));
|
|
30
|
+
}
|
|
31
|
+
// No success message here because create-neex provides its own.
|
|
32
|
+
});
|
|
33
|
+
child.on('error', (error) => {
|
|
34
|
+
console.error(chalk_1.default.red(`${figures_1.default.cross} Failed to start command: ${error.message}`));
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
exports.addInitCommand = addInitCommand;
|