create-aomex 0.0.20 → 0.0.22

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.20",
3
+ "version": "0.0.22",
4
4
  "repository": "git@github.com:aomex/create-aomex.git",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -31,26 +31,26 @@
31
31
  "bin": "dist/index.js",
32
32
  "packageManager": "pnpm@9.4.0",
33
33
  "dependencies": {
34
- "@aomex/console": "^3.2.2",
35
- "@aomex/core": "^3.2.2",
34
+ "@aomex/console": "^3.2.3",
35
+ "@aomex/core": "^3.2.3",
36
36
  "@inquirer/prompts": "^6.0.1",
37
37
  "lodash.kebabcase": "^4.1.1",
38
38
  "yargs-parser": "^21.1.1"
39
39
  },
40
40
  "devDependencies": {
41
- "@aomex/async-trace": "^3.2.2",
42
- "@aomex/cache": "^3.2.2",
43
- "@aomex/cache-redis-adapter": "^3.2.2",
44
- "@aomex/compress": "^3.2.2",
45
- "@aomex/cors": "^3.2.2",
46
- "@aomex/cron": "^3.2.2",
47
- "@aomex/etag": "^3.2.2",
48
- "@aomex/helmet": "^3.2.2",
49
- "@aomex/http-logger": "^3.2.2",
50
- "@aomex/openapi": "^3.2.2",
51
- "@aomex/response-time": "^3.2.2",
52
- "@aomex/swagger-ui": "^3.2.2",
53
- "@aomex/web": "^3.2.2",
41
+ "@aomex/async-trace": "^3.2.3",
42
+ "@aomex/cache": "^3.2.3",
43
+ "@aomex/cache-redis-adapter": "^3.2.3",
44
+ "@aomex/compress": "^3.2.3",
45
+ "@aomex/cors": "^3.2.3",
46
+ "@aomex/cron": "^3.2.3",
47
+ "@aomex/etag": "^3.2.3",
48
+ "@aomex/helmet": "^3.2.3",
49
+ "@aomex/http-logger": "^3.2.3",
50
+ "@aomex/openapi": "^3.2.3",
51
+ "@aomex/response-time": "^3.2.3",
52
+ "@aomex/swagger-ui": "^3.2.3",
53
+ "@aomex/web": "^3.2.3",
54
54
  "@prisma/client": "^5.17.0",
55
55
  "@types/lodash.kebabcase": "^4.1.9",
56
56
  "@types/node": "^20.14.12",
@@ -30,3 +30,39 @@
30
30
  ```bash
31
31
  {{packageManager}} deploy:production
32
32
  ```
33
+
34
+ ## 目录结构
35
+
36
+ ```
37
+ .
38
+ ├─ .husky/ git提交前执行的代码检测脚本
39
+ ├─ .vscode/ vscode编辑器基础设置
40
+ ├─ prisma/ 数据表结构和migrate文件
41
+ ├─ scripts/ 运维脚本
42
+ ├─ src/
43
+ ├─ commanders/ 指令控制层
44
+ ├─ configs/ 不同环境下的配置
45
+ ├─ i18n/ 国际化语言包
46
+ ├─ middleware/ 中间件
47
+ ├─ routers/ 路由控制层
48
+ ├─ services/ 业务逻辑层
49
+ ├─ cli.ts 控制台服务入口
50
+ └─ web.ts http服务入口
51
+ ├─ .env 开发环境下的mysql配置
52
+ ├─ .env.integration 集成环境下的mysql配置
53
+ ├─ .env.production 生产环境下的mysql配置
54
+ ├─ .commitlintrc.yml commitlint配置
55
+ ├─ .dockerignore 打包docker镜像时忽略的文件
56
+ ├─ .eslintrc.yml eslint配置
57
+ ├─ .gitignore git忽略指定文件和目录
58
+ ├─ .prettierignore prettier忽略指定文件和目录
59
+ ├─ .prettierrc.yml prettier配置
60
+ ├─ docker-compose-integration.yml 集成环境docker部署配置
61
+ ├─ docker-compose-production.yml 生产环境docker部署配置
62
+ ├─ docker-compose.yml 本地开发docker服务配置
63
+ ├─ Dockerfile.integration 集成环境docker镜像脚本
64
+ ├─ Dockerfile.production 生产环境docker镜像脚本
65
+ ├─ package.json 第三方依赖列表
66
+ ├─ README.md 项目介绍
67
+ └─ tsconfig.json Typescript配置
68
+ ```
@@ -0,0 +1,10 @@
1
+ import { I18n } from '@aomex/core';
2
+ import { locales } from './locales';
3
+
4
+ export const i18n = new I18n({
5
+ locales,
6
+ defaultLanguage: 'zh_CN',
7
+ });
8
+
9
+ // 检查不同语言包的缺失字段(相对于默认语言)
10
+ export type I18nMissingKeys = typeof i18n.missingKeys;
@@ -0,0 +1,6 @@
1
+ import { I18n } from '@aomex/core';
2
+ import { zh } from './zh-cn';
3
+
4
+ export const en = I18n.satisfies(zh).define({
5
+ hello: 'Hello World',
6
+ });
@@ -0,0 +1,7 @@
1
+ import { en } from './en-us';
2
+ import { zh } from './zh-cn';
3
+
4
+ export const locales = {
5
+ zh_CN: zh,
6
+ en_US: en,
7
+ };
@@ -0,0 +1,18 @@
1
+ import { I18n } from '@aomex/core';
2
+
3
+ export const zh = I18n.define({
4
+ hello: I18n.message('你好,世界。{{count}}', {
5
+ count: {
6
+ type: 'plural',
7
+ plural: {
8
+ '1': '这是你第一次访问',
9
+ '2-4': '你表现的很熟练',
10
+ 'n': '你是个老司机',
11
+ },
12
+ },
13
+ }),
14
+ button: {
15
+ ok: '确定',
16
+ cancel: '取消',
17
+ },
18
+ });
@@ -1,6 +1,7 @@
1
1
  import { rule } from '@aomex/core';
2
2
  import { response, Router } from '@aomex/web';
3
3
  import { hello } from '@middleware/hello.middleware';
4
+ import { i18n } from '../i18n';
4
5
 
5
6
  export const router = new Router();
6
7
 
@@ -13,6 +14,6 @@ router.get('/', {
13
14
  }),
14
15
  ],
15
16
  action: (ctx) => {
16
- ctx.send(`hello world, ${ctx.visitCount}`);
17
+ ctx.send(`${i18n.t('hello', { count: ctx.visitCount })}`);
17
18
  },
18
19
  });