neex 0.6.71 → 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 CHANGED
@@ -11,12 +11,6 @@ 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
- }
20
14
  // Initialize cleanup handlers
21
15
  const cleanupHandlers = [];
22
16
  program
@@ -24,7 +18,7 @@ function cli() {
24
18
  .description('Professional script runner with nodemon and PM2 functionality')
25
19
  .version(version);
26
20
  // Add all command groups
27
- (0, index_js_1.addInitCommand)(program); // Keep it for --help
21
+ (0, index_js_1.addInitCommand)(program); // Add the new init command
28
22
  (0, index_js_1.addRunCommands)(program);
29
23
  (0, index_js_1.addServerCommands)(program);
30
24
  const devCommands = (0, index_js_1.addDevCommands)(program);
@@ -33,9 +27,18 @@ function cli() {
33
27
  cleanupHandlers.push(buildCommands.cleanupBuild);
34
28
  const startCommands = (0, index_js_1.addStartCommands)(program);
35
29
  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
+ }
36
37
  program.parse(process.argv);
37
- // Show help if no commands specified
38
- if (program.args.length === 0) {
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
39
42
  program.help();
40
43
  }
41
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,38 +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
- const chalk_1 = __importDefault(require("chalk"));
9
- const figures_1 = __importDefault(require("figures"));
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 [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
- });
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);
36
28
  });
37
29
  }
38
30
  exports.addInitCommand = addInitCommand;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neex",
3
- "version": "0.6.71",
3
+ "version": "0.6.73",
4
4
  "description": "The Modern Build System for Polyrepo-in-Monorepo Architecture",
5
5
  "main": "dist/src/index.js",
6
6
  "types": "dist/src/index.d.ts",