create-aomex 0.0.63 → 0.0.64
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 +33 -33
- package/templates/src/cli.ts +1 -1
- package/templates/src/commanders/hello.cmd.ts +1 -29
- package/templates/src/i18n/index.ts +1 -1
- package/templates/src/middleware/slow-trace.md.ts +8 -0
- package/templates/src/routers/hello.router.ts +6 -5
- package/templates/src/web.ts +3 -5
- package/templates/tsconfig.json +4 -2
- package/templates/src/middleware/counter.md.ts +0 -8
- package/templates/src/middleware/trace.md.ts +0 -7
package/package.json
CHANGED
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-aomex",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.64",
|
|
4
4
|
"repository": "git@github.com:aomex/create-aomex.git",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"cli": "rm -rf hello-aomex && tsx src/index.ts --project=HelloAomex --node
|
|
8
|
+
"cli": "rm -rf hello-aomex && tsx src/index.ts --project=HelloAomex --node v22.8.0",
|
|
9
9
|
"release": "release-it --ci",
|
|
10
10
|
"build": "tsup",
|
|
11
11
|
"prepublishOnly": "tsup"
|
|
12
12
|
},
|
|
13
13
|
"volta": {
|
|
14
|
-
"node": "
|
|
15
|
-
"pnpm": "
|
|
14
|
+
"node": "22.8.0",
|
|
15
|
+
"pnpm": "10.8.1"
|
|
16
16
|
},
|
|
17
17
|
"engines": {
|
|
18
|
-
"node": ">=
|
|
18
|
+
"node": ">=22.8.0"
|
|
19
19
|
},
|
|
20
|
+
"packageManager": "pnpm@10.8.1",
|
|
20
21
|
"publishConfig": {
|
|
21
22
|
"access": "public"
|
|
22
23
|
},
|
|
@@ -28,40 +29,39 @@
|
|
|
28
29
|
"README.md"
|
|
29
30
|
],
|
|
30
31
|
"bin": "dist/index.js",
|
|
31
|
-
"packageManager": "pnpm@9.4.0",
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@aomex/common": "^3.
|
|
34
|
-
"@aomex/console": "^3.
|
|
35
|
-
"@inquirer/prompts": "^7.1
|
|
33
|
+
"@aomex/common": "^3.25.0",
|
|
34
|
+
"@aomex/console": "^3.25.0",
|
|
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.
|
|
56
|
-
"@prisma/client": "^
|
|
40
|
+
"@aomex/async-trace": "^3.25.0",
|
|
41
|
+
"@aomex/auth": "^3.25.0",
|
|
42
|
+
"@aomex/cache": "^3.25.0",
|
|
43
|
+
"@aomex/cache-redis-adapter": "^3.25.0",
|
|
44
|
+
"@aomex/compress": "^3.25.0",
|
|
45
|
+
"@aomex/cors": "^3.25.0",
|
|
46
|
+
"@aomex/cron": "^3.25.0",
|
|
47
|
+
"@aomex/etag": "^3.25.0",
|
|
48
|
+
"@aomex/helmet": "^3.25.0",
|
|
49
|
+
"@aomex/http-logger": "^3.25.0",
|
|
50
|
+
"@aomex/logger": "^3.25.0",
|
|
51
|
+
"@aomex/openapi": "^3.25.0",
|
|
52
|
+
"@aomex/prisma": "^3.25.0",
|
|
53
|
+
"@aomex/response-time": "^3.25.0",
|
|
54
|
+
"@aomex/swagger-ui": "^3.25.0",
|
|
55
|
+
"@aomex/web": "^3.25.0",
|
|
56
|
+
"@prisma/client": "^6.6.0",
|
|
57
57
|
"@types/lodash.kebabcase": "^4.1.9",
|
|
58
|
-
"@types/node": "^22.
|
|
58
|
+
"@types/node": "^22.14.1",
|
|
59
59
|
"@types/yargs-parser": "^21.0.3",
|
|
60
|
-
"ioredis": "^5.
|
|
61
|
-
"prisma": "^
|
|
62
|
-
"release-it": "^
|
|
63
|
-
"tsup": "^8.
|
|
64
|
-
"tsx": "^4.19.
|
|
65
|
-
"typescript": "^5.
|
|
60
|
+
"ioredis": "^5.6.1",
|
|
61
|
+
"prisma": "^6.6.0",
|
|
62
|
+
"release-it": "^19.0.1",
|
|
63
|
+
"tsup": "^8.4.0",
|
|
64
|
+
"tsx": "^4.19.3",
|
|
65
|
+
"typescript": "^5.8.3"
|
|
66
66
|
}
|
|
67
67
|
}
|
package/templates/src/cli.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Commander, options } from '@aomex/console';
|
|
2
|
-
import { rule
|
|
3
|
-
import { cron } from '@aomex/cron';
|
|
2
|
+
import { rule } from '@aomex/common';
|
|
4
3
|
|
|
5
4
|
export const commander = new Commander();
|
|
6
5
|
|
|
@@ -27,30 +26,3 @@ commander.create('hello', {
|
|
|
27
26
|
console.log(`Hello ${user}`);
|
|
28
27
|
},
|
|
29
28
|
});
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* 定时任务示例
|
|
33
|
-
*
|
|
34
|
-
* npx aomex cron:start 启动
|
|
35
|
-
* npx aomex cron:stop 结束
|
|
36
|
-
* npx aomex cron:stats 运行状态
|
|
37
|
-
* npx aomex cron:eject 查看列表
|
|
38
|
-
*/
|
|
39
|
-
commander.create('hello:cron', {
|
|
40
|
-
docs: {
|
|
41
|
-
summary: '执行 npx aomex -h 可以看到我',
|
|
42
|
-
description: '执行 npx aomex hello:cron -h 可以看到我',
|
|
43
|
-
},
|
|
44
|
-
mount: [
|
|
45
|
-
// cron({ second: '*/15' }),
|
|
46
|
-
cron({ minute: '*', args: ['--user', 'Boss'] }),
|
|
47
|
-
options({
|
|
48
|
-
user: rule.string().default('World'),
|
|
49
|
-
}),
|
|
50
|
-
],
|
|
51
|
-
action: async (ctx) => {
|
|
52
|
-
const { user } = ctx.options;
|
|
53
|
-
console.log(`Hello ${user}`);
|
|
54
|
-
await sleep(5_000);
|
|
55
|
-
},
|
|
56
|
-
});
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import { rule } from '@aomex/common';
|
|
2
|
-
import { response, Router } from '@aomex/web';
|
|
3
|
-
import { counter } from '@middleware/counter.md';
|
|
4
|
-
import { i18n } from '../i18n';
|
|
2
|
+
import { query, response, Router } from '@aomex/web';
|
|
5
3
|
|
|
6
4
|
export const router = new Router();
|
|
7
5
|
|
|
8
6
|
router.get('/', {
|
|
9
7
|
mount: [
|
|
10
|
-
|
|
8
|
+
query({
|
|
9
|
+
user: rule.string().optional(),
|
|
10
|
+
}),
|
|
11
11
|
response({
|
|
12
12
|
statusCode: 200,
|
|
13
13
|
content: rule.string(),
|
|
14
14
|
}),
|
|
15
15
|
],
|
|
16
16
|
action: (ctx) => {
|
|
17
|
-
|
|
17
|
+
const { user = 'World' } = ctx.query;
|
|
18
|
+
ctx.send(`Hello ${user}`);
|
|
18
19
|
},
|
|
19
20
|
});
|
package/templates/src/web.ts
CHANGED
|
@@ -5,29 +5,27 @@ import { etag } from '@aomex/etag';
|
|
|
5
5
|
import { helmet } from '@aomex/helmet';
|
|
6
6
|
import { responseTime } from '@aomex/response-time';
|
|
7
7
|
import { swagger } from '@middleware/swagger.md';
|
|
8
|
-
import {
|
|
9
|
-
import { trace } from '@middleware/trace.md';
|
|
8
|
+
import { slowTrace } from '@middleware/slow-trace.md';
|
|
10
9
|
import { httpLogger } from '@middleware/http-logger.md';
|
|
11
10
|
import { logger } from '@services/logger';
|
|
12
11
|
|
|
13
12
|
export const app = new WebApp({
|
|
14
13
|
language: 'zh_CN',
|
|
15
14
|
mount: [
|
|
16
|
-
i18nProvider,
|
|
17
15
|
httpLogger,
|
|
18
16
|
responseTime,
|
|
17
|
+
slowTrace,
|
|
19
18
|
cors(),
|
|
20
19
|
compress(),
|
|
21
20
|
etag(),
|
|
22
21
|
swagger,
|
|
23
22
|
helmet(),
|
|
24
|
-
trace,
|
|
25
23
|
routers('./src/routers'),
|
|
26
24
|
],
|
|
27
25
|
});
|
|
28
26
|
|
|
29
27
|
app.on('error', (err, ctx) => {
|
|
30
|
-
logger.error(err.stack
|
|
28
|
+
logger.error(err.stack!);
|
|
31
29
|
ctx.response.body = {
|
|
32
30
|
status: ctx.response.statusCode,
|
|
33
31
|
message: ctx.response.body,
|
package/templates/tsconfig.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"compilerOptions": {
|
|
3
3
|
"target": "es2022",
|
|
4
4
|
"module": "es2022",
|
|
5
|
-
"lib": ["
|
|
5
|
+
"lib": ["ESNext"],
|
|
6
6
|
"strict": true,
|
|
7
7
|
"esModuleInterop": true,
|
|
8
8
|
"skipLibCheck": true,
|
|
@@ -39,7 +39,9 @@
|
|
|
39
39
|
"@middleware/*": ["./src/middleware/*"],
|
|
40
40
|
"@services": ["./src/services/index.ts"],
|
|
41
41
|
"@services/*": ["./src/services/*"],
|
|
42
|
-
"@constants/*": ["./
|
|
42
|
+
"@constants/*": ["./src/constants/*"],
|
|
43
|
+
"@models/*": ["./src/models/*"],
|
|
44
|
+
"@utils/*": ["./src/utils/*"]
|
|
43
45
|
}
|
|
44
46
|
}
|
|
45
47
|
}
|