create-aomex 0.0.65 → 0.0.67
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.
|
|
3
|
+
"version": "0.0.67",
|
|
4
4
|
"repository": "git@github.com:aomex/create-aomex.git",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -30,29 +30,29 @@
|
|
|
30
30
|
],
|
|
31
31
|
"bin": "dist/index.js",
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@aomex/common": "^3.
|
|
34
|
-
"@aomex/console": "^3.
|
|
33
|
+
"@aomex/common": "^3.27.1",
|
|
34
|
+
"@aomex/console": "^3.27.1",
|
|
35
35
|
"@inquirer/prompts": "^7.4.1",
|
|
36
36
|
"sanitize-filename": "^1.6.3",
|
|
37
37
|
"yargs-parser": "^21.1.1"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@aomex/async-trace": "^3.
|
|
41
|
-
"@aomex/auth": "^3.
|
|
42
|
-
"@aomex/cache": "^3.
|
|
43
|
-
"@aomex/cache-redis-adapter": "^3.
|
|
44
|
-
"@aomex/compress": "^3.
|
|
45
|
-
"@aomex/cors": "^3.
|
|
46
|
-
"@aomex/cron": "^3.
|
|
47
|
-
"@aomex/etag": "^3.
|
|
48
|
-
"@aomex/helmet": "^3.
|
|
49
|
-
"@aomex/http-logger": "^3.
|
|
50
|
-
"@aomex/logger": "^3.
|
|
51
|
-
"@aomex/openapi": "^3.
|
|
52
|
-
"@aomex/prisma": "^3.
|
|
53
|
-
"@aomex/response-time": "^3.
|
|
54
|
-
"@aomex/swagger-ui": "^3.
|
|
55
|
-
"@aomex/web": "^3.
|
|
40
|
+
"@aomex/async-trace": "^3.27.1",
|
|
41
|
+
"@aomex/auth": "^3.27.1",
|
|
42
|
+
"@aomex/cache": "^3.27.1",
|
|
43
|
+
"@aomex/cache-redis-adapter": "^3.27.1",
|
|
44
|
+
"@aomex/compress": "^3.27.1",
|
|
45
|
+
"@aomex/cors": "^3.27.1",
|
|
46
|
+
"@aomex/cron": "^3.27.1",
|
|
47
|
+
"@aomex/etag": "^3.27.1",
|
|
48
|
+
"@aomex/helmet": "^3.27.1",
|
|
49
|
+
"@aomex/http-logger": "^3.27.1",
|
|
50
|
+
"@aomex/logger": "^3.27.1",
|
|
51
|
+
"@aomex/openapi": "^3.27.1",
|
|
52
|
+
"@aomex/prisma": "^3.27.1",
|
|
53
|
+
"@aomex/response-time": "^3.27.1",
|
|
54
|
+
"@aomex/swagger-ui": "^3.27.1",
|
|
55
|
+
"@aomex/web": "^3.27.1",
|
|
56
56
|
"@prisma/client": "^6.6.0",
|
|
57
57
|
"@types/lodash.kebabcase": "^4.1.9",
|
|
58
58
|
"@types/node": "^22.14.1",
|
package/templates/package.json
CHANGED
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
"cron:stats": "sh scripts/docker-cron-stats.sh",
|
|
12
12
|
"commit:main": "sh scripts/commit-develop-to-main.sh",
|
|
13
13
|
"deploy:production": "sh scripts/deploy.sh production",
|
|
14
|
+
"deploy:api": "sh scripts/deploy-api.sh production",
|
|
15
|
+
"deploy:cron": "sh scripts/deploy-cron.sh production",
|
|
14
16
|
"deploy:integration": "sh scripts/deploy.sh integration",
|
|
15
17
|
"prepare": "npx husky",
|
|
16
18
|
"preinstall": "npx only-allow pnpm"
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env sh
|
|
2
|
+
|
|
3
|
+
set -ex
|
|
4
|
+
|
|
5
|
+
env="$1"
|
|
6
|
+
project_name="{{projectName}}"
|
|
7
|
+
docker_compose_file="docker-compose-$env.yml"
|
|
8
|
+
|
|
9
|
+
sudo docker build --tag "$project_name:$env" --file "Dockerfile.$env" .
|
|
10
|
+
|
|
11
|
+
api_service_name=api
|
|
12
|
+
|
|
13
|
+
sudo docker compose --file $docker_compose_file stop $api_service_name --timeout=1
|
|
14
|
+
sudo docker compose --file $docker_compose_file up $api_service_name -d --timeout=1
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#!/usr/bin/env sh
|
|
2
|
+
|
|
3
|
+
set -ex
|
|
4
|
+
|
|
5
|
+
env="$1"
|
|
6
|
+
project_name="{{projectName}}"
|
|
7
|
+
docker_compose_file="docker-compose-$env.yml"
|
|
8
|
+
|
|
9
|
+
sudo docker build --tag "$project_name:$env" --file "Dockerfile.$env" .
|
|
10
|
+
|
|
11
|
+
cron_service_name=cron
|
|
12
|
+
if [ -n "$(sudo docker compose --file $docker_compose_file ps | { grep $cron_service_name || :; })" ]
|
|
13
|
+
then
|
|
14
|
+
# exit 137 SIGKILL
|
|
15
|
+
{ sudo docker compose --file $docker_compose_file exec -it $cron_service_name /bin/sh -c "npx aomex cron:stop" || :; }
|
|
16
|
+
# against restart=always
|
|
17
|
+
sudo docker compose --file $docker_compose_file stop $cron_service_name --timeout=1
|
|
18
|
+
fi
|
|
19
|
+
|
|
20
|
+
sudo docker compose --file $docker_compose_file up $cron_service_name -d --timeout=1
|
|
@@ -8,13 +8,16 @@ docker_compose_file="docker-compose-$env.yml"
|
|
|
8
8
|
|
|
9
9
|
sudo docker build --tag "$project_name:$env" --file "Dockerfile.$env" .
|
|
10
10
|
|
|
11
|
+
api_service_name=api
|
|
11
12
|
cron_service_name=cron
|
|
13
|
+
|
|
12
14
|
if [ -n "$(sudo docker compose --file $docker_compose_file ps | { grep $cron_service_name || :; })" ]
|
|
13
15
|
then
|
|
14
16
|
# exit 137 SIGKILL
|
|
15
17
|
{ sudo docker compose --file $docker_compose_file exec -it $cron_service_name /bin/sh -c "npx aomex cron:stop" || :; }
|
|
16
18
|
# against restart=always
|
|
17
|
-
sudo docker compose --file $docker_compose_file stop $cron_service_name
|
|
19
|
+
sudo docker compose --file $docker_compose_file stop $cron_service_name --timeout=1
|
|
18
20
|
fi
|
|
19
21
|
|
|
22
|
+
sudo docker compose --file $docker_compose_file stop $api_service_name --timeout=1
|
|
20
23
|
sudo docker compose --file $docker_compose_file up -d --timeout=1 --remove-orphans
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { traceMiddleware } from '@aomex/async-trace';
|
|
2
2
|
import type { WebContext } from '@aomex/web';
|
|
3
3
|
|
|
4
|
-
export const slowTrace = traceMiddleware('
|
|
5
|
-
if (record.
|
|
4
|
+
export const slowTrace = traceMiddleware('链路追踪', async (record, _ctx: WebContext) => {
|
|
5
|
+
if (record.duration > 2_000) {
|
|
6
6
|
// 上报慢日志
|
|
7
7
|
}
|
|
8
8
|
});
|