@fecommunity/reactpress-server 1.0.0-beta.13 → 1.0.0-beta.15
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/bin/reactpress-server.js +49 -8
- package/package.json +3 -3
package/bin/reactpress-server.js
CHANGED
|
@@ -58,9 +58,7 @@ async function runInstallationWizard() {
|
|
|
58
58
|
port: parseInt(port),
|
|
59
59
|
user: user.trim(),
|
|
60
60
|
password: password,
|
|
61
|
-
connectTimeout: 5000
|
|
62
|
-
acquireTimeout: 5000,
|
|
63
|
-
timeout: 5000
|
|
61
|
+
connectTimeout: 5000
|
|
64
62
|
});
|
|
65
63
|
|
|
66
64
|
try {
|
|
@@ -193,11 +191,54 @@ function startServer() {
|
|
|
193
191
|
|
|
194
192
|
// Start the NestJS server
|
|
195
193
|
const serverDir = path.dirname(__dirname); // server directory
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
194
|
+
|
|
195
|
+
// Check if we're in development or installed package
|
|
196
|
+
const isDevMode = fs.existsSync(path.join(serverDir, 'src'));
|
|
197
|
+
|
|
198
|
+
let server;
|
|
199
|
+
if (isDevMode) {
|
|
200
|
+
// Development mode - try different nest commands
|
|
201
|
+
const nestCommands = [
|
|
202
|
+
['npx', ['nest', 'start', '--watch']],
|
|
203
|
+
['npm', ['run', 'dev']],
|
|
204
|
+
['node', ['node_modules/.bin/nest', 'start', '--watch']]
|
|
205
|
+
];
|
|
206
|
+
|
|
207
|
+
let commandFound = false;
|
|
208
|
+
for (const [cmd, args] of nestCommands) {
|
|
209
|
+
try {
|
|
210
|
+
server = spawn(cmd, args, {
|
|
211
|
+
cwd: serverDir,
|
|
212
|
+
stdio: 'inherit',
|
|
213
|
+
env: { ...process.env, NODE_ENV: 'development' }
|
|
214
|
+
});
|
|
215
|
+
commandFound = true;
|
|
216
|
+
break;
|
|
217
|
+
} catch (error) {
|
|
218
|
+
console.log(chalk.yellow(`⚠️ ${cmd} not available, trying next option...`));
|
|
219
|
+
continue;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
if (!commandFound) {
|
|
224
|
+
console.log(chalk.red('❌ Could not start development server. Please install @nestjs/cli globally:'));
|
|
225
|
+
console.log(chalk.cyan('npm install -g @nestjs/cli'));
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
} else {
|
|
229
|
+
// Production mode - use built files
|
|
230
|
+
const mainPath = path.join(serverDir, 'dist', 'main.js');
|
|
231
|
+
if (fs.existsSync(mainPath)) {
|
|
232
|
+
server = spawn('node', [mainPath], {
|
|
233
|
+
cwd: serverDir,
|
|
234
|
+
stdio: 'inherit',
|
|
235
|
+
env: { ...process.env, NODE_ENV: 'production' }
|
|
236
|
+
});
|
|
237
|
+
} else {
|
|
238
|
+
console.log(chalk.red('❌ Server files not found. Please ensure the package is properly installed.'));
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
201
242
|
|
|
202
243
|
server.on('error', (error) => {
|
|
203
244
|
console.log(chalk.red('❌ Failed to start server:'), error.message);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fecommunity/reactpress-server",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.15",
|
|
4
4
|
"description": "ReactPress Server - NestJS-based backend API for ReactPress CMS",
|
|
5
5
|
"author": "fecommunity",
|
|
6
6
|
"license": "MIT",
|
|
@@ -98,10 +98,10 @@
|
|
|
98
98
|
"typeorm": "^0.2.22",
|
|
99
99
|
"ua-parser-js": "^0.7.28",
|
|
100
100
|
"open": "^8.2.1",
|
|
101
|
-
"express": "^4.18.2"
|
|
101
|
+
"express": "^4.18.2",
|
|
102
|
+
"@nestjs/cli": "^6.9.0"
|
|
102
103
|
},
|
|
103
104
|
"devDependencies": {
|
|
104
|
-
"@nestjs/cli": "^6.9.0",
|
|
105
105
|
"@nestjs/schematics": "^6.7.0",
|
|
106
106
|
"@nestjs/testing": "^6.7.1",
|
|
107
107
|
"@types/express": "4.17.18",
|