neex 0.2.6 → 0.2.7
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 +9 -2
- package/dist/src/cli.js +32 -25
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
<div align="center">
|
|
2
|
+
<a href="https://github.com/Neexjs">
|
|
3
|
+
<picture>
|
|
4
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://neex.storage.c2.liara.space/Neex.png">
|
|
5
|
+
<img alt="Neex logo" src="https://neex.storage.c2.liara.space/Neex.png" height="150" style="border-radius: 12px;">
|
|
6
|
+
</picture>
|
|
7
|
+
</a>
|
|
8
|
+
|
|
9
|
+
# Neex v0.2.7
|
|
3
10
|
### 🚀 Neex: The Modern Build System for Polyrepo-in-Monorepo Architecture
|
|
4
11
|
|
|
5
12
|
[](https://www.npmjs.com/package/neex)
|
package/dist/src/cli.js
CHANGED
|
@@ -28,6 +28,8 @@ function cli() {
|
|
|
28
28
|
.option('-p, --port <number>', 'Port to run the server on', '3000')
|
|
29
29
|
.option('-w, --watch <path>', 'Path to watch for changes', 'src')
|
|
30
30
|
.option('-c, --no-color', 'Disable colored output')
|
|
31
|
+
.option('-t, --transpile-only', 'Use transpileOnly mode for faster compilation', false)
|
|
32
|
+
.option('-i, --ignore <patterns>', 'Ignore patterns for file watching', 'node_modules,.git')
|
|
31
33
|
.action(async (entry, options) => {
|
|
32
34
|
try {
|
|
33
35
|
const entryPath = (0, path_1.resolve)(process.cwd(), entry);
|
|
@@ -35,38 +37,27 @@ function cli() {
|
|
|
35
37
|
throw new Error(`Entry file ${entry} not found`);
|
|
36
38
|
}
|
|
37
39
|
console.log(chalk_1.default.blue(`${figures_1.default.info} Starting development server...`));
|
|
38
|
-
|
|
40
|
+
const tsNodeDevArgs = [
|
|
41
|
+
'--respawn',
|
|
42
|
+
'--transpile-only',
|
|
43
|
+
'--ignore-watch', options.ignore,
|
|
44
|
+
'--watch', options.watch,
|
|
39
45
|
'-r', 'tsconfig-paths/register',
|
|
40
46
|
entryPath
|
|
41
|
-
]
|
|
47
|
+
];
|
|
48
|
+
if (options.transpileOnly) {
|
|
49
|
+
tsNodeDevArgs.push('--transpile-only');
|
|
50
|
+
}
|
|
51
|
+
const server = (0, child_process_1.spawn)('ts-node-dev', tsNodeDevArgs, {
|
|
42
52
|
stdio: 'inherit',
|
|
43
53
|
env: {
|
|
44
54
|
...process.env,
|
|
45
|
-
PORT: options.port
|
|
55
|
+
PORT: options.port,
|
|
56
|
+
NODE_ENV: 'development'
|
|
46
57
|
}
|
|
47
58
|
});
|
|
48
|
-
// Setup file watching
|
|
49
|
-
const watcher = (0, chokidar_1.watch)(options.watch, {
|
|
50
|
-
ignored: /(^|[\/\\])\../,
|
|
51
|
-
persistent: true
|
|
52
|
-
});
|
|
53
|
-
watcher.on('change', (path) => {
|
|
54
|
-
console.log(chalk_1.default.yellow(`${figures_1.default.info} File ${path} changed. Restarting...`));
|
|
55
|
-
server.kill();
|
|
56
|
-
server = (0, child_process_1.spawn)('ts-node', [
|
|
57
|
-
'-r', 'tsconfig-paths/register',
|
|
58
|
-
entryPath
|
|
59
|
-
], {
|
|
60
|
-
stdio: 'inherit',
|
|
61
|
-
env: {
|
|
62
|
-
...process.env,
|
|
63
|
-
PORT: options.port
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
});
|
|
67
59
|
cleanupRunner = () => {
|
|
68
60
|
server.kill();
|
|
69
|
-
watcher.close();
|
|
70
61
|
};
|
|
71
62
|
server.on('error', (err) => {
|
|
72
63
|
console.error(chalk_1.default.red(`${figures_1.default.cross} Server error: ${err.message}`));
|
|
@@ -121,6 +112,9 @@ function cli() {
|
|
|
121
112
|
.command('start <entry>')
|
|
122
113
|
.description('Start Express.js project in production mode')
|
|
123
114
|
.option('-p, --port <number>', 'Port to run the server on', '3000')
|
|
115
|
+
.option('-e, --env <env>', 'Environment to run in', 'production')
|
|
116
|
+
.option('-m, --max-memory <size>', 'Maximum memory size (e.g., 512M, 1G)', '512M')
|
|
117
|
+
.option('-c, --cluster <number>', 'Number of cluster workers', '1')
|
|
124
118
|
.action(async (entry, options) => {
|
|
125
119
|
try {
|
|
126
120
|
const entryPath = (0, path_1.resolve)(process.cwd(), entry);
|
|
@@ -128,12 +122,25 @@ function cli() {
|
|
|
128
122
|
throw new Error(`Entry file ${entry} not found`);
|
|
129
123
|
}
|
|
130
124
|
console.log(chalk_1.default.blue(`${figures_1.default.info} Starting production server...`));
|
|
131
|
-
|
|
125
|
+
// Check if the entry file is TypeScript
|
|
126
|
+
const isTypeScript = entryPath.endsWith('.ts');
|
|
127
|
+
const executable = isTypeScript ? 'ts-node' : 'node';
|
|
128
|
+
const args = isTypeScript
|
|
129
|
+
? ['-r', 'tsconfig-paths/register', entryPath]
|
|
130
|
+
: [entryPath];
|
|
131
|
+
// Add cluster support if specified
|
|
132
|
+
if (parseInt(options.cluster) > 1) {
|
|
133
|
+
args.unshift('--max-old-space-size=' + options.maxMemory);
|
|
134
|
+
args.unshift('--max-memory=' + options.maxMemory);
|
|
135
|
+
args.unshift('--cluster=' + options.cluster);
|
|
136
|
+
}
|
|
137
|
+
const server = (0, child_process_1.spawn)(executable, args, {
|
|
132
138
|
stdio: 'inherit',
|
|
133
139
|
env: {
|
|
134
140
|
...process.env,
|
|
135
141
|
PORT: options.port,
|
|
136
|
-
NODE_ENV:
|
|
142
|
+
NODE_ENV: options.env,
|
|
143
|
+
MAX_MEMORY: options.maxMemory
|
|
137
144
|
}
|
|
138
145
|
});
|
|
139
146
|
cleanupRunner = () => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "neex",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.7",
|
|
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",
|
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
"p-map": "^4.0.0",
|
|
39
39
|
"string-width": "^4.2.3",
|
|
40
40
|
"ts-node": "^10.9.1",
|
|
41
|
+
"ts-node-dev": "^2.0.0",
|
|
41
42
|
"tsconfig-paths": "^4.2.0"
|
|
42
43
|
},
|
|
43
44
|
"devDependencies": {
|