neex 0.5.3 → 0.5.4
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 +1 -1
- package/dist/src/commands/dev-commands.js +8 -54
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -22,14 +22,9 @@ 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
|
-
};
|
|
28
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
26
|
exports.addDevCommands = void 0;
|
|
30
27
|
const dev_runner_js_1 = require("../dev-runner.js");
|
|
31
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
32
|
-
const figures_1 = __importDefault(require("figures"));
|
|
33
28
|
const path = __importStar(require("path"));
|
|
34
29
|
const fs = __importStar(require("fs/promises"));
|
|
35
30
|
// Helper function to find default command from package.json
|
|
@@ -41,11 +36,9 @@ async function findDefaultCommand() {
|
|
|
41
36
|
const packageJsonContent = await fs.readFile(packageJsonPath, 'utf-8');
|
|
42
37
|
const packageJson = JSON.parse(packageJsonContent);
|
|
43
38
|
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`));
|
|
45
39
|
return 'npm run dev';
|
|
46
40
|
}
|
|
47
41
|
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`));
|
|
49
42
|
return 'npm run start';
|
|
50
43
|
}
|
|
51
44
|
if (packageJson.main) {
|
|
@@ -54,11 +47,9 @@ async function findDefaultCommand() {
|
|
|
54
47
|
try {
|
|
55
48
|
await fs.access(mainFilePath);
|
|
56
49
|
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}`));
|
|
58
50
|
return `npx ts-node ${mainFile}`;
|
|
59
51
|
}
|
|
60
52
|
else {
|
|
61
|
-
console.log(chalk_1.default.blue(`${figures_1.default.info} No command or script found. Using "main" field (JavaScript): node ${mainFile}`));
|
|
62
53
|
return `node ${mainFile}`;
|
|
63
54
|
}
|
|
64
55
|
}
|
|
@@ -100,45 +91,11 @@ function addDevCommands(program) {
|
|
|
100
91
|
const foundCommand = await findDefaultCommand();
|
|
101
92
|
if (foundCommand) {
|
|
102
93
|
effectiveCommands = [foundCommand];
|
|
103
|
-
console.log(chalk_1.default.blue(`${figures_1.default.info} No command specified for 'neex dev', using default: "${foundCommand}"`));
|
|
104
94
|
}
|
|
105
95
|
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.`));
|
|
108
96
|
process.exit(1);
|
|
109
97
|
}
|
|
110
98
|
}
|
|
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(' && ')}...`));
|
|
142
99
|
const watchPaths = options.watch || ['./'];
|
|
143
100
|
const ignorePatterns = options.ignore || [
|
|
144
101
|
'node_modules/**', '.git/**', '*.log', 'dist/**', 'build/**',
|
|
@@ -148,18 +105,18 @@ function addDevCommands(program) {
|
|
|
148
105
|
devRunner = new dev_runner_js_1.DevRunner({
|
|
149
106
|
runnerName: 'neex dev',
|
|
150
107
|
parallel: false,
|
|
151
|
-
color:
|
|
152
|
-
showTiming:
|
|
153
|
-
prefix:
|
|
108
|
+
color: false,
|
|
109
|
+
showTiming: false,
|
|
110
|
+
prefix: false,
|
|
154
111
|
stopOnError: options.stopOnError,
|
|
155
|
-
printOutput:
|
|
156
|
-
minimalOutput:
|
|
112
|
+
printOutput: false,
|
|
113
|
+
minimalOutput: true,
|
|
157
114
|
watch: watchPaths,
|
|
158
115
|
ignore: ignorePatterns,
|
|
159
116
|
ext: extensions,
|
|
160
117
|
delay: options.delay || 1000,
|
|
161
|
-
clearConsole:
|
|
162
|
-
verbose:
|
|
118
|
+
clearConsole: false,
|
|
119
|
+
verbose: false,
|
|
163
120
|
signal: options.signal,
|
|
164
121
|
restartOnChange: true,
|
|
165
122
|
groupOutput: false,
|
|
@@ -169,10 +126,7 @@ function addDevCommands(program) {
|
|
|
169
126
|
}
|
|
170
127
|
catch (error) {
|
|
171
128
|
if (error instanceof Error) {
|
|
172
|
-
console.error(
|
|
173
|
-
}
|
|
174
|
-
else {
|
|
175
|
-
console.error(chalk_1.default.red(`${figures_1.default.cross} An unknown dev error occurred`));
|
|
129
|
+
console.error(error.message);
|
|
176
130
|
}
|
|
177
131
|
process.exit(1);
|
|
178
132
|
}
|