neex 0.6.15 → 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,27 +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
|
-
|
|
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
|
+
}
|
|
54
56
|
switch (ext) {
|
|
55
57
|
case '.ts':
|
|
56
58
|
case '.mts':
|
|
57
59
|
case '.cts':
|
|
58
|
-
|
|
60
|
+
if (showInfo) {
|
|
61
|
+
console.log(chalk_1.default.green(`${figures_1.default.tick} neex dev: TypeScript detected, ready to run`));
|
|
62
|
+
}
|
|
59
63
|
return `npx ts-node ${filePath}`;
|
|
60
64
|
case '.js':
|
|
61
65
|
case '.mjs':
|
|
62
66
|
case '.cjs':
|
|
63
|
-
|
|
67
|
+
if (showInfo) {
|
|
68
|
+
console.log(chalk_1.default.green(`${figures_1.default.tick} neex dev: JavaScript detected, ready to run`));
|
|
69
|
+
}
|
|
64
70
|
return `node ${filePath}`;
|
|
65
71
|
default:
|
|
66
|
-
|
|
72
|
+
if (showInfo) {
|
|
73
|
+
console.log(chalk_1.default.yellow(`${figures_1.default.warning} neex dev: Unknown file type, using Node.js`));
|
|
74
|
+
}
|
|
67
75
|
return `node ${filePath}`;
|
|
68
76
|
}
|
|
69
77
|
}
|
|
@@ -86,6 +94,7 @@ function addDevCommands(program) {
|
|
|
86
94
|
.option('-d, --delay <ms>', 'Delay before restart in milliseconds', parseInt)
|
|
87
95
|
.option('--clear', 'Clear console on restart')
|
|
88
96
|
.option('--verbose', 'Verbose output')
|
|
97
|
+
.option('--info', 'Show detailed information and logs')
|
|
89
98
|
.option('--signal <signal>', 'Signal to send to processes on restart', 'SIGTERM')
|
|
90
99
|
.action(async (file, options) => {
|
|
91
100
|
try {
|
|
@@ -100,8 +109,10 @@ function addDevCommands(program) {
|
|
|
100
109
|
}
|
|
101
110
|
// Get the best command to run the file
|
|
102
111
|
let commandToExecute;
|
|
112
|
+
let fileExtension;
|
|
103
113
|
try {
|
|
104
114
|
commandToExecute = await getBestCommand(file);
|
|
115
|
+
fileExtension = path.extname(file).toLowerCase();
|
|
105
116
|
}
|
|
106
117
|
catch (error) {
|
|
107
118
|
console.error(chalk_1.default.red(`${figures_1.default.cross} neex dev: ${error instanceof Error ? error.message : 'Unknown error occurred'}`));
|
|
@@ -125,18 +136,17 @@ function addDevCommands(program) {
|
|
|
125
136
|
const extensions = options.ext || ['js', 'mjs', 'json', 'ts', 'tsx', 'jsx', 'vue', 'svelte'];
|
|
126
137
|
// Log configuration
|
|
127
138
|
console.log(chalk_1.default.blue(`${figures_1.default.info} neex dev: Configuration:`));
|
|
128
|
-
console.log(chalk_1.default.blue(` ${figures_1.default.arrowRight}
|
|
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')}`));
|
|
129
141
|
console.log(chalk_1.default.blue(` ${figures_1.default.arrowRight} Watch paths: ${chalk_1.default.cyan(watchPaths.join(', '))}`));
|
|
130
142
|
console.log(chalk_1.default.blue(` ${figures_1.default.arrowRight} Extensions: ${chalk_1.default.cyan(extensions.join(', '))}`));
|
|
131
|
-
console.log(chalk_1.default.blue(` ${figures_1.default.arrowRight} Ignore patterns: ${chalk_1.default.cyan(ignorePatterns.length)} patterns`));
|
|
132
143
|
console.log(chalk_1.default.blue(` ${figures_1.default.arrowRight} Restart delay: ${chalk_1.default.cyan(options.delay || 1000)}ms`));
|
|
133
144
|
console.log(chalk_1.default.blue(` ${figures_1.default.arrowRight} Clear console: ${chalk_1.default.cyan(options.clear ? 'Yes' : 'No')}`));
|
|
134
|
-
console.log(chalk_1.default.blue(` ${figures_1.default.arrowRight} Signal: ${chalk_1.default.cyan(options.signal)}`));
|
|
135
145
|
if (options.verbose) {
|
|
136
146
|
console.log(chalk_1.default.blue(`${figures_1.default.info} neex dev: Verbose mode enabled - showing detailed logs`));
|
|
137
147
|
}
|
|
138
148
|
console.log(chalk_1.default.green(`${figures_1.default.tick} neex dev: Starting file watcher and process manager...`));
|
|
139
|
-
// Create DevRunner instance
|
|
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,
|