create-aomex 0.0.48 → 0.0.50
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/package.json
CHANGED
|
@@ -2,34 +2,17 @@ import { execSync, spawn } from 'node:child_process';
|
|
|
2
2
|
import process from 'node:process';
|
|
3
3
|
|
|
4
4
|
execSync('docker compose -f docker-compose.yml down', { stdio: 'inherit' });
|
|
5
|
+
execSync('docker compose -f docker-compose.yml up --wait', { stdio: 'inherit' });
|
|
6
|
+
const ps = execSync('docker compose -f docker-compose.yml ps', { stdio: 'pipe', encoding: 'utf8' });
|
|
7
|
+
if (ps.includes('unhealthy')) process.exit(1);
|
|
5
8
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
});
|
|
9
|
+
execSync('npx prisma generate', { stdio: 'inherit' });
|
|
10
|
+
execSync('npx prisma migrate deploy', { stdio: 'inherit' });
|
|
11
|
+
const api = spawn('node', ['--import', 'tsx/esm', '--watch', 'src/web.ts'], { stdio: 'inherit' });
|
|
12
|
+
const cron = spawn('npx', ['aomex', 'cron:start'], { stdio: 'inherit' });
|
|
10
13
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
if (reg.test(chunk.toString())) {
|
|
16
|
-
resolve();
|
|
17
|
-
}
|
|
18
|
-
});
|
|
14
|
+
process.on('SIGINT', () => {
|
|
15
|
+
cron.kill('SIGINT');
|
|
16
|
+
api.kill('SIGINT');
|
|
17
|
+
execSync('docker compose -f docker-compose.yml down', { stdio: 'inherit' });
|
|
19
18
|
});
|
|
20
|
-
|
|
21
|
-
const server = spawn(
|
|
22
|
-
'npx prisma generate && npx prisma migrate deploy && node --import tsx/esm --watch src/web.ts',
|
|
23
|
-
{ stdio: 'inherit', shell: true },
|
|
24
|
-
);
|
|
25
|
-
|
|
26
|
-
const cron = spawn('npx aomex cron:start', { stdio: 'inherit', shell: true });
|
|
27
|
-
|
|
28
|
-
// 防止被其它逻辑清除监听
|
|
29
|
-
setTimeout(() => {
|
|
30
|
-
process.on('SIGINT', () => {
|
|
31
|
-
cron.kill('SIGINT');
|
|
32
|
-
server.kill('SIGINT');
|
|
33
|
-
docker.kill('SIGINT');
|
|
34
|
-
});
|
|
35
|
-
}, 1000);
|