neex 0.5.4 → 0.5.6

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/README.md CHANGED
@@ -6,7 +6,7 @@
6
6
  </picture>
7
7
  </a>
8
8
 
9
- # Neex v0.5.4
9
+ # Neex v0.5.5
10
10
 
11
11
  ### 🚀 Neex: The Modern Build System for Polyrepo-in-Monorepo Architecture
12
12
 
@@ -22,9 +22,14 @@ var __importStar = (this && this.__importStar) || function (mod) {
22
22
  __setModuleDefault(result, mod);
23
23
  return result;
24
24
  };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
25
28
  Object.defineProperty(exports, "__esModule", { value: true });
26
29
  exports.addDevCommands = void 0;
27
30
  const dev_runner_js_1 = require("../dev-runner.js");
31
+ const chalk_1 = __importDefault(require("chalk"));
32
+ const figures_1 = __importDefault(require("figures"));
28
33
  const path = __importStar(require("path"));
29
34
  const fs = __importStar(require("fs/promises"));
30
35
  // Helper function to find default command from package.json
@@ -36,9 +41,11 @@ async function findDefaultCommand() {
36
41
  const packageJsonContent = await fs.readFile(packageJsonPath, 'utf-8');
37
42
  const packageJson = JSON.parse(packageJsonContent);
38
43
  if ((_a = packageJson.scripts) === null || _a === void 0 ? void 0 : _a.dev) {
44
+ console.log(chalk_1.default.blue(`${figures_1.default.info} No command provided. Using "dev" script from package.json: npm run dev`));
39
45
  return 'npm run dev';
40
46
  }
41
47
  if ((_b = packageJson.scripts) === null || _b === void 0 ? void 0 : _b.start) {
48
+ console.log(chalk_1.default.blue(`${figures_1.default.info} No command provided. Using "start" script from package.json: npm run start`));
42
49
  return 'npm run start';
43
50
  }
44
51
  if (packageJson.main) {
@@ -47,9 +54,11 @@ async function findDefaultCommand() {
47
54
  try {
48
55
  await fs.access(mainFilePath);
49
56
  if (mainFile.endsWith('.ts') || mainFile.endsWith('.mts') || mainFile.endsWith('.cts')) {
57
+ console.log(chalk_1.default.blue(`${figures_1.default.info} No command or script found. Using "main" field (TypeScript): neex dev ${mainFile}`));
50
58
  return `npx ts-node ${mainFile}`;
51
59
  }
52
60
  else {
61
+ console.log(chalk_1.default.blue(`${figures_1.default.info} No command or script found. Using "main" field (JavaScript): node ${mainFile}`));
53
62
  return `node ${mainFile}`;
54
63
  }
55
64
  }
@@ -91,11 +100,45 @@ function addDevCommands(program) {
91
100
  const foundCommand = await findDefaultCommand();
92
101
  if (foundCommand) {
93
102
  effectiveCommands = [foundCommand];
103
+ console.log(chalk_1.default.blue(`${figures_1.default.info} No command specified for 'neex dev', using default: "${foundCommand}"`));
94
104
  }
95
105
  else {
106
+ console.error(chalk_1.default.red(`${figures_1.default.cross} No command specified for 'neex dev' and no default script (dev, start) or main file found in package.json.`));
107
+ console.error(chalk_1.default.yellow(`${figures_1.default.pointer} Please specify a command to run (e.g., neex dev "npm run dev") or define a "dev" or "start" script in your package.json.`));
96
108
  process.exit(1);
97
109
  }
98
110
  }
111
+ else { // At least one command/argument is provided
112
+ const firstArg = effectiveCommands[0];
113
+ const remainingArgs = effectiveCommands.slice(1);
114
+ const isLikelyCommandOrScript = firstArg.includes(' ') || firstArg.startsWith('npm') || firstArg.startsWith('yarn') || firstArg.startsWith('pnpm');
115
+ if (!isLikelyCommandOrScript) {
116
+ const filePath = path.resolve(process.cwd(), firstArg);
117
+ try {
118
+ await fs.access(filePath); // Check if file exists
119
+ let commandToExecute = '';
120
+ if (firstArg.endsWith('.js') || firstArg.endsWith('.mjs') || firstArg.endsWith('.cjs')) {
121
+ commandToExecute = `node ${firstArg}`;
122
+ console.log(chalk_1.default.blue(`${figures_1.default.info} Detected .js file, prepending with node.`));
123
+ }
124
+ else if (firstArg.endsWith('.ts') || firstArg.endsWith('.mts') || firstArg.endsWith('.cts')) {
125
+ commandToExecute = `neex dev ${firstArg}`;
126
+ console.log(chalk_1.default.blue(`${figures_1.default.info} Detected .ts file, prepending with neex dev.`));
127
+ }
128
+ if (commandToExecute) {
129
+ effectiveCommands = [commandToExecute, ...remainingArgs];
130
+ console.log(chalk_1.default.cyan(`${figures_1.default.pointer} Executing: ${effectiveCommands.join(' ')}`));
131
+ }
132
+ else {
133
+ console.log(chalk_1.default.yellow(`${figures_1.default.warning} First argument "${firstArg}" is not a recognized .js/.ts file and doesn't look like a script. Attempting to run as is.`));
134
+ }
135
+ }
136
+ catch (e) {
137
+ console.log(chalk_1.default.yellow(`${figures_1.default.warning} File "${firstArg}" not found. Attempting to run as command.`));
138
+ }
139
+ }
140
+ }
141
+ console.log(chalk_1.default.blue(`${figures_1.default.info} Starting development server with file watching (neex dev) for command(s): ${effectiveCommands.map(cmd => `"${cmd}"`).join(' && ')}...`));
99
142
  const watchPaths = options.watch || ['./'];
100
143
  const ignorePatterns = options.ignore || [
101
144
  'node_modules/**', '.git/**', '*.log', 'dist/**', 'build/**',
@@ -105,18 +148,18 @@ function addDevCommands(program) {
105
148
  devRunner = new dev_runner_js_1.DevRunner({
106
149
  runnerName: 'neex dev',
107
150
  parallel: false,
108
- color: false,
109
- showTiming: false,
110
- prefix: false,
151
+ color: options.color,
152
+ showTiming: options.timing,
153
+ prefix: options.prefix,
111
154
  stopOnError: options.stopOnError,
112
- printOutput: false,
113
- minimalOutput: true,
155
+ printOutput: options.output,
156
+ minimalOutput: options.minimal,
114
157
  watch: watchPaths,
115
158
  ignore: ignorePatterns,
116
159
  ext: extensions,
117
160
  delay: options.delay || 1000,
118
- clearConsole: false,
119
- verbose: false,
161
+ clearConsole: options.clear,
162
+ verbose: options.verbose,
120
163
  signal: options.signal,
121
164
  restartOnChange: true,
122
165
  groupOutput: false,
@@ -126,7 +169,10 @@ function addDevCommands(program) {
126
169
  }
127
170
  catch (error) {
128
171
  if (error instanceof Error) {
129
- console.error(error.message);
172
+ console.error(chalk_1.default.red(`${figures_1.default.cross} Dev Error: ${error.message}`));
173
+ }
174
+ else {
175
+ console.error(chalk_1.default.red(`${figures_1.default.cross} An unknown dev error occurred`));
130
176
  }
131
177
  process.exit(1);
132
178
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neex",
3
- "version": "0.5.4",
3
+ "version": "0.5.6",
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",