neex 0.6.72 → 0.6.75
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
|
@@ -10,6 +10,14 @@ const chalk_1 = __importDefault(require("chalk"));
|
|
|
10
10
|
const figures_1 = __importDefault(require("figures"));
|
|
11
11
|
const { version } = require('../../package.json');
|
|
12
12
|
function cli() {
|
|
13
|
+
const args = process.argv.slice(2);
|
|
14
|
+
// Handle the 'init' command as a special case before anything else.
|
|
15
|
+
// This makes 'neex' and 'neex init' act as aliases for 'npx create-neex'.
|
|
16
|
+
if (args.length === 0 || args[0] === 'init') {
|
|
17
|
+
const initArgs = args.slice(1); // Get all arguments after 'init'
|
|
18
|
+
(0, index_js_1.runInit)(initArgs);
|
|
19
|
+
return; // Exit early, do not proceed with the rest of the CLI
|
|
20
|
+
}
|
|
13
21
|
const program = new commander_1.Command();
|
|
14
22
|
// Initialize cleanup handlers
|
|
15
23
|
const cleanupHandlers = [];
|
|
@@ -17,8 +25,7 @@ function cli() {
|
|
|
17
25
|
.name('neex')
|
|
18
26
|
.description('Professional script runner with nodemon and PM2 functionality')
|
|
19
27
|
.version(version);
|
|
20
|
-
// Add all command groups
|
|
21
|
-
(0, index_js_1.addInitCommand)(program);
|
|
28
|
+
// Add all other command groups
|
|
22
29
|
(0, index_js_1.addRunCommands)(program);
|
|
23
30
|
(0, index_js_1.addServerCommands)(program);
|
|
24
31
|
const devCommands = (0, index_js_1.addDevCommands)(program);
|
|
@@ -27,7 +34,6 @@ function cli() {
|
|
|
27
34
|
cleanupHandlers.push(buildCommands.cleanupBuild);
|
|
28
35
|
const startCommands = (0, index_js_1.addStartCommands)(program);
|
|
29
36
|
cleanupHandlers.push(startCommands.cleanupStart);
|
|
30
|
-
// Parse arguments
|
|
31
37
|
program.parse(process.argv);
|
|
32
38
|
// Show help if no commands specified
|
|
33
39
|
if (program.args.length === 0) {
|
|
@@ -14,10 +14,12 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.runInit = void 0;
|
|
17
18
|
// src/commands/index.ts - Export all commands
|
|
18
19
|
__exportStar(require("./run-commands.js"), exports);
|
|
19
20
|
__exportStar(require("./dev-commands.js"), exports);
|
|
20
21
|
__exportStar(require("./server-commands.js"), exports);
|
|
21
22
|
__exportStar(require("./start-commands.js"), exports);
|
|
22
|
-
__exportStar(require("./build-commands"), exports);
|
|
23
|
-
|
|
23
|
+
__exportStar(require("./build-commands.js"), exports);
|
|
24
|
+
var init_commands_js_1 = require("./init-commands.js");
|
|
25
|
+
Object.defineProperty(exports, "runInit", { enumerable: true, get: function () { return init_commands_js_1.runInit; } });
|
|
@@ -1,69 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
3
|
+
exports.runInit = void 0;
|
|
4
|
+
// src/commands/init-commands.ts
|
|
7
5
|
const child_process_1 = require("child_process");
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
.
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
if (projectName) {
|
|
22
|
-
args.push(projectName);
|
|
23
|
-
}
|
|
24
|
-
// Add debug flag if specified
|
|
25
|
-
if (options === null || options === void 0 ? void 0 : options.debug) {
|
|
26
|
-
args.push('--debug');
|
|
27
|
-
console.log(chalk_1.default.blue(`${figures_1.default.info} Debug: Running command: npx ${args.join(' ')}`));
|
|
28
|
-
}
|
|
29
|
-
// Add version flag if specified
|
|
30
|
-
if (options === null || options === void 0 ? void 0 : options.version) {
|
|
31
|
-
args.push('--version');
|
|
32
|
-
}
|
|
33
|
-
// Use spawn to execute the command and stream the output
|
|
34
|
-
const child = (0, child_process_1.spawn)('npx', args, {
|
|
35
|
-
stdio: 'inherit',
|
|
36
|
-
shell: true,
|
|
37
|
-
cwd: process.cwd() // Use current working directory
|
|
38
|
-
});
|
|
39
|
-
child.on('close', (code) => {
|
|
40
|
-
if (code !== 0) {
|
|
41
|
-
console.error(chalk_1.default.red(`${figures_1.default.cross} Error initializing project. 'npx create-neex' exited with code ${code}`));
|
|
42
|
-
process.exit(code !== null && code !== void 0 ? code : 1);
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
console.log(chalk_1.default.green(`${figures_1.default.tick} Project initialized successfully!`));
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
child.on('error', (error) => {
|
|
49
|
-
console.error(chalk_1.default.red(`${figures_1.default.cross} Failed to start command: ${error.message}`));
|
|
50
|
-
console.error(chalk_1.default.yellow(`${figures_1.default.warning} Make sure you have npm/npx installed and accessible`));
|
|
51
|
-
process.exit(1);
|
|
52
|
-
});
|
|
53
|
-
// Handle process termination
|
|
54
|
-
process.on('SIGINT', () => {
|
|
55
|
-
console.log(chalk_1.default.yellow(`\n${figures_1.default.warning} Interrupting initialization...`));
|
|
56
|
-
child.kill('SIGINT');
|
|
57
|
-
});
|
|
58
|
-
process.on('SIGTERM', () => {
|
|
59
|
-
console.log(chalk_1.default.yellow(`\n${figures_1.default.warning} Terminating initialization...`));
|
|
60
|
-
child.kill('SIGTERM');
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
catch (error) {
|
|
64
|
-
console.error(chalk_1.default.red(`${figures_1.default.cross} Unexpected error: ${error instanceof Error ? error.message : 'Unknown error'}`));
|
|
65
|
-
process.exit(1);
|
|
66
|
-
}
|
|
6
|
+
function runInit(args) {
|
|
7
|
+
// No extra logs, just run the command.
|
|
8
|
+
const child = (0, child_process_1.spawn)('npx', ['create-neex', ...args], {
|
|
9
|
+
stdio: 'inherit',
|
|
10
|
+
shell: true
|
|
11
|
+
});
|
|
12
|
+
child.on('close', (code) => {
|
|
13
|
+
// The process exit code will be inherited from the child process.
|
|
14
|
+
process.exit(code !== null && code !== void 0 ? code : 1);
|
|
15
|
+
});
|
|
16
|
+
child.on('error', (err) => {
|
|
17
|
+
console.error('Failed to start npx create-neex:', err);
|
|
18
|
+
process.exit(1);
|
|
67
19
|
});
|
|
68
20
|
}
|
|
69
|
-
exports.
|
|
21
|
+
exports.runInit = runInit;
|