neex 0.6.72 → 0.6.73
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 +12 -4
- package/dist/src/commands/index.js +1 -1
- package/dist/src/commands/init-commands.js +21 -60
- package/package.json +1 -1
package/dist/src/cli.js
CHANGED
|
@@ -18,7 +18,7 @@ function cli() {
|
|
|
18
18
|
.description('Professional script runner with nodemon and PM2 functionality')
|
|
19
19
|
.version(version);
|
|
20
20
|
// Add all command groups
|
|
21
|
-
(0, index_js_1.addInitCommand)(program);
|
|
21
|
+
(0, index_js_1.addInitCommand)(program); // Add the new init command
|
|
22
22
|
(0, index_js_1.addRunCommands)(program);
|
|
23
23
|
(0, index_js_1.addServerCommands)(program);
|
|
24
24
|
const devCommands = (0, index_js_1.addDevCommands)(program);
|
|
@@ -27,10 +27,18 @@ function cli() {
|
|
|
27
27
|
cleanupHandlers.push(buildCommands.cleanupBuild);
|
|
28
28
|
const startCommands = (0, index_js_1.addStartCommands)(program);
|
|
29
29
|
cleanupHandlers.push(startCommands.cleanupStart);
|
|
30
|
-
//
|
|
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
|
+
}
|
|
31
37
|
program.parse(process.argv);
|
|
32
|
-
// Show help if no commands
|
|
33
|
-
|
|
38
|
+
// Show help if no commands were provided and it wasn't an implicit init
|
|
39
|
+
// This logic is adjusted because we now have a default command.
|
|
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
|
|
34
42
|
program.help();
|
|
35
43
|
}
|
|
36
44
|
// Graceful shutdown handling
|
|
@@ -19,5 +19,5 @@ __exportStar(require("./run-commands.js"), exports);
|
|
|
19
19
|
__exportStar(require("./dev-commands.js"), exports);
|
|
20
20
|
__exportStar(require("./server-commands.js"), exports);
|
|
21
21
|
__exportStar(require("./start-commands.js"), exports);
|
|
22
|
-
__exportStar(require("./build-commands"), exports);
|
|
22
|
+
__exportStar(require("./build-commands.js"), exports);
|
|
23
23
|
__exportStar(require("./init-commands.js"), exports);
|
|
@@ -1,69 +1,30 @@
|
|
|
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
3
|
exports.addInitCommand = void 0;
|
|
7
4
|
const child_process_1 = require("child_process");
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
function runInit(args) {
|
|
6
|
+
console.log('Running npx create-neex...');
|
|
7
|
+
const child = (0, child_process_1.spawn)('npx', ['create-neex', ...args], {
|
|
8
|
+
stdio: 'inherit',
|
|
9
|
+
shell: true
|
|
10
|
+
});
|
|
11
|
+
child.on('close', (code) => {
|
|
12
|
+
if (code !== 0) {
|
|
13
|
+
console.error(`npx create-neex exited with code ${code}`);
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
child.on('error', (err) => {
|
|
17
|
+
console.error('Failed to start npx create-neex:', err);
|
|
18
|
+
});
|
|
19
|
+
}
|
|
10
20
|
function addInitCommand(program) {
|
|
11
21
|
program
|
|
12
|
-
.command('init
|
|
13
|
-
.description('
|
|
14
|
-
.
|
|
15
|
-
.
|
|
16
|
-
.action((
|
|
17
|
-
|
|
18
|
-
console.log(chalk_1.default.green(`${figures_1.default.pointer} Running npx create-neex...`));
|
|
19
|
-
const args = ['create-neex@latest'];
|
|
20
|
-
// Add project name if provided
|
|
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
|
-
}
|
|
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);
|
|
67
28
|
});
|
|
68
29
|
}
|
|
69
30
|
exports.addInitCommand = addInitCommand;
|