neex 0.6.73 → 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 +11 -13
- package/dist/src/commands/index.js +3 -1
- package/dist/src/commands/init-commands.js +7 -16
- package/package.json +1 -1
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); // Add the new init command
|
|
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,18 +34,9 @@ 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
|
-
// If no command is specified, or 'init' is the command, run init logic.
|
|
31
|
-
// The first argument is the executable, the second is the script path.
|
|
32
|
-
const args = process.argv.slice(2);
|
|
33
|
-
if (args.length === 0) {
|
|
34
|
-
// If 'neex' is run alone, treat it as 'neex init'
|
|
35
|
-
args.push('init');
|
|
36
|
-
}
|
|
37
37
|
program.parse(process.argv);
|
|
38
|
-
// Show help if no commands
|
|
39
|
-
|
|
40
|
-
if (program.args.length === 0 && process.argv.slice(2).length > 0) {
|
|
41
|
-
// This case might happen if only options are passed without a command
|
|
38
|
+
// Show help if no commands specified
|
|
39
|
+
if (program.args.length === 0) {
|
|
42
40
|
program.help();
|
|
43
41
|
}
|
|
44
42
|
// Graceful shutdown handling
|
|
@@ -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
23
|
__exportStar(require("./build-commands.js"), exports);
|
|
23
|
-
|
|
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,30 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.runInit = void 0;
|
|
4
|
+
// src/commands/init-commands.ts
|
|
4
5
|
const child_process_1 = require("child_process");
|
|
5
6
|
function runInit(args) {
|
|
6
|
-
|
|
7
|
+
// No extra logs, just run the command.
|
|
7
8
|
const child = (0, child_process_1.spawn)('npx', ['create-neex', ...args], {
|
|
8
9
|
stdio: 'inherit',
|
|
9
10
|
shell: true
|
|
10
11
|
});
|
|
11
12
|
child.on('close', (code) => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
13
|
+
// The process exit code will be inherited from the child process.
|
|
14
|
+
process.exit(code !== null && code !== void 0 ? code : 1);
|
|
15
15
|
});
|
|
16
16
|
child.on('error', (err) => {
|
|
17
17
|
console.error('Failed to start npx create-neex:', err);
|
|
18
|
+
process.exit(1);
|
|
18
19
|
});
|
|
19
20
|
}
|
|
20
|
-
|
|
21
|
-
program
|
|
22
|
-
.command('init')
|
|
23
|
-
.description('Initializes a new project using create-neex. Alias for `npx create-neex`.')
|
|
24
|
-
.argument('[args...]', 'Arguments to pass to create-neex')
|
|
25
|
-
.allowUnknownOption(true) // Pass through options like --debug
|
|
26
|
-
.action((args) => {
|
|
27
|
-
runInit(args);
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
exports.addInitCommand = addInitCommand;
|
|
21
|
+
exports.runInit = runInit;
|