neex 0.4.4 → 0.4.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 +43 -73
- package/bun.lock +38 -356
- package/dist/bin/neex.js +4 -0
- package/dist/{cli.js → src/cli.js} +8 -18
- package/dist/{commands → src/commands}/run-commands/run.js +0 -1
- package/dist/src/index.js +70 -0
- package/dist/{logger.js → src/logger.js} +0 -1
- package/dist/src/project-manager.js +208 -0
- package/dist/{runner.js → src/runner.js} +0 -1
- package/dist/{types.js → src/types.js} +0 -1
- package/package.json +3 -17
- package/.env +0 -2
- package/Screenshot 1404-03-20 at 17.20.45.png +0 -0
- package/Screenshot 1404-03-20 at 17.20.56.png +0 -0
- package/Screenshot 1404-03-20 at 17.21.04.png +0 -0
- package/dist/cli.d.ts +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/commands/process-command/process.d.ts +0 -2
- package/dist/commands/process-command/process.js +0 -150
- package/dist/commands/process-command/process.js.map +0 -1
- package/dist/commands/project-command/build.d.ts +0 -3
- package/dist/commands/project-command/build.js +0 -42
- package/dist/commands/project-command/build.js.map +0 -1
- package/dist/commands/project-command/cache.d.ts +0 -3
- package/dist/commands/project-command/cache.js +0 -57
- package/dist/commands/project-command/cache.js.map +0 -1
- package/dist/commands/project-command/dev.d.ts +0 -3
- package/dist/commands/project-command/dev.js +0 -52
- package/dist/commands/project-command/dev.js.map +0 -1
- package/dist/commands/project-command/start.d.ts +0 -3
- package/dist/commands/project-command/start.js +0 -46
- package/dist/commands/project-command/start.js.map +0 -1
- package/dist/commands/run-commands/run.d.ts +0 -2
- package/dist/commands/run-commands/run.js.map +0 -1
- package/dist/index.d.ts +0 -30
- package/dist/index.js +0 -66
- package/dist/index.js.map +0 -1
- package/dist/logger.d.ts +0 -31
- package/dist/logger.js.map +0 -1
- package/dist/process-manager.d.ts +0 -60
- package/dist/process-manager.js +0 -277
- package/dist/process-manager.js.map +0 -1
- package/dist/project-manager.d.ts +0 -64
- package/dist/project-manager.js +0 -467
- package/dist/project-manager.js.map +0 -1
- package/dist/runner.d.ts +0 -17
- package/dist/runner.js.map +0 -1
- package/dist/server.d.ts +0 -2
- package/dist/server.js +0 -67
- package/dist/server.js.map +0 -1
- package/dist/types.d.ts +0 -37
- package/dist/types.js.map +0 -1
- package/dist/typescript-runner.d.ts +0 -12
- package/dist/typescript-runner.js +0 -162
- package/dist/typescript-runner.js.map +0 -1
package/dist/bin/neex.js
ADDED
|
@@ -5,29 +5,19 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
// src/cli.ts - Updated version
|
|
7
7
|
const commander_1 = require("commander");
|
|
8
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
9
|
+
const figures_1 = __importDefault(require("figures"));
|
|
8
10
|
const project_manager_js_1 = require("./project-manager.js");
|
|
9
|
-
const dev_js_1 = require("./commands/project-command/dev.js");
|
|
10
|
-
const build_js_1 = require("./commands/project-command/build.js");
|
|
11
|
-
const start_js_1 = require("./commands/project-command/start.js");
|
|
12
|
-
const cache_js_1 = require("./commands/project-command/cache.js");
|
|
13
|
-
const process_js_1 = require("./commands/process-command/process.js");
|
|
14
|
-
const run_js_1 = require("./commands/run-commands/run.js");
|
|
15
|
-
const logger_js_1 = __importDefault(require("./logger.js"));
|
|
16
11
|
const { version } = require('../../package.json');
|
|
17
12
|
function cli() {
|
|
18
13
|
const program = new commander_1.Command();
|
|
19
|
-
|
|
14
|
+
let cleanupRunner = null;
|
|
20
15
|
program
|
|
21
16
|
.name('neex')
|
|
22
17
|
.description('Professional TypeScript development tool with ultra-fast compilation')
|
|
23
18
|
.version(version);
|
|
24
19
|
// Register all commands
|
|
25
|
-
|
|
26
|
-
(0, build_js_1.registerBuildCommand)(program, projectManager);
|
|
27
|
-
(0, start_js_1.registerStartCommand)(program, projectManager);
|
|
28
|
-
(0, cache_js_1.registerCacheCommand)(program, projectManager);
|
|
29
|
-
(0, process_js_1.registerProcessCommands)(program);
|
|
30
|
-
(0, run_js_1.registerRunCommands)(program);
|
|
20
|
+
new project_manager_js_1.ProjectManager(program);
|
|
31
21
|
program.parse(process.argv);
|
|
32
22
|
// Show help if no commands specified
|
|
33
23
|
if (program.args.length === 0) {
|
|
@@ -35,10 +25,11 @@ function cli() {
|
|
|
35
25
|
}
|
|
36
26
|
// Graceful shutdown handling
|
|
37
27
|
const handleSignal = (signal) => {
|
|
38
|
-
|
|
39
|
-
if (
|
|
40
|
-
|
|
28
|
+
console.log(`\n${chalk_1.default.yellow(`${figures_1.default.warning} Received ${signal}. Cleaning up...`)}`);
|
|
29
|
+
if (cleanupRunner) {
|
|
30
|
+
cleanupRunner();
|
|
41
31
|
}
|
|
32
|
+
// Give cleanup a moment, then exit
|
|
42
33
|
setTimeout(() => process.exit(0), 500);
|
|
43
34
|
};
|
|
44
35
|
process.on('SIGINT', () => handleSignal('SIGINT')); // Ctrl+C
|
|
@@ -46,4 +37,3 @@ function cli() {
|
|
|
46
37
|
process.on('SIGQUIT', () => handleSignal('SIGQUIT'));
|
|
47
38
|
}
|
|
48
39
|
exports.default = cli;
|
|
49
|
-
//# sourceMappingURL=cli.js.map
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.runServers = exports.runSequential = exports.runParallel = exports.run = void 0;
|
|
7
|
+
// src/index.ts - Updated version
|
|
8
|
+
const runner_1 = require("./runner");
|
|
9
|
+
const logger_1 = __importDefault(require("./logger"));
|
|
10
|
+
/**
|
|
11
|
+
* Run one or more commands in parallel or sequentially
|
|
12
|
+
*/
|
|
13
|
+
async function run(commands, options) {
|
|
14
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
15
|
+
const cmdArray = Array.isArray(commands) ? commands : [commands];
|
|
16
|
+
const runOptions = {
|
|
17
|
+
parallel: (_a = options === null || options === void 0 ? void 0 : options.parallel) !== null && _a !== void 0 ? _a : false,
|
|
18
|
+
maxParallel: options === null || options === void 0 ? void 0 : options.maxParallel,
|
|
19
|
+
printOutput: (_b = options === null || options === void 0 ? void 0 : options.printOutput) !== null && _b !== void 0 ? _b : true,
|
|
20
|
+
color: (_c = options === null || options === void 0 ? void 0 : options.color) !== null && _c !== void 0 ? _c : true,
|
|
21
|
+
showTiming: (_d = options === null || options === void 0 ? void 0 : options.showTiming) !== null && _d !== void 0 ? _d : true,
|
|
22
|
+
prefix: (_e = options === null || options === void 0 ? void 0 : options.prefix) !== null && _e !== void 0 ? _e : true,
|
|
23
|
+
stopOnError: (_f = options === null || options === void 0 ? void 0 : options.stopOnError) !== null && _f !== void 0 ? _f : false,
|
|
24
|
+
minimalOutput: (_g = options === null || options === void 0 ? void 0 : options.minimalOutput) !== null && _g !== void 0 ? _g : false,
|
|
25
|
+
groupOutput: (_h = options === null || options === void 0 ? void 0 : options.groupOutput) !== null && _h !== void 0 ? _h : false,
|
|
26
|
+
isServerMode: (_j = options === null || options === void 0 ? void 0 : options.isServerMode) !== null && _j !== void 0 ? _j : false
|
|
27
|
+
};
|
|
28
|
+
const runner = new runner_1.Runner(runOptions);
|
|
29
|
+
if (options === null || options === void 0 ? void 0 : options.registerCleanup) {
|
|
30
|
+
options.registerCleanup(() => runner.cleanup());
|
|
31
|
+
}
|
|
32
|
+
const results = await runner.run(cmdArray);
|
|
33
|
+
if (runOptions.printOutput && cmdArray.length > 1) {
|
|
34
|
+
logger_1.default.printSummary(results);
|
|
35
|
+
}
|
|
36
|
+
return results;
|
|
37
|
+
}
|
|
38
|
+
exports.run = run;
|
|
39
|
+
/**
|
|
40
|
+
* Run multiple commands in parallel
|
|
41
|
+
*/
|
|
42
|
+
async function runParallel(commands, options) {
|
|
43
|
+
return run(commands, { ...options, parallel: true });
|
|
44
|
+
}
|
|
45
|
+
exports.runParallel = runParallel;
|
|
46
|
+
/**
|
|
47
|
+
* Run multiple commands sequentially
|
|
48
|
+
*/
|
|
49
|
+
async function runSequential(commands, options) {
|
|
50
|
+
return run(commands, { ...options, parallel: false });
|
|
51
|
+
}
|
|
52
|
+
exports.runSequential = runSequential;
|
|
53
|
+
/**
|
|
54
|
+
* Run multiple servers with optimized output
|
|
55
|
+
*/
|
|
56
|
+
async function runServers(commands, options) {
|
|
57
|
+
return run(commands, {
|
|
58
|
+
...options,
|
|
59
|
+
parallel: true,
|
|
60
|
+
isServerMode: true,
|
|
61
|
+
printOutput: true
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
exports.runServers = runServers;
|
|
65
|
+
exports.default = {
|
|
66
|
+
run,
|
|
67
|
+
runParallel,
|
|
68
|
+
runSequential,
|
|
69
|
+
runServers
|
|
70
|
+
};
|
|
@@ -0,0 +1,208 @@
|
|
|
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
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.ProjectManager = void 0;
|
|
30
|
+
const dotenv_1 = __importDefault(require("dotenv"));
|
|
31
|
+
const logger_js_1 = __importDefault(require("./logger.js"));
|
|
32
|
+
const index_js_1 = require("./index.js");
|
|
33
|
+
const path = __importStar(require("path"));
|
|
34
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
35
|
+
dotenv_1.default.config();
|
|
36
|
+
class ProjectManager {
|
|
37
|
+
constructor(program) {
|
|
38
|
+
this.cacheDir = path.join(process.cwd(), '.neex_cache');
|
|
39
|
+
this.program = program;
|
|
40
|
+
this.registerCommands();
|
|
41
|
+
}
|
|
42
|
+
registerCommands() {
|
|
43
|
+
this.registerDevCommand();
|
|
44
|
+
this.registerBuildCommand();
|
|
45
|
+
this.registerStartCommand();
|
|
46
|
+
this.registerCacheCommands();
|
|
47
|
+
}
|
|
48
|
+
registerDevCommand() {
|
|
49
|
+
this.program
|
|
50
|
+
.command('dev <entry-file>')
|
|
51
|
+
.description('Run the development server')
|
|
52
|
+
.option('-p, --port <port>', 'Set the port for the development server', '8000')
|
|
53
|
+
.option('-w, --watch', 'Watch files for changes (Neex will restart on changes)')
|
|
54
|
+
.option('-i, --ignore <files...>', 'Files to ignore for watching')
|
|
55
|
+
.option('-e, --ext <extensions...>', 'File extensions to watch')
|
|
56
|
+
.option('-d, --delay <milliseconds>', 'Delay before restart (ms)', '0')
|
|
57
|
+
.option('-c, --clear', 'Clear console before restart')
|
|
58
|
+
.option('--cache', 'Enable caching (Neex will use cache)')
|
|
59
|
+
.option('--compiler <compiler>', 'Select compiler (esbuild, swc, tsc)', 'esbuild')
|
|
60
|
+
.option('--inspect', 'Enable Node.js inspector')
|
|
61
|
+
.option('--inspect-brk', 'Enable Node.js inspector with breakpoint')
|
|
62
|
+
.action(async (entryFile, options) => {
|
|
63
|
+
const port = this.getPort(options.port);
|
|
64
|
+
logger_js_1.default.printLine(`Running development server with entry file: ${entryFile} on port: ${port}`, 'info');
|
|
65
|
+
let commandToRun;
|
|
66
|
+
let nodeFlags = '';
|
|
67
|
+
if (options.inspect)
|
|
68
|
+
nodeFlags += ' --inspect';
|
|
69
|
+
if (options.inspectBrk)
|
|
70
|
+
nodeFlags += ' --inspect-brk';
|
|
71
|
+
switch (options.compiler) {
|
|
72
|
+
case 'esbuild':
|
|
73
|
+
commandToRun = `node ${nodeFlags} ${entryFile} --port ${port}`;
|
|
74
|
+
logger_js_1.default.printLine(chalk_1.default.yellow('Note: Esbuild dev server integration requires more advanced logic.'), 'warn');
|
|
75
|
+
break;
|
|
76
|
+
case 'swc':
|
|
77
|
+
commandToRun = `node ${nodeFlags} -r @swc/register ${entryFile} --port ${port}`;
|
|
78
|
+
break;
|
|
79
|
+
case 'tsc':
|
|
80
|
+
commandToRun = `node ${nodeFlags} -r ts-node/register ${entryFile} --port ${port}`;
|
|
81
|
+
break;
|
|
82
|
+
default:
|
|
83
|
+
commandToRun = `node ${nodeFlags} ${entryFile} --port ${port}`;
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
86
|
+
if (options.watch) {
|
|
87
|
+
logger_js_1.default.printLine(chalk_1.default.yellow(`Warning: Watch mode for '${options.compiler}' is not fully implemented yet. Neex currently just runs the command.`), 'warn');
|
|
88
|
+
}
|
|
89
|
+
if (options.ignore || options.ext || options.delay || options.clear) {
|
|
90
|
+
logger_js_1.default.printLine(chalk_1.default.yellow(`Warning: Options like --ignore, --ext, --delay, --clear are not fully implemented for dev command.`), 'warn');
|
|
91
|
+
}
|
|
92
|
+
if (options.cache) {
|
|
93
|
+
logger_js_1.default.printLine(chalk_1.default.yellow(`Warning: Caching for dev command is not fully implemented yet.`), 'warn');
|
|
94
|
+
}
|
|
95
|
+
const neexRunOptions = {
|
|
96
|
+
isServerMode: true,
|
|
97
|
+
printOutput: true,
|
|
98
|
+
};
|
|
99
|
+
await (0, index_js_1.runServers)(commandToRun, neexRunOptions);
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
registerBuildCommand() {
|
|
103
|
+
this.program
|
|
104
|
+
.command('build')
|
|
105
|
+
.description('Build the project')
|
|
106
|
+
.option('-o, --out-dir <dir>', 'Output directory', 'dist')
|
|
107
|
+
.option('-m, --minify', 'Minify code')
|
|
108
|
+
.option('-s, --sourcemap', 'Generate sourcemaps')
|
|
109
|
+
.option('-w, --watch', 'Build in watch mode')
|
|
110
|
+
.option('-c, --compiler <compiler>', 'Select compiler (esbuild, swc, tsc)', 'esbuild')
|
|
111
|
+
.option('-t, --target <target>', 'JavaScript target version (e.g., ES2022)', 'ES2022')
|
|
112
|
+
.action(async (options) => {
|
|
113
|
+
logger_js_1.default.printLine(`Building project to output directory: ${options.outDir}`, 'info');
|
|
114
|
+
let buildCommand;
|
|
115
|
+
let buildArgs = [];
|
|
116
|
+
switch (options.compiler) {
|
|
117
|
+
case 'esbuild':
|
|
118
|
+
buildCommand = 'esbuild';
|
|
119
|
+
buildArgs.push('.');
|
|
120
|
+
buildArgs.push(`--outdir=${options.outDir}`);
|
|
121
|
+
if (options.minify)
|
|
122
|
+
buildArgs.push('--minify');
|
|
123
|
+
if (options.sourcemap)
|
|
124
|
+
buildArgs.push('--sourcemap');
|
|
125
|
+
if (options.target)
|
|
126
|
+
buildArgs.push(`--target=${options.target}`);
|
|
127
|
+
if (options.watch)
|
|
128
|
+
buildArgs.push('--watch');
|
|
129
|
+
break;
|
|
130
|
+
case 'swc':
|
|
131
|
+
buildCommand = 'swc';
|
|
132
|
+
buildArgs.push('src');
|
|
133
|
+
buildArgs.push(`-d ${options.outDir}`);
|
|
134
|
+
if (options.minify)
|
|
135
|
+
buildArgs.push('--minify');
|
|
136
|
+
if (options.sourcemap)
|
|
137
|
+
buildArgs.push('--source-maps');
|
|
138
|
+
if (options.watch)
|
|
139
|
+
buildArgs.push('--watch');
|
|
140
|
+
logger_js_1.default.printLine(chalk_1.default.yellow('Note: SWC build command options might need more specific mapping.'), 'warn');
|
|
141
|
+
break;
|
|
142
|
+
case 'tsc':
|
|
143
|
+
buildCommand = 'tsc';
|
|
144
|
+
buildArgs.push(`--outDir ${options.outDir}`);
|
|
145
|
+
if (options.sourcemap)
|
|
146
|
+
buildArgs.push('--sourceMap');
|
|
147
|
+
if (options.watch)
|
|
148
|
+
buildArgs.push('--watch');
|
|
149
|
+
if (options.target)
|
|
150
|
+
buildArgs.push(`--target ${options.target}`);
|
|
151
|
+
break;
|
|
152
|
+
default:
|
|
153
|
+
logger_js_1.default.printLine(chalk_1.default.red(`Error: Unknown compiler '${options.compiler}'.`), 'error');
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
const fullCommand = `${buildCommand} ${buildArgs.join(' ')}`;
|
|
157
|
+
// TODO: Implement build logic
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
registerStartCommand() {
|
|
161
|
+
this.program
|
|
162
|
+
.command('start')
|
|
163
|
+
.description('Start the application')
|
|
164
|
+
.option('-p, --port <port>', 'Set the port for the application', '8000')
|
|
165
|
+
.option('-o, --out-dir <dir>', 'Output directory', 'dist')
|
|
166
|
+
.option('-e, --entry <file>', 'Entry file for the application')
|
|
167
|
+
.option('--inspect', 'Enable Node.js inspector')
|
|
168
|
+
.option('--cluster', 'Run in cluster mode')
|
|
169
|
+
.option('--workers <number>', 'Number of workers', '1')
|
|
170
|
+
.option('--max-memory <memory>', 'Maximum memory (e.g., 512M)', '512M')
|
|
171
|
+
.option('--health-check', 'Enable health check')
|
|
172
|
+
.action((options) => {
|
|
173
|
+
const port = this.getPort(options.port);
|
|
174
|
+
logger_js_1.default.printLine(`Starting application from entry file: ${options.entry} on port: ${port}`, 'info');
|
|
175
|
+
// TODO: Implement start logic
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
registerCacheCommands() {
|
|
179
|
+
const cacheCommand = this.program.command('cache').description('Manage cache');
|
|
180
|
+
cacheCommand
|
|
181
|
+
.command('clear')
|
|
182
|
+
.description('Clear cache')
|
|
183
|
+
.action(() => {
|
|
184
|
+
logger_js_1.default.printLine('Cache cleared.', 'info');
|
|
185
|
+
// TODO: Implement cache clear logic
|
|
186
|
+
});
|
|
187
|
+
cacheCommand
|
|
188
|
+
.command('stats')
|
|
189
|
+
.description('Display cache status')
|
|
190
|
+
.action(() => {
|
|
191
|
+
logger_js_1.default.printLine('Displaying cache status.', 'info');
|
|
192
|
+
// TODO: Implement cache stats logic
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
getPort(portOption) {
|
|
196
|
+
const envPort = process.env.PORT;
|
|
197
|
+
if (portOption) {
|
|
198
|
+
return parseInt(portOption, 10);
|
|
199
|
+
}
|
|
200
|
+
else if (envPort) {
|
|
201
|
+
return parseInt(envPort, 10);
|
|
202
|
+
}
|
|
203
|
+
else {
|
|
204
|
+
return 8000;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
exports.ProjectManager = ProjectManager;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "neex",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.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",
|
|
@@ -12,8 +12,6 @@
|
|
|
12
12
|
"start": "node dist/bin/neex.js",
|
|
13
13
|
"prepublishOnly": "npm run build",
|
|
14
14
|
"test": "jest",
|
|
15
|
-
"dev": "neex dev src/server.ts",
|
|
16
|
-
"nodemon": "nodemon --exec ts-node src/server.ts",
|
|
17
15
|
"test:dev": "node ./dist/bin/neex.js runx \"echo Starting frontend\" \"echo Starting backend\"",
|
|
18
16
|
"test:parallel": "node ./dist/src/cli.js parallel \"echo Building frontend\" \"echo Building backend\"",
|
|
19
17
|
"test:sequence": "node ./dist/src/cli.js run \"echo Step 1\" \"echo Step 2\" \"echo Step 3\""
|
|
@@ -30,30 +28,18 @@
|
|
|
30
28
|
"author": "foshati",
|
|
31
29
|
"license": "MIT",
|
|
32
30
|
"dependencies": {
|
|
33
|
-
"@types/
|
|
31
|
+
"@types/dotenv": "^8.2.3",
|
|
34
32
|
"chalk": "^4.1.2",
|
|
35
|
-
"chokidar": "^4.0.3",
|
|
36
|
-
"cli-table3": "^0.6.5",
|
|
37
33
|
"commander": "^9.4.0",
|
|
38
34
|
"dotenv": "^16.5.0",
|
|
39
|
-
"esbuild": "^0.25.5",
|
|
40
|
-
"express": "^5.1.0",
|
|
41
35
|
"figlet": "^1.8.1",
|
|
42
36
|
"figures": "^3.2.0",
|
|
43
37
|
"gradient-string": "^3.0.0",
|
|
44
|
-
"neex": "^0.4.0",
|
|
45
|
-
"node-notifier": "^10.0.1",
|
|
46
|
-
"nodemon": "^3.1.10",
|
|
47
38
|
"npm-run-path": "^4.0.1",
|
|
48
39
|
"p-map": "^4.0.0",
|
|
49
|
-
"string-width": "^4.2.3"
|
|
50
|
-
"ts-node": "^10.9.1",
|
|
51
|
-
"ts-node-dev": "^2.0.0",
|
|
52
|
-
"tsconfig-paths": "^4.2.0"
|
|
40
|
+
"string-width": "^4.2.3"
|
|
53
41
|
},
|
|
54
42
|
"devDependencies": {
|
|
55
|
-
"@types/chokidar": "^2.1.7",
|
|
56
|
-
"@types/cors": "^2.8.19",
|
|
57
43
|
"@types/figlet": "^1.7.0",
|
|
58
44
|
"@types/jest": "^29.2.3",
|
|
59
45
|
"@types/node": "^18.11.9",
|
package/.env
DELETED
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/cli.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function cli(): void;
|
package/dist/cli.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;;;AAAA,+BAA+B;AAC/B,yCAAoC;AAIpC,6DAAsD;AACtD,8DAAuE;AACvE,kEAA2E;AAC3E,kEAA2E;AAC3E,kEAA2E;AAC3E,sEAAgF;AAChF,2DAAqE;AACrE,4DAAiC;AACjC,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;AAIlD,SAAwB,GAAG;IACvB,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;IAC9B,MAAM,cAAc,GAAG,IAAI,mCAAc,EAAE,CAAC;IAE5C,OAAO;SACF,IAAI,CAAC,MAAM,CAAC;SACZ,WAAW,CAAC,sEAAsE,CAAC;SACnF,OAAO,CAAC,OAAO,CAAC,CAAC;IAEtB,wBAAwB;IACxB,IAAA,2BAAkB,EAAC,OAAO,EAAE,cAAc,CAAC,CAAC;IAC5C,IAAA,+BAAoB,EAAC,OAAO,EAAE,cAAc,CAAC,CAAC;IAC9C,IAAA,+BAAoB,EAAC,OAAO,EAAE,cAAc,CAAC,CAAC;IAC9C,IAAA,+BAAoB,EAAC,OAAO,EAAE,cAAc,CAAC,CAAC;IAC9C,IAAA,oCAAuB,EAAC,OAAO,CAAC,CAAC;IACjC,IAAA,4BAAmB,EAAC,OAAO,CAAC,CAAC;IAE7B,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAE5B,qCAAqC;IACrC,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE;QAC3B,OAAO,CAAC,IAAI,EAAE,CAAC;KAClB;IAED,6BAA6B;IAC7B,MAAM,YAAY,GAAG,CAAC,MAAsB,EAAE,EAAE;QAC5C,mBAAM,CAAC,SAAS,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAAC;QAC7C,IAAI,cAAc,EAAE;YAChB,cAAc,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;SAClC;QACD,UAAU,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAC3C,CAAC,CAAC;IAEF,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS;IAC7D,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,CAAC;IACrD,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,CAAC;AACzD,CAAC;AApCD,sBAoCC"}
|
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.registerProcessCommands = void 0;
|
|
7
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
-
const figures_1 = __importDefault(require("figures"));
|
|
9
|
-
const chokidar_1 = require("chokidar");
|
|
10
|
-
const process_manager_js_1 = require("../../process-manager.js");
|
|
11
|
-
function registerProcessCommands(program) {
|
|
12
|
-
// Start process command
|
|
13
|
-
program
|
|
14
|
-
.command('startx <command>')
|
|
15
|
-
.description('Start a process with monitoring and auto-restart')
|
|
16
|
-
.option('-n, --name <name>', 'Process name')
|
|
17
|
-
.option('-w, --watch', 'Watch for file changes and auto-restart')
|
|
18
|
-
.option('-r, --max-restarts <number>', 'Maximum number of restart attempts', '5')
|
|
19
|
-
.option('-d, --restart-delay <number>', 'Delay between restarts in milliseconds', '1000')
|
|
20
|
-
.option('-c, --cwd <path>', 'Working directory for the process')
|
|
21
|
-
.action(async (command, options) => {
|
|
22
|
-
try {
|
|
23
|
-
const process = await process_manager_js_1.processManager.startProcess(command, {
|
|
24
|
-
name: options.name,
|
|
25
|
-
watch: options.watch,
|
|
26
|
-
maxRestarts: parseInt(options.maxRestarts),
|
|
27
|
-
restartDelay: parseInt(options.restartDelay),
|
|
28
|
-
cwd: options.cwd
|
|
29
|
-
});
|
|
30
|
-
console.log(chalk_1.default.green(`${figures_1.default.tick} Process started successfully`));
|
|
31
|
-
console.log(chalk_1.default.blue(`Name: ${process.name}`));
|
|
32
|
-
console.log(chalk_1.default.blue(`PID: ${process.pid}`));
|
|
33
|
-
console.log(chalk_1.default.blue(`Command: ${process.command}`));
|
|
34
|
-
console.log(chalk_1.default.blue(`Max Restarts: ${process.maxRestarts}`));
|
|
35
|
-
console.log(chalk_1.default.blue(`Restart Delay: ${process.restartDelay}ms`));
|
|
36
|
-
}
|
|
37
|
-
catch (error) {
|
|
38
|
-
if (error instanceof Error) {
|
|
39
|
-
console.error(chalk_1.default.red(`${figures_1.default.cross} Error: ${error.message}`));
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
console.error(chalk_1.default.red(`${figures_1.default.cross} An unknown error occurred`));
|
|
43
|
-
}
|
|
44
|
-
process.exit(1);
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
// Stop process command
|
|
48
|
-
program
|
|
49
|
-
.command('stopx <name>')
|
|
50
|
-
.description('Stop a running process')
|
|
51
|
-
.option('-f, --force', 'Force stop the process')
|
|
52
|
-
.action(async (name, options) => {
|
|
53
|
-
try {
|
|
54
|
-
await process_manager_js_1.processManager.stop(name);
|
|
55
|
-
console.log(chalk_1.default.green(`${figures_1.default.tick} Process stopped successfully`));
|
|
56
|
-
}
|
|
57
|
-
catch (error) {
|
|
58
|
-
if (error instanceof Error) {
|
|
59
|
-
console.error(chalk_1.default.red(`${figures_1.default.cross} Error: ${error.message}`));
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
62
|
-
console.error(chalk_1.default.red(`${figures_1.default.cross} An unknown error occurred`));
|
|
63
|
-
}
|
|
64
|
-
process.exit(1);
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
// List processes command
|
|
68
|
-
program
|
|
69
|
-
.command('list')
|
|
70
|
-
.description('List all running processes')
|
|
71
|
-
.option('-a, --all', 'Show all processes including stopped ones')
|
|
72
|
-
.option('-j, --json', 'Output in JSON format')
|
|
73
|
-
.action((options) => {
|
|
74
|
-
try {
|
|
75
|
-
process_manager_js_1.processManager.list();
|
|
76
|
-
}
|
|
77
|
-
catch (error) {
|
|
78
|
-
if (error instanceof Error) {
|
|
79
|
-
console.error(chalk_1.default.red(`${figures_1.default.cross} Error: ${error.message}`));
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
console.error(chalk_1.default.red(`${figures_1.default.cross} An unknown error occurred`));
|
|
83
|
-
}
|
|
84
|
-
process.exit(1);
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
// Monitor process command
|
|
88
|
-
program
|
|
89
|
-
.command('monit <name>')
|
|
90
|
-
.description('Monitor a process in real-time')
|
|
91
|
-
.option('-i, --interval <number>', 'Update interval in milliseconds', '1000')
|
|
92
|
-
.action((name, options) => {
|
|
93
|
-
try {
|
|
94
|
-
const interval = parseInt(options.interval);
|
|
95
|
-
if (isNaN(interval) || interval < 100) {
|
|
96
|
-
throw new Error('Interval must be a number greater than 100ms');
|
|
97
|
-
}
|
|
98
|
-
process_manager_js_1.processManager.monit(name);
|
|
99
|
-
}
|
|
100
|
-
catch (error) {
|
|
101
|
-
if (error instanceof Error) {
|
|
102
|
-
console.error(chalk_1.default.red(`${figures_1.default.cross} Error: ${error.message}`));
|
|
103
|
-
}
|
|
104
|
-
else {
|
|
105
|
-
console.error(chalk_1.default.red(`${figures_1.default.cross} An unknown error occurred`));
|
|
106
|
-
}
|
|
107
|
-
process.exit(1);
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
|
-
// View logs command
|
|
111
|
-
program
|
|
112
|
-
.command('log <name>')
|
|
113
|
-
.description('View process logs')
|
|
114
|
-
.option('-f, --follow', 'Follow log output')
|
|
115
|
-
.option('-e, --errors', 'Show only errors')
|
|
116
|
-
.option('-w, --warnings', 'Show only warnings')
|
|
117
|
-
.option('-l, --lines <number>', 'Number of lines to show', '100')
|
|
118
|
-
.action((name, options) => {
|
|
119
|
-
try {
|
|
120
|
-
const lines = parseInt(options.lines);
|
|
121
|
-
if (isNaN(lines) || lines < 1) {
|
|
122
|
-
throw new Error('Lines must be a positive number');
|
|
123
|
-
}
|
|
124
|
-
process_manager_js_1.processManager.log(name, lines);
|
|
125
|
-
if (options.follow) {
|
|
126
|
-
const watcher = (0, chokidar_1.watch)(process_manager_js_1.processManager.getLogPath(name), {
|
|
127
|
-
persistent: true
|
|
128
|
-
});
|
|
129
|
-
watcher.on('change', () => {
|
|
130
|
-
process_manager_js_1.processManager.log(name, 1);
|
|
131
|
-
});
|
|
132
|
-
process.on('SIGINT', () => {
|
|
133
|
-
watcher.close();
|
|
134
|
-
process.exit(0);
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
catch (error) {
|
|
139
|
-
if (error instanceof Error) {
|
|
140
|
-
console.error(chalk_1.default.red(`${figures_1.default.cross} Error: ${error.message}`));
|
|
141
|
-
}
|
|
142
|
-
else {
|
|
143
|
-
console.error(chalk_1.default.red(`${figures_1.default.cross} An unknown error occurred`));
|
|
144
|
-
}
|
|
145
|
-
process.exit(1);
|
|
146
|
-
}
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
exports.registerProcessCommands = registerProcessCommands;
|
|
150
|
-
//# sourceMappingURL=process.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"process.js","sourceRoot":"","sources":["../../../src/commands/process-command/process.ts"],"names":[],"mappings":";;;;;;AACA,k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E,CAAC,QAAQ,EAAE,GAAG,EAAE;oBACtB,mCAAc,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;gBAChC,CAAC,CAAC,CAAC;gBAEH,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE;oBACtB,OAAO,CAAC,KAAK,EAAE,CAAC;oBAChB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;gBACpB,CAAC,CAAC,CAAC;aACN;SACJ;QAAC,OAAO,KAAc,EAAE;YACrB,IAAI,KAAK,YAAY,KAAK,EAAE;gBACxB,OAAO,CAAC,KAAK,CAAC,eAAK,CAAC,GAAG,CAAC,GAAG,iBAAO,CAAC,KAAK,WAAW,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;aACxE;iBAAM;gBACH,OAAO,CAAC,KAAK,CAAC,eAAK,CAAC,GAAG,CAAC,GAAG,iBAAO,CAAC,KAAK,4BAA4B,CAAC,CAAC,CAAC;aAC1E;YACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;SACnB;IACL,CAAC,CAAC,CAAC;AACX,CAAC;AAxID,0DAwIC"}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.registerBuildCommand = void 0;
|
|
7
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
-
const figures_1 = __importDefault(require("figures"));
|
|
9
|
-
function registerBuildCommand(program, projectManager) {
|
|
10
|
-
program
|
|
11
|
-
.command('build')
|
|
12
|
-
.description('Build TypeScript project with optimized output')
|
|
13
|
-
.option('-o, --outDir <dir>', 'Output directory', 'dist')
|
|
14
|
-
.option('-m, --minify', 'Minify output')
|
|
15
|
-
.option('-s, --sourcemap', 'Generate source maps')
|
|
16
|
-
.option('-w, --watch', 'Watch mode')
|
|
17
|
-
.option('-c, --compiler <type>', 'Compiler to use: swc, esbuild, tsc', 'auto')
|
|
18
|
-
.option('--target <target>', 'Target ES version', 'ES2022')
|
|
19
|
-
.action(async (options) => {
|
|
20
|
-
try {
|
|
21
|
-
await projectManager.build({
|
|
22
|
-
outDir: options.outDir,
|
|
23
|
-
minify: options.minify,
|
|
24
|
-
sourcemap: options.sourcemap,
|
|
25
|
-
watch: options.watch,
|
|
26
|
-
compiler: options.compiler,
|
|
27
|
-
target: options.target
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
catch (error) {
|
|
31
|
-
if (error instanceof Error) {
|
|
32
|
-
console.error(chalk_1.default.red(`${figures_1.default.cross} Error: ${error.message}`));
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
console.error(chalk_1.default.red(`${figures_1.default.cross} An unknown error occurred`));
|
|
36
|
-
}
|
|
37
|
-
process.exit(1);
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
exports.registerBuildCommand = registerBuildCommand;
|
|
42
|
-
//# sourceMappingURL=build.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"build.js","sourceRoot":"","sources":["../../../src/commands/project-command/build.ts"],"names":[],"mappings":";;;;;;AACA,kDAA0B;AAC1B,sDAA8B;AAG9B,SAAgB,oBAAoB,CAAC,OAAgB,EAAE,cAA8B;IACjF,OAAO;SACF,OAAO,CAAC,OAAO,CAAC;SAChB,WAAW,CAAC,gDAAgD,CAAC;SAC7D,MAAM,CAAC,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,CAAC;SACxD,MAAM,CAAC,cAAc,EAAE,eAAe,CAAC;SACvC,MAAM,CAAC,iBAAiB,EAAE,sBAAsB,CAAC;SACjD,MAAM,CAAC,aAAa,EAAE,YAAY,CAAC;SACnC,MAAM,CAAC,uBAAuB,EAAE,oCAAoC,EAAE,MAAM,CAAC;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