neex 0.6.70 → 0.6.72
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 +1 -0
- package/dist/src/commands/init-commands.js +53 -20
- package/package.json +1 -1
package/dist/src/cli.js
CHANGED
|
@@ -27,6 +27,7 @@ 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
|
+
// Parse arguments
|
|
30
31
|
program.parse(process.argv);
|
|
31
32
|
// Show help if no commands specified
|
|
32
33
|
if (program.args.length === 0) {
|
|
@@ -9,28 +9,61 @@ const chalk_1 = __importDefault(require("chalk"));
|
|
|
9
9
|
const figures_1 = __importDefault(require("figures"));
|
|
10
10
|
function addInitCommand(program) {
|
|
11
11
|
program
|
|
12
|
-
.command('init')
|
|
13
|
-
.description('Initialize a new neex project
|
|
14
|
-
.
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
child.on('close', (code) => {
|
|
24
|
-
if (code !== 0) {
|
|
25
|
-
console.error(chalk_1.default.red(`${figures_1.default.cross} Error initializing project. 'npx create-neex' exited with code ${code}`));
|
|
12
|
+
.command('init [project-name]')
|
|
13
|
+
.description('Initialize a new neex project (alias for npx create-neex)')
|
|
14
|
+
.option('-d, --debug', 'Enable debug mode to see detailed logs')
|
|
15
|
+
.option('--version', 'Check CLI version')
|
|
16
|
+
.action((projectName, options) => {
|
|
17
|
+
try {
|
|
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);
|
|
26
23
|
}
|
|
27
|
-
|
|
28
|
-
|
|
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(' ')}`));
|
|
29
28
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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
|
+
}
|
|
34
67
|
});
|
|
35
68
|
}
|
|
36
69
|
exports.addInitCommand = addInitCommand;
|