create-aomex 0.0.43 → 0.0.44

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.43",
3
+ "version": "0.0.44",
4
4
  "repository": "git@github.com:aomex/create-aomex.git",
5
5
  "license": "MIT",
6
6
  "type": "module",
package/templates/.env CHANGED
@@ -1 +1 @@
1
- DATABASE_URL=mysql://root:abcde@localhost:3306/{{projectName}}
1
+ DATABASE_URL=mysql://my_user:my_pwd@localhost:3306/{{projectName}}
@@ -2,14 +2,22 @@ services:
2
2
  mysql:
3
3
  image: mysql:8
4
4
  environment:
5
+ MYSQL_ROOT_PASSWORD: 'abcde'
5
6
  # 修改后需要同步修改.env里的参数
6
7
  MYSQL_DATABASE: '{{projectName}}'
7
- MYSQL_ROOT_PASSWORD: 'abcde'
8
+ MYSQL_USER: 'my_user'
9
+ MYSQL_PASSWORD: 'my_pwd'
8
10
  volumes:
9
11
  - ./volumes/mysql:/var/lib/mysql
10
12
  ports:
11
13
  - 3306:3306
12
14
  command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
15
+ healthcheck:
16
+ test:
17
+ ['CMD', 'mysqladmin', 'ping', '-h', 'localhost', '-u', 'root', '-p$$MYSQL_ROOT_PASSWORD']
18
+ interval: 3s
19
+ timeout: 5s
20
+ retries: 10
13
21
  mongo:
14
22
  image: mongo:7
15
23
  environment:
@@ -3,15 +3,16 @@ import process from 'node:process';
3
3
 
4
4
  execSync('docker compose -f docker-compose.yml down', { stdio: 'inherit' });
5
5
 
6
- const docker = spawn('docker compose -f docker-compose.yml up', {
6
+ const docker = spawn('docker compose -f docker-compose.yml up --timestamps --wait', {
7
7
  stdio: ['inherit', 'inherit', 'pipe'],
8
8
  shell: true,
9
9
  });
10
10
 
11
11
  await new Promise((resolve) => {
12
+ const reg = /mysql.+?healthy/i;
12
13
  docker.stderr.on('data', (chunk) => {
13
14
  process.stderr.write(chunk);
14
- if (chunk.toString().includes('port: 3306 MySQL Community Server - GPL.')) {
15
+ if (reg.test(chunk.toString())) {
15
16
  resolve();
16
17
  }
17
18
  });