neex 0.6.16 → 0.6.17
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.
|
@@ -43,23 +43,35 @@ async function fileExists(filePath) {
|
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
// Helper function to determine the best command to run the file
|
|
46
|
-
async function getBestCommand(filePath) {
|
|
46
|
+
async function getBestCommand(filePath, showInfo = false) {
|
|
47
47
|
const ext = path.extname(filePath).toLowerCase();
|
|
48
48
|
const absolutePath = path.resolve(process.cwd(), filePath);
|
|
49
49
|
// Check if file exists
|
|
50
50
|
if (!(await fileExists(absolutePath))) {
|
|
51
51
|
throw new Error(`File not found: ${filePath}`);
|
|
52
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
|
+
}
|
|
53
56
|
switch (ext) {
|
|
54
57
|
case '.ts':
|
|
55
58
|
case '.mts':
|
|
56
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
|
+
}
|
|
57
63
|
return `npx ts-node ${filePath}`;
|
|
58
64
|
case '.js':
|
|
59
65
|
case '.mjs':
|
|
60
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
|
+
}
|
|
61
70
|
return `node ${filePath}`;
|
|
62
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
|
+
}
|
|
63
75
|
return `node ${filePath}`;
|
|
64
76
|
}
|
|
65
77
|
}
|
|
@@ -82,9 +94,12 @@ function addDevCommands(program) {
|
|
|
82
94
|
.option('-d, --delay <ms>', 'Delay before restart in milliseconds', parseInt)
|
|
83
95
|
.option('--clear', 'Clear console on restart')
|
|
84
96
|
.option('--verbose', 'Verbose output')
|
|
97
|
+
.option('--info', 'Show detailed information and logs')
|
|
85
98
|
.option('--signal <signal>', 'Signal to send to processes on restart', 'SIGTERM')
|
|
86
99
|
.action(async (file, options) => {
|
|
87
100
|
try {
|
|
101
|
+
console.log(chalk_1.default.blue(`${figures_1.default.info} neex dev: Starting enhanced development server...`));
|
|
102
|
+
console.log(chalk_1.default.blue(`${figures_1.default.info} neex dev: Target file: ${chalk_1.default.cyan(file)}`));
|
|
88
103
|
// Validate file parameter
|
|
89
104
|
if (!file || file.trim() === '') {
|
|
90
105
|
console.error(chalk_1.default.red(`${figures_1.default.cross} neex dev: Error - No file specified!`));
|
|
@@ -94,8 +109,10 @@ function addDevCommands(program) {
|
|
|
94
109
|
}
|
|
95
110
|
// Get the best command to run the file
|
|
96
111
|
let commandToExecute;
|
|
112
|
+
let fileExtension;
|
|
97
113
|
try {
|
|
98
114
|
commandToExecute = await getBestCommand(file);
|
|
115
|
+
fileExtension = path.extname(file).toLowerCase();
|
|
99
116
|
}
|
|
100
117
|
catch (error) {
|
|
101
118
|
console.error(chalk_1.default.red(`${figures_1.default.cross} neex dev: ${error instanceof Error ? error.message : 'Unknown error occurred'}`));
|
|
@@ -117,26 +134,19 @@ function addDevCommands(program) {
|
|
|
117
134
|
'Thumbs.db'
|
|
118
135
|
];
|
|
119
136
|
const extensions = options.ext || ['js', 'mjs', 'json', 'ts', 'tsx', 'jsx', 'vue', 'svelte'];
|
|
120
|
-
//
|
|
137
|
+
// Log configuration
|
|
138
|
+
console.log(chalk_1.default.blue(`${figures_1.default.info} neex dev: Configuration:`));
|
|
139
|
+
console.log(chalk_1.default.blue(` ${figures_1.default.arrowRight} Target: ${chalk_1.default.cyan(file)}`));
|
|
140
|
+
console.log(chalk_1.default.blue(` ${figures_1.default.arrowRight} Runtime: ${chalk_1.default.cyan(fileExtension === '.ts' || fileExtension === '.mts' || fileExtension === '.cts' ? 'TypeScript' : 'JavaScript')}`));
|
|
141
|
+
console.log(chalk_1.default.blue(` ${figures_1.default.arrowRight} Watch paths: ${chalk_1.default.cyan(watchPaths.join(', '))}`));
|
|
142
|
+
console.log(chalk_1.default.blue(` ${figures_1.default.arrowRight} Extensions: ${chalk_1.default.cyan(extensions.join(', '))}`));
|
|
143
|
+
console.log(chalk_1.default.blue(` ${figures_1.default.arrowRight} Restart delay: ${chalk_1.default.cyan(options.delay || 1000)}ms`));
|
|
144
|
+
console.log(chalk_1.default.blue(` ${figures_1.default.arrowRight} Clear console: ${chalk_1.default.cyan(options.clear ? 'Yes' : 'No')}`));
|
|
121
145
|
if (options.verbose) {
|
|
122
|
-
console.log(chalk_1.default.blue(`${figures_1.default.info} neex dev:
|
|
123
|
-
console.log(chalk_1.default.blue(`${figures_1.default.info} neex dev: Target file: ${chalk_1.default.cyan(file)}`));
|
|
124
|
-
console.log(chalk_1.default.blue(`${figures_1.default.info} neex dev: Analyzing file type for ${chalk_1.default.cyan(file)}`));
|
|
125
|
-
console.log(chalk_1.default.green(`${figures_1.default.tick} neex dev: Detected ${path.extname(file)} file, using appropriate execution method`));
|
|
126
|
-
console.log(chalk_1.default.blue(`${figures_1.default.info} neex dev: Configuration:`));
|
|
127
|
-
console.log(chalk_1.default.blue(` ${figures_1.default.arrowRight} Command: ${chalk_1.default.cyan(commandToExecute)}`));
|
|
128
|
-
console.log(chalk_1.default.blue(` ${figures_1.default.arrowRight} Watch paths: ${chalk_1.default.cyan(watchPaths.join(', '))}`));
|
|
129
|
-
console.log(chalk_1.default.blue(` ${figures_1.default.arrowRight} Extensions: ${chalk_1.default.cyan(extensions.join(', '))}`));
|
|
130
|
-
console.log(chalk_1.default.blue(` ${figures_1.default.arrowRight} Ignore patterns: ${chalk_1.default.cyan(ignorePatterns.length)} patterns`));
|
|
131
|
-
console.log(chalk_1.default.blue(` ${figures_1.default.arrowRight} Restart delay: ${chalk_1.default.cyan(options.delay || 1000)}ms`));
|
|
132
|
-
console.log(chalk_1.default.blue(` ${figures_1.default.arrowRight} Clear console: ${chalk_1.default.cyan(options.clear ? 'Yes' : 'No')}`));
|
|
133
|
-
console.log(chalk_1.default.blue(` ${figures_1.default.arrowRight} Signal: ${chalk_1.default.cyan(options.signal)}`));
|
|
134
|
-
console.log(chalk_1.default.green(`${figures_1.default.tick} neex dev: Starting file watcher and process manager...`));
|
|
135
|
-
console.log(chalk_1.default.green(`${figures_1.default.tick} neex dev: Launching ${chalk_1.default.cyan(path.basename(file))} with auto-restart capability...`));
|
|
136
|
-
console.log(chalk_1.default.blue(`${figures_1.default.info} neex dev: Press Ctrl+C to stop the development server`));
|
|
137
|
-
console.log(chalk_1.default.gray(`${'='.repeat(60)}`));
|
|
146
|
+
console.log(chalk_1.default.blue(`${figures_1.default.info} neex dev: Verbose mode enabled - showing detailed logs`));
|
|
138
147
|
}
|
|
139
|
-
|
|
148
|
+
console.log(chalk_1.default.green(`${figures_1.default.tick} neex dev: Starting file watcher and process manager...`));
|
|
149
|
+
// Create DevRunner instance - remove customPrefix since it doesn't exist
|
|
140
150
|
devRunner = new dev_runner_js_1.DevRunner({
|
|
141
151
|
runnerName: 'neex dev',
|
|
142
152
|
parallel: false,
|
|
@@ -157,8 +167,10 @@ function addDevCommands(program) {
|
|
|
157
167
|
groupOutput: false,
|
|
158
168
|
isServerMode: false
|
|
159
169
|
});
|
|
160
|
-
//
|
|
161
|
-
console.log(chalk_1.default.
|
|
170
|
+
// Start the development server
|
|
171
|
+
console.log(chalk_1.default.green(`${figures_1.default.tick} neex dev: Launching ${chalk_1.default.cyan(path.basename(file))} with auto-restart capability...`));
|
|
172
|
+
console.log(chalk_1.default.blue(`${figures_1.default.info} neex dev: Press Ctrl+C to stop the development server`));
|
|
173
|
+
console.log(chalk_1.default.gray(`${'='.repeat(60)}`));
|
|
162
174
|
await devRunner.start([commandToExecute]);
|
|
163
175
|
}
|
|
164
176
|
catch (error) {
|