nodestatus-server 1.2.7-beta.4 → 1.2.8-beta
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/status-server-run.js +13 -10
- package/bin/status-server.js +7 -4
- package/build/app.js +1151 -2212
- package/build/dist/hotaru-admin/assets/{LayoutHandler-4ab98254.js → LayoutHandler-a88af57b.js} +22 -22
- package/build/dist/hotaru-admin/assets/{Login-b137505a.js → Login-3f718f9e.js} +1 -1
- package/build/dist/hotaru-admin/assets/{UserOutlined-c7a36e46.js → UserOutlined-e45e7ca2.js} +1 -1
- package/build/dist/hotaru-admin/assets/{index-e73521eb.js → index-372f4f56.js} +2 -2
- package/build/dist/hotaru-admin/index.html +1 -1
- package/build/dist/hotaru-theme/assets/{index-d4dd98f1.js → index-734a7c4f.js} +1 -1
- package/build/dist/hotaru-theme/index.html +1 -1
- package/package.json +10 -8
- package/scripts/init.js +9 -6
- package/prisma/.env +0 -1
package/bin/status-server-run.js
CHANGED
|
@@ -1,19 +1,22 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
2
|
+
import { spawn } from 'child_process';
|
|
3
|
+
import { platform } from 'os';
|
|
4
|
+
import { dirname, resolve } from 'path';
|
|
5
|
+
import { fileURLToPath } from 'url';
|
|
6
|
+
import { createRequire } from 'module';
|
|
3
7
|
|
|
4
8
|
const args = process.argv.slice(2).join(' ');
|
|
9
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
5
10
|
|
|
6
|
-
|
|
7
|
-
const { platform } = require('os');
|
|
8
|
-
const { resolve } = require('path');
|
|
9
|
-
|
|
10
|
-
cp.spawn(platform() === 'win32' ? 'npm.cmd' : 'npm', ['run', 'prestart'], {
|
|
11
|
+
spawn(platform() === 'win32' ? 'npm.cmd' : 'npm', ['run', 'prestart'], {
|
|
11
12
|
env: process.env,
|
|
12
13
|
cwd: resolve(__dirname, '../'),
|
|
13
14
|
stdio: 'inherit'
|
|
14
|
-
}).on('close', () => {
|
|
15
|
+
}).on('close', async () => {
|
|
15
16
|
try {
|
|
16
|
-
|
|
17
|
+
// ES6 import not read NODE_PATH env
|
|
18
|
+
// const pm2 = await import('pm2');
|
|
19
|
+
const pm2 = createRequire(import.meta.url)('pm2');
|
|
17
20
|
pm2.connect(error => {
|
|
18
21
|
if (error) {
|
|
19
22
|
console.log(error);
|
|
@@ -22,7 +25,7 @@ cp.spawn(platform() === 'win32' ? 'npm.cmd' : 'npm', ['run', 'prestart'], {
|
|
|
22
25
|
pm2.start(
|
|
23
26
|
{
|
|
24
27
|
name: 'nodestatus',
|
|
25
|
-
script:
|
|
28
|
+
script: resolve(__dirname, '../build/app.js'),
|
|
26
29
|
args
|
|
27
30
|
},
|
|
28
31
|
error => {
|
|
@@ -35,6 +38,6 @@ cp.spawn(platform() === 'win32' ? 'npm.cmd' : 'npm', ['run', 'prestart'], {
|
|
|
35
38
|
console.log(`[ERROR]: ${error.message || error}`);
|
|
36
39
|
console.log('Something wrong. Please check if you have installed pm2 correctly.');
|
|
37
40
|
console.log('Fallback to non-pm2 daemon');
|
|
38
|
-
|
|
41
|
+
await import('../build/app.js');
|
|
39
42
|
}
|
|
40
43
|
});
|
package/bin/status-server.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
import { spawn } from 'child_process';
|
|
4
|
+
import { platform } from 'os';
|
|
5
|
+
import { dirname, resolve } from 'path';
|
|
6
|
+
import { fileURLToPath } from 'url';
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
9
|
+
|
|
10
|
+
spawn(platform() === 'win32' ? 'npm.cmd' : 'npm', ['run', 'start'], {
|
|
8
11
|
env: process.env,
|
|
9
12
|
cwd: resolve(__dirname, '../'),
|
|
10
13
|
stdio: 'inherit'
|