neex 0.6.36 → 0.6.37
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/build-manager.js +13 -15
- package/dist/src/cli.js +2 -2
- package/dist/src/commands/dev-commands.js +188 -21
- package/dist/src/commands/index.js +20 -12
- package/dist/src/dev-runner.js +2 -43
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -69,12 +69,11 @@ class BuildManager {
|
|
|
69
69
|
clean: false,
|
|
70
70
|
sourceMap: false,
|
|
71
71
|
target: 'es2020',
|
|
72
|
-
module: 'commonjs'
|
|
73
|
-
silent: false,
|
|
72
|
+
module: 'commonjs'
|
|
74
73
|
};
|
|
75
74
|
this.options = {
|
|
76
75
|
...defaultOptions,
|
|
77
|
-
...options
|
|
76
|
+
...options
|
|
78
77
|
};
|
|
79
78
|
}
|
|
80
79
|
setupFileWatcher() {
|
|
@@ -97,7 +96,7 @@ class BuildManager {
|
|
|
97
96
|
});
|
|
98
97
|
}
|
|
99
98
|
async handleFileChange(event) {
|
|
100
|
-
if (this.options.showInfo
|
|
99
|
+
if (this.options.showInfo) {
|
|
101
100
|
const prefix = chalk_1.default.cyan(`[${this.options.runnerName}]`);
|
|
102
101
|
logger_1.default.printLine(`${prefix} File changed: ${chalk_1.default.yellow(event.relativePath)}`, 'info');
|
|
103
102
|
}
|
|
@@ -108,7 +107,7 @@ class BuildManager {
|
|
|
108
107
|
await fs.mkdir(this.options.outputDir, { recursive: true });
|
|
109
108
|
}
|
|
110
109
|
catch (error) {
|
|
111
|
-
if (this.options.showInfo
|
|
110
|
+
if (this.options.showInfo) {
|
|
112
111
|
logger_1.default.printLine(`Failed to create output directory: ${error.message}`, 'error');
|
|
113
112
|
}
|
|
114
113
|
throw error;
|
|
@@ -120,13 +119,13 @@ class BuildManager {
|
|
|
120
119
|
}
|
|
121
120
|
try {
|
|
122
121
|
await fs.rm(this.options.outputDir, { recursive: true, force: true });
|
|
123
|
-
if (this.options.showInfo
|
|
122
|
+
if (this.options.showInfo) {
|
|
124
123
|
const prefix = chalk_1.default.cyan(`[${this.options.runnerName}]`);
|
|
125
124
|
logger_1.default.printLine(`${prefix} Cleaned output directory: ${chalk_1.default.yellow(this.options.outputDir)}`, 'info');
|
|
126
125
|
}
|
|
127
126
|
}
|
|
128
127
|
catch (error) {
|
|
129
|
-
if (this.options.showInfo
|
|
128
|
+
if (this.options.showInfo) {
|
|
130
129
|
logger_1.default.printLine(`Failed to clean output directory: ${error.message}`, 'error');
|
|
131
130
|
}
|
|
132
131
|
throw error;
|
|
@@ -157,8 +156,7 @@ class BuildManager {
|
|
|
157
156
|
printOutput: (_a = this.options.showInfo) !== null && _a !== void 0 ? _a : false,
|
|
158
157
|
showTiming: (_b = this.options.showInfo) !== null && _b !== void 0 ? _b : false,
|
|
159
158
|
prefix: (_c = this.options.showInfo) !== null && _c !== void 0 ? _c : false,
|
|
160
|
-
customPrefix: this.options.showInfo ? () => `build` : undefined
|
|
161
|
-
silent: this.options.silent, // Pass silent option to the runner
|
|
159
|
+
customPrefix: this.options.showInfo ? () => `build` : undefined
|
|
162
160
|
};
|
|
163
161
|
this.runner = new runner_1.Runner(runnerOptions);
|
|
164
162
|
try {
|
|
@@ -252,7 +250,7 @@ class BuildManager {
|
|
|
252
250
|
// Set up graceful shutdown
|
|
253
251
|
this.setupGracefulShutdown();
|
|
254
252
|
if (this.options.watch) {
|
|
255
|
-
if (this.options.showInfo
|
|
253
|
+
if (this.options.showInfo) {
|
|
256
254
|
const prefix = chalk_1.default.cyan(`[${this.options.runnerName}]`);
|
|
257
255
|
logger_1.default.printLine(`${prefix} Build completed. Watching for changes...`, 'info');
|
|
258
256
|
logger_1.default.printLine(`${prefix} Press ${chalk_1.default.cyan('Ctrl+C')} to stop`, 'info');
|
|
@@ -263,7 +261,7 @@ class BuildManager {
|
|
|
263
261
|
if (this.isBuilding) {
|
|
264
262
|
return;
|
|
265
263
|
}
|
|
266
|
-
if (this.options.showInfo
|
|
264
|
+
if (this.options.showInfo) {
|
|
267
265
|
const prefix = chalk_1.default.cyan(`[${this.options.runnerName}]`);
|
|
268
266
|
logger_1.default.printLine(`${prefix} Rebuilding due to file changes...`, 'info');
|
|
269
267
|
}
|
|
@@ -279,7 +277,7 @@ class BuildManager {
|
|
|
279
277
|
}
|
|
280
278
|
// Run build again
|
|
281
279
|
await this.runBuild();
|
|
282
|
-
if (this.options.showInfo
|
|
280
|
+
if (this.options.showInfo) {
|
|
283
281
|
const prefix = chalk_1.default.cyan(`[${this.options.runnerName}]`);
|
|
284
282
|
logger_1.default.printLine(`${prefix} Rebuild completed. Watching for changes...`, 'info');
|
|
285
283
|
}
|
|
@@ -292,7 +290,7 @@ class BuildManager {
|
|
|
292
290
|
if (!this.isBuilding && !this.options.watch) {
|
|
293
291
|
return;
|
|
294
292
|
}
|
|
295
|
-
if (this.options.showInfo
|
|
293
|
+
if (this.options.showInfo) {
|
|
296
294
|
const prefix = chalk_1.default.cyan(`[${this.options.runnerName}]`);
|
|
297
295
|
logger_1.default.printLine(`${prefix} Stopping build process...`, 'info');
|
|
298
296
|
}
|
|
@@ -304,7 +302,7 @@ class BuildManager {
|
|
|
304
302
|
if (this.runner) {
|
|
305
303
|
this.runner.cleanup('SIGTERM');
|
|
306
304
|
}
|
|
307
|
-
if (this.options.showInfo
|
|
305
|
+
if (this.options.showInfo) {
|
|
308
306
|
const prefix = chalk_1.default.cyan(`[${this.options.runnerName}]`);
|
|
309
307
|
const uptime = Math.floor((Date.now() - this.startTime.getTime()) / 1000);
|
|
310
308
|
const uptimeStr = this.formatUptime(uptime);
|
|
@@ -316,7 +314,7 @@ class BuildManager {
|
|
|
316
314
|
}
|
|
317
315
|
setupGracefulShutdown() {
|
|
318
316
|
const handleSignal = (signal) => {
|
|
319
|
-
if (this.options.showInfo
|
|
317
|
+
if (this.options.showInfo) {
|
|
320
318
|
console.log(`\n${chalk_1.default.yellow(`${figures_1.default.warning} Received ${signal}. Shutting down build process...`)}`);
|
|
321
319
|
}
|
|
322
320
|
this.stop().then(() => {
|
package/dist/src/cli.js
CHANGED
|
@@ -20,8 +20,8 @@ function cli() {
|
|
|
20
20
|
// Add all command groups
|
|
21
21
|
(0, index_js_1.addRunCommands)(program);
|
|
22
22
|
(0, index_js_1.addServerCommands)(program);
|
|
23
|
-
const
|
|
24
|
-
cleanupHandlers.push(
|
|
23
|
+
const devCommands = (0, index_js_1.addDevCommands)(program);
|
|
24
|
+
cleanupHandlers.push(devCommands.cleanupDev);
|
|
25
25
|
const buildCommands = (0, index_js_1.addBuildCommands)(program);
|
|
26
26
|
cleanupHandlers.push(buildCommands.cleanupBuild);
|
|
27
27
|
const startCommands = (0, index_js_1.addStartCommands)(program);
|
|
@@ -1,42 +1,209 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
27
|
};
|
|
5
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
29
|
+
exports.addDevCommands = void 0;
|
|
7
30
|
const dev_runner_js_1 = require("../dev-runner.js");
|
|
8
31
|
const chalk_1 = __importDefault(require("chalk"));
|
|
9
|
-
const
|
|
10
|
-
|
|
32
|
+
const figures_1 = __importDefault(require("figures"));
|
|
33
|
+
const path = __importStar(require("path"));
|
|
34
|
+
const fs = __importStar(require("fs/promises"));
|
|
35
|
+
// Helper function to check if file exists
|
|
36
|
+
async function fileExists(filePath) {
|
|
37
|
+
try {
|
|
38
|
+
await fs.access(filePath);
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
41
|
+
catch (_a) {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
// Helper function to determine the best command to run the file
|
|
46
|
+
async function getBestCommand(filePath, showInfo) {
|
|
47
|
+
const ext = path.extname(filePath).toLowerCase();
|
|
48
|
+
const absolutePath = path.resolve(process.cwd(), filePath);
|
|
49
|
+
// Check if file exists
|
|
50
|
+
if (!(await fileExists(absolutePath))) {
|
|
51
|
+
throw new Error(`File not found: ${filePath}`);
|
|
52
|
+
}
|
|
53
|
+
if (showInfo) {
|
|
54
|
+
console.log(chalk_1.default.blue(`${figures_1.default.info} neex dev: Analyzing ${chalk_1.default.cyan(path.basename(filePath))}`));
|
|
55
|
+
}
|
|
56
|
+
switch (ext) {
|
|
57
|
+
case '.ts':
|
|
58
|
+
case '.mts':
|
|
59
|
+
case '.cts':
|
|
60
|
+
if (showInfo) {
|
|
61
|
+
console.log(chalk_1.default.green(`${figures_1.default.tick} neex dev: TypeScript detected, ready to run`));
|
|
62
|
+
}
|
|
63
|
+
return `npx ts-node ${filePath}`;
|
|
64
|
+
case '.js':
|
|
65
|
+
case '.mjs':
|
|
66
|
+
case '.cjs':
|
|
67
|
+
if (showInfo) {
|
|
68
|
+
console.log(chalk_1.default.green(`${figures_1.default.tick} neex dev: JavaScript detected, ready to run`));
|
|
69
|
+
}
|
|
70
|
+
return `node ${filePath}`;
|
|
71
|
+
default:
|
|
72
|
+
if (showInfo) {
|
|
73
|
+
console.log(chalk_1.default.yellow(`${figures_1.default.warning} neex dev: Unknown file type, using Node.js`));
|
|
74
|
+
}
|
|
75
|
+
return `node ${filePath}`;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
function addDevCommands(program) {
|
|
79
|
+
let devRunner = null;
|
|
80
|
+
// Dev command - file watching and auto-restart like nodemon/ts-node-dev
|
|
11
81
|
program
|
|
12
|
-
.command('dev')
|
|
13
|
-
.
|
|
14
|
-
.
|
|
15
|
-
.
|
|
82
|
+
.command('dev <file>') // Made file mandatory
|
|
83
|
+
.alias('d')
|
|
84
|
+
.description('Run TypeScript/JavaScript files with file watching and auto-restart (like nodemon/ts-node-dev but better)')
|
|
85
|
+
.option('-c, --no-color', 'Disable colored output')
|
|
86
|
+
.option('-t, --no-timing', 'Hide timing information')
|
|
87
|
+
.option('-p, --no-prefix', 'Hide command prefix')
|
|
88
|
+
.option('-s, --stop-on-error', 'Stop on first error')
|
|
89
|
+
.option('-o, --no-output', 'Hide command output')
|
|
90
|
+
.option('-m, --minimal', 'Use minimal output format')
|
|
91
|
+
.option('-w, --watch <paths...>', 'Additional paths to watch (default: current directory)')
|
|
92
|
+
.option('-i, --ignore <patterns...>', 'Patterns to ignore')
|
|
93
|
+
.option('-e, --ext <extensions...>', 'File extensions to watch (default: js,mjs,json,ts,tsx,jsx)')
|
|
94
|
+
.option('-d, --delay <ms>', 'Delay before restart in milliseconds', parseInt)
|
|
95
|
+
.option('--clear', 'Clear console on restart')
|
|
96
|
+
.option('--verbose', 'Verbose output')
|
|
97
|
+
.option('--info', 'Show detailed information during startup')
|
|
98
|
+
.option('--signal <signal>', 'Signal to send to processes on restart', 'SIGTERM')
|
|
99
|
+
.action(async (file, options) => {
|
|
16
100
|
try {
|
|
17
|
-
const
|
|
18
|
-
if (
|
|
19
|
-
console.
|
|
101
|
+
const showInfo = options.info || false;
|
|
102
|
+
if (showInfo) {
|
|
103
|
+
console.log(chalk_1.default.blue(`${figures_1.default.info} neex dev: Starting enhanced development server...`));
|
|
104
|
+
console.log(chalk_1.default.blue(`${figures_1.default.info} neex dev: Target file: ${chalk_1.default.cyan(file)}`));
|
|
105
|
+
}
|
|
106
|
+
// Validate file parameter
|
|
107
|
+
if (!file || file.trim() === '') {
|
|
108
|
+
console.error(chalk_1.default.red(`${figures_1.default.cross} neex dev: Error - No file specified!`));
|
|
109
|
+
console.error(chalk_1.default.yellow(`${figures_1.default.pointer} Usage: neex dev <file>`));
|
|
110
|
+
console.error(chalk_1.default.yellow(`${figures_1.default.pointer} Example: neex dev src/server.ts`));
|
|
20
111
|
process.exit(1);
|
|
21
112
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
113
|
+
// Get the best command to run the file
|
|
114
|
+
let commandToExecute;
|
|
115
|
+
let fileExtension;
|
|
116
|
+
try {
|
|
117
|
+
commandToExecute = await getBestCommand(file, showInfo);
|
|
118
|
+
fileExtension = path.extname(file).toLowerCase();
|
|
119
|
+
}
|
|
120
|
+
catch (error) {
|
|
121
|
+
console.error(chalk_1.default.red(`${figures_1.default.cross} neex dev: ${error instanceof Error ? error.message : 'Unknown error occurred'}`));
|
|
122
|
+
process.exit(1);
|
|
123
|
+
}
|
|
124
|
+
// Setup watch configuration
|
|
125
|
+
const watchPaths = options.watch ? [...options.watch, './'] : ['./'];
|
|
126
|
+
const ignorePatterns = options.ignore || [
|
|
127
|
+
'node_modules/**',
|
|
128
|
+
'.git/**',
|
|
129
|
+
'*.log',
|
|
130
|
+
'dist/**',
|
|
131
|
+
'build/**',
|
|
132
|
+
'coverage/**',
|
|
133
|
+
'.nyc_output/**',
|
|
134
|
+
'*.tmp',
|
|
135
|
+
'*.temp',
|
|
136
|
+
'.DS_Store',
|
|
137
|
+
'Thumbs.db'
|
|
138
|
+
];
|
|
139
|
+
const extensions = options.ext || ['js', 'mjs', 'json', 'ts', 'tsx', 'jsx', 'vue', 'svelte'];
|
|
140
|
+
// Log configuration only if --info flag is set
|
|
141
|
+
if (showInfo) {
|
|
142
|
+
console.log(chalk_1.default.blue(`${figures_1.default.info} neex dev: Configuration:`));
|
|
143
|
+
console.log(chalk_1.default.blue(` ${figures_1.default.arrowRight} Target: ${chalk_1.default.cyan(file)}`));
|
|
144
|
+
console.log(chalk_1.default.blue(` ${figures_1.default.arrowRight} Runtime: ${chalk_1.default.cyan(fileExtension === '.ts' || fileExtension === '.mts' || fileExtension === '.cts' ? 'TypeScript' : 'JavaScript')}`));
|
|
145
|
+
console.log(chalk_1.default.blue(` ${figures_1.default.arrowRight} Watch paths: ${chalk_1.default.cyan(watchPaths.join(', '))}`));
|
|
146
|
+
console.log(chalk_1.default.blue(` ${figures_1.default.arrowRight} Extensions: ${chalk_1.default.cyan(extensions.join(', '))}`));
|
|
147
|
+
console.log(chalk_1.default.blue(` ${figures_1.default.arrowRight} Restart delay: ${chalk_1.default.cyan(options.delay || 1000)}ms`));
|
|
148
|
+
console.log(chalk_1.default.blue(` ${figures_1.default.arrowRight} Clear console: ${chalk_1.default.cyan(options.clear ? 'Yes' : 'No')}`));
|
|
149
|
+
if (options.verbose) {
|
|
150
|
+
console.log(chalk_1.default.blue(`${figures_1.default.info} neex dev: Verbose mode enabled - showing detailed logs`));
|
|
151
|
+
}
|
|
152
|
+
console.log(chalk_1.default.green(`${figures_1.default.tick} neex dev: Starting file watcher and process manager...`));
|
|
153
|
+
console.log(chalk_1.default.green(`${figures_1.default.tick} neex dev: Launching ${chalk_1.default.cyan(path.basename(file))} with auto-restart capability...`));
|
|
154
|
+
console.log(chalk_1.default.blue(`${figures_1.default.info} neex dev: Press Ctrl+C to stop the development server`));
|
|
155
|
+
console.log(chalk_1.default.gray(`${'='.repeat(60)}`));
|
|
156
|
+
}
|
|
157
|
+
// Create DevRunner instance
|
|
158
|
+
devRunner = new dev_runner_js_1.DevRunner({
|
|
159
|
+
runnerName: 'neex dev',
|
|
160
|
+
parallel: false,
|
|
161
|
+
color: options.color,
|
|
162
|
+
showTiming: options.timing,
|
|
163
|
+
prefix: options.prefix,
|
|
164
|
+
stopOnError: options.stopOnError,
|
|
165
|
+
printOutput: options.output,
|
|
166
|
+
minimalOutput: options.minimal,
|
|
167
|
+
watch: watchPaths,
|
|
168
|
+
ignore: ignorePatterns,
|
|
169
|
+
ext: extensions,
|
|
170
|
+
delay: options.delay || 1000,
|
|
171
|
+
clearConsole: options.clear,
|
|
172
|
+
verbose: options.verbose,
|
|
173
|
+
showInfo: showInfo,
|
|
174
|
+
signal: options.signal,
|
|
175
|
+
restartOnChange: true,
|
|
176
|
+
groupOutput: false,
|
|
177
|
+
isServerMode: false
|
|
178
|
+
});
|
|
179
|
+
// Start the development server
|
|
180
|
+
await devRunner.start([commandToExecute]);
|
|
29
181
|
}
|
|
30
182
|
catch (error) {
|
|
31
|
-
console.error(chalk_1.default.red(
|
|
183
|
+
console.error(chalk_1.default.red(`${figures_1.default.cross} neex dev: Fatal error occurred`));
|
|
184
|
+
if (error instanceof Error) {
|
|
185
|
+
console.error(chalk_1.default.red(`${figures_1.default.cross} Details: ${error.message}`));
|
|
186
|
+
if (options.verbose && error.stack) {
|
|
187
|
+
console.error(chalk_1.default.gray(`Stack trace:\n${error.stack}`));
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
else {
|
|
191
|
+
console.error(chalk_1.default.red(`${figures_1.default.cross} Unknown error occurred`));
|
|
192
|
+
}
|
|
193
|
+
console.error(chalk_1.default.yellow(`${figures_1.default.pointer} Try running with --verbose flag for more details`));
|
|
32
194
|
process.exit(1);
|
|
33
195
|
}
|
|
34
196
|
});
|
|
197
|
+
// Return cleanup function for dev runner
|
|
35
198
|
return {
|
|
199
|
+
getDevRunner: () => devRunner,
|
|
36
200
|
cleanupDev: () => {
|
|
37
|
-
|
|
38
|
-
|
|
201
|
+
if (devRunner && devRunner.isActive()) {
|
|
202
|
+
console.log(chalk_1.default.blue(`${figures_1.default.info} neex dev: Stopping development server...`));
|
|
203
|
+
devRunner.stop();
|
|
204
|
+
console.log(chalk_1.default.green(`${figures_1.default.tick} neex dev: Development server stopped successfully`));
|
|
205
|
+
}
|
|
39
206
|
}
|
|
40
207
|
};
|
|
41
208
|
}
|
|
42
|
-
exports.
|
|
209
|
+
exports.addDevCommands = addDevCommands;
|
|
@@ -1,14 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
3
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
Object.defineProperty(exports, "devCommands", { enumerable: true, get: function () { return dev_commands_js_1.devCommands; } });
|
|
11
|
-
var build_commands_js_1 = require("./build-commands.js");
|
|
12
|
-
Object.defineProperty(exports, "addBuildCommands", { enumerable: true, get: function () { return build_commands_js_1.addBuildCommands; } });
|
|
13
|
-
var start_commands_js_1 = require("./start-commands.js");
|
|
14
|
-
Object.defineProperty(exports, "addStartCommands", { enumerable: true, get: function () { return start_commands_js_1.addStartCommands; } });
|
|
17
|
+
// src/commands/index.ts - Export all commands
|
|
18
|
+
__exportStar(require("./run-commands.js"), exports);
|
|
19
|
+
__exportStar(require("./dev-commands.js"), exports);
|
|
20
|
+
__exportStar(require("./server-commands.js"), exports);
|
|
21
|
+
__exportStar(require("./start-commands.js"), exports);
|
|
22
|
+
__exportStar(require("./build-commands"), exports);
|
package/dist/src/dev-runner.js
CHANGED
|
@@ -3,15 +3,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.DevRunner = void 0;
|
|
7
7
|
// src/dev-runner.ts - Development runner with file watching (nodemon functionality)
|
|
8
8
|
const watcher_1 = require("./watcher");
|
|
9
9
|
const runner_1 = require("./runner");
|
|
10
10
|
const chalk_1 = __importDefault(require("chalk"));
|
|
11
11
|
const figures_1 = __importDefault(require("figures"));
|
|
12
12
|
const logger_1 = __importDefault(require("./logger"));
|
|
13
|
-
const logger_process_1 = require("./logger-process");
|
|
14
|
-
const child_process_1 = require("child_process");
|
|
15
13
|
class DevRunner {
|
|
16
14
|
constructor(options) {
|
|
17
15
|
this.commands = [];
|
|
@@ -100,8 +98,7 @@ class DevRunner {
|
|
|
100
98
|
};
|
|
101
99
|
this.runner = new runner_1.Runner(runnerOptions);
|
|
102
100
|
try {
|
|
103
|
-
const
|
|
104
|
-
const results = await this.runner.run(commandStrings);
|
|
101
|
+
const results = await this.runner.run(this.commands);
|
|
105
102
|
return results;
|
|
106
103
|
}
|
|
107
104
|
catch (error) {
|
|
@@ -247,41 +244,3 @@ class DevRunner {
|
|
|
247
244
|
}
|
|
248
245
|
}
|
|
249
246
|
exports.DevRunner = DevRunner;
|
|
250
|
-
function runDev(commands) {
|
|
251
|
-
const processes = [];
|
|
252
|
-
commands.forEach(cmd => {
|
|
253
|
-
const logger = new logger_process_1.LoggerProcess(cmd.name);
|
|
254
|
-
logger.info(`Starting command: ${cmd.command}`);
|
|
255
|
-
const child = (0, child_process_1.spawn)(cmd.command, {
|
|
256
|
-
shell: true,
|
|
257
|
-
stdio: 'pipe',
|
|
258
|
-
cwd: cmd.cwd || process.cwd(),
|
|
259
|
-
});
|
|
260
|
-
child.stdout.on('data', (data) => {
|
|
261
|
-
logger.log(data);
|
|
262
|
-
});
|
|
263
|
-
child.stderr.on('data', (data) => {
|
|
264
|
-
logger.error(data);
|
|
265
|
-
});
|
|
266
|
-
child.on('close', (code) => {
|
|
267
|
-
if (code === 0) {
|
|
268
|
-
logger.info(`Command finished successfully.`);
|
|
269
|
-
}
|
|
270
|
-
else {
|
|
271
|
-
logger.error(`Command failed with code ${code}.`);
|
|
272
|
-
}
|
|
273
|
-
});
|
|
274
|
-
child.on('error', (err) => {
|
|
275
|
-
logger.error(`Failed to start command: ${err.message}`);
|
|
276
|
-
});
|
|
277
|
-
processes.push(child);
|
|
278
|
-
});
|
|
279
|
-
function cleanup() {
|
|
280
|
-
console.log('\nShutting down dev processes...');
|
|
281
|
-
processes.forEach(p => p.kill());
|
|
282
|
-
process.exit();
|
|
283
|
-
}
|
|
284
|
-
process.on('SIGINT', cleanup);
|
|
285
|
-
process.on('SIGTERM', cleanup);
|
|
286
|
-
}
|
|
287
|
-
exports.runDev = runDev;
|