create-aomex 0.0.48 → 0.0.49

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-aomex",
3
- "version": "0.0.48",
3
+ "version": "0.0.49",
4
4
  "repository": "git@github.com:aomex/create-aomex.git",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -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
- const docker = spawn('docker compose -f docker-compose.yml up --wait', {
7
- stdio: ['inherit', 'inherit', 'pipe'],
8
- shell: true,
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
- await new Promise((resolve) => {
12
- const reg = /mysql.+?healthy/i;
13
- docker.stderr.on('data', (chunk) => {
14
- process.stderr.write(chunk);
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);