diff --git a/.gitignore b/.gitignore index 98dac098..fcd290d2 100644 --- a/.gitignore +++ b/.gitignore @@ -16,6 +16,6 @@ tsconfig.tsbuildinfo *debug.log *.conf -packages/config/yaml/dev.yaml -packages/config/yaml/prod.yaml +**/prod.yaml + scripts/update.sh diff --git a/README.md b/README.md index cb819a4b..737145c5 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ CREATE DATABASE `think` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_c #### 可选:Redis -如果需要文档版本服务,请在 `@think/config` 的 `yaml` 配置中进行 `db.redis` 的配置。 +如果需要文档版本服务,请在根目录 `yaml` 配置中进行 `db.redis` 的配置。 ``` docker pull redis:latest @@ -98,18 +98,19 @@ pnpm run dev ```yaml # 开发环境配置 +# 开发环境配置 +client: + port: 5001 + assetPrefix: '/' + apiUrl: 'http://localhost:5002/api' + collaborationUrl: 'ws://localhost:5003' + server: prefix: '/api' - port: 5001 + port: 5002 collaborationPort: 5003 maxDocumentVersion: 20 # 最大版本记录数 - -client: - port: 5002 - assetPrefix: '/' - apiUrl: 'http://localhost:5001/api' - collaborationUrl: 'ws://localhost:5003' - drawioUrl: 'https://embed.diagrams.net' + logRetainDays: 3 # 日志保留天数,比如只保留近三天日志 # 数据库配置 db: diff --git a/packages/config/yaml/dev.yaml b/dev.yaml similarity index 95% rename from packages/config/yaml/dev.yaml rename to dev.yaml index aea35a38..0ae5eb64 100644 --- a/packages/config/yaml/dev.yaml +++ b/dev.yaml @@ -1,17 +1,17 @@ # 开发环境配置 +client: + port: 5001 + assetPrefix: '/' + apiUrl: 'http://localhost:5002/api' + collaborationUrl: 'ws://localhost:5003' + server: prefix: '/api' - port: 5001 + port: 5002 collaborationPort: 5003 maxDocumentVersion: 20 # 最大版本记录数 logRetainDays: 3 # 日志保留天数,比如只保留近三天日志 -client: - port: 5002 - assetPrefix: '/' - apiUrl: 'http://localhost:5001/api' - collaborationUrl: 'ws://localhost:5003' - # 数据库配置 db: mysql: diff --git a/packages/config/lib/index.js b/packages/config/lib/index.js index 7f9636cd..505cda88 100644 --- a/packages/config/lib/index.js +++ b/packages/config/lib/index.js @@ -11,7 +11,7 @@ var FILE_ENV_NAME = { }; var env = process.env.NODE_ENV || 'development'; function getConfig() { - var filePath = path.join(__dirname, '../yaml/', "".concat(FILE_ENV_NAME[env], ".yaml")); + var filePath = path.join(__dirname, '../../../', "".concat(FILE_ENV_NAME[env], ".yaml")); if (!fs.existsSync(filePath)) { throw new Error("Can not find config file: ".concat(filePath)); } diff --git a/packages/config/src/index.ts b/packages/config/src/index.ts index 3ccebe7a..32833286 100644 --- a/packages/config/src/index.ts +++ b/packages/config/src/index.ts @@ -11,7 +11,7 @@ const FILE_ENV_NAME = { const env = process.env.NODE_ENV || 'development'; export function getConfig() { - const filePath = path.join(__dirname, '../yaml/', `${FILE_ENV_NAME[env]}.yaml`); + const filePath = path.join(__dirname, '../../../', `${FILE_ENV_NAME[env]}.yaml`); if (!fs.existsSync(filePath)) { throw new Error(`Can not find config file: ${filePath}`); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 381e4242..5ff08bdd 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -236,7 +236,7 @@ importers: eslint: 8.14.0 eslint-config-prettier: 8.5.0_eslint@8.14.0 eslint-plugin-import: 2.26.0_eslint@8.14.0 - eslint-plugin-prettier: 4.0.0_740be41c8168d0cc214a306089357ad0 + eslint-plugin-prettier: 4.0.0_74ebb802163a9b4fa8f89d76ed02f62a eslint-plugin-react: 7.29.4_eslint@8.14.0 eslint-plugin-react-hooks: 4.5.0_eslint@8.14.0 eslint-plugin-simple-import-sort: 7.0.0_eslint@8.14.0 @@ -5370,6 +5370,22 @@ packages: prettier-linter-helpers: 1.0.0 dev: true + /eslint-plugin-prettier/4.0.0_74ebb802163a9b4fa8f89d76ed02f62a: + resolution: {integrity: sha512-98MqmCJ7vJodoQK359bqQWaxOE0CS8paAz/GgjaZLyex4TTk3g9HugoO89EqWCrFiOqn9EVvcoo7gZzONCWVwQ==} + engines: {node: '>=6.0.0'} + peerDependencies: + eslint: '>=7.28.0' + eslint-config-prettier: '*' + prettier: '>=2.0.0' + peerDependenciesMeta: + eslint-config-prettier: + optional: true + dependencies: + eslint: 8.14.0 + eslint-config-prettier: 8.5.0_eslint@8.14.0 + prettier-linter-helpers: 1.0.0 + dev: true + /eslint-plugin-react-hooks/4.5.0_eslint@8.14.0: resolution: {integrity: sha512-8k1gRt7D7h03kd+SAAlzXkQwWK22BnK6GKZG+FJA6BAGy22CFvl8kCIXKpVux0cCxMWDQUPqSok0LKaZ0aOcCw==} engines: {node: '>=10'}