diff --git a/CHANGELOG.md b/CHANGELOG.md index c36cbe90..a08f05cc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # 更新日志 +## 2024.08.02 v7.3.0 + +1. 修复 `miniprogramToken` `miniprogramSession` 参数必填问题 + ## 2024.07.17 v7.2.0 1. `miniprogramToken` `miniprogramSession` 参数从git配置中取 diff --git a/package.json b/package.json index 44011fd0..9516074a 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@gitmars/monorepo", "description": "这是一个git工作流工具", - "version": "7.2.0", + "version": "7.3.0", "packageManager": "pnpm@9.1.0", "main": "index.js", "files": [ diff --git a/packages/api/package.json b/packages/api/package.json index f35a1595..fa172971 100644 --- a/packages/api/package.json +++ b/packages/api/package.json @@ -1,7 +1,7 @@ { "name": "@gitmars/api", "description": "gitmars api", - "version": "7.2.0", + "version": "7.3.0", "private": false, "main": "./dist/index.cjs.js", "module": "./dist/index.esm-bundler.js", diff --git a/packages/api/src/request/miniprogram.ts b/packages/api/src/request/miniprogram.ts index 86c5acbb..0e5f74e8 100644 --- a/packages/api/src/request/miniprogram.ts +++ b/packages/api/src/request/miniprogram.ts @@ -17,8 +17,8 @@ let buildConfig: ApolloConfigType export const post = async

(options: RequestConfig): Promise

=> { if (!buildConfig) buildConfig = (await getBuildConfig()) as ApolloConfigType if (!options.url.startsWith('http')) options.url = buildConfig.miniprogramDomain + options.url - const miniprogramToken = getGitMiniprogramToken() || buildConfig.miniprogramToken - const miniprogramSession = getGitMiniprogramSession() || buildConfig.miniprogramSession + const miniprogramToken = getGitMiniprogramToken(false) || buildConfig.miniprogramToken + const miniprogramSession = getGitMiniprogramSession(false) || buildConfig.miniprogramSession options.headers = Object.assign(options.headers || {}, { Authorization: miniprogramToken, cookie: `kop=${miniprogramSession}` @@ -38,8 +38,8 @@ export const post = async

(options: RequestConfig): Promise

=> { export const get = async

(options: RequestConfig): Promise

=> { if (!buildConfig) buildConfig = (await getBuildConfig()) as ApolloConfigType if (!options.url.startsWith('http')) options.url = buildConfig.miniprogramDomain + options.url - const miniprogramToken = getGitMiniprogramToken() || buildConfig.miniprogramToken - const miniprogramSession = getGitMiniprogramSession() || buildConfig.miniprogramSession + const miniprogramToken = getGitMiniprogramToken(false) || buildConfig.miniprogramToken + const miniprogramSession = getGitMiniprogramSession(false) || buildConfig.miniprogramSession options.headers = Object.assign(options.headers || {}, { Authorization: miniprogramToken, cookie: `kop=${miniprogramSession}` diff --git a/packages/build/package.json b/packages/build/package.json index a6d46ef1..dbc42d4f 100644 --- a/packages/build/package.json +++ b/packages/build/package.json @@ -1,7 +1,7 @@ { "name": "@gitmars/build", "description": "gitmars build", - "version": "7.2.0", + "version": "7.3.0", "private": false, "main": "./dist/index.cjs.js", "module": "./dist/index.esm-bundler.js", diff --git a/packages/cache/package.json b/packages/cache/package.json index a2c975b7..5df98200 100644 --- a/packages/cache/package.json +++ b/packages/cache/package.json @@ -1,7 +1,7 @@ { "name": "@gitmars/cache", "description": "gitmars cache", - "version": "7.2.0", + "version": "7.3.0", "private": false, "main": "./dist/index.cjs.js", "module": "./dist/index.esm-bundler.js", diff --git a/packages/core/package.json b/packages/core/package.json index 51ff3ace..c55add0f 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,7 +1,7 @@ { "name": "@gitmars/core", "description": "gitmars核心程序", - "version": "7.2.0", + "version": "7.3.0", "private": false, "main": "./dist/index.cjs.js", "module": "./dist/index.esm-bundler.js", diff --git a/packages/docs/package.json b/packages/docs/package.json index 52630c19..49132cf4 100644 --- a/packages/docs/package.json +++ b/packages/docs/package.json @@ -1,7 +1,7 @@ { "name": "@gitmars/docs", "description": "gitmars文档库", - "version": "7.2.0", + "version": "7.3.0", "private": false, "files": [ "dist", diff --git a/packages/git/package.json b/packages/git/package.json index df1acd3c..67cfb36e 100644 --- a/packages/git/package.json +++ b/packages/git/package.json @@ -1,7 +1,7 @@ { "name": "@gitmars/git", "description": "gitmars git", - "version": "7.2.0", + "version": "7.3.0", "private": false, "main": "./dist/index.cjs.js", "module": "./dist/index.esm-bundler.js", diff --git a/packages/git/src/getGitUser.ts b/packages/git/src/getGitUser.ts index 753400c6..d1f4bd69 100644 --- a/packages/git/src/getGitUser.ts +++ b/packages/git/src/getGitUser.ts @@ -51,10 +51,10 @@ export function getGitEmail(): string { * @returns - token */ export function getGitMiniprogramToken(throwOnError = true): string { - const { stdout } = spawnSync('git', ['config', 'user.miniprogramToken']) + const { stdout = '' } = spawnSync('git', ['config', 'user.miniprogramToken']) debug('git.miniprogramToken', stdout) - if (!stdout) { + if (!stdout.trim() && throwOnError) { sh.echo(chalk.red(t('Please set git miniprogram token'))) process.exit(1) } @@ -68,10 +68,10 @@ export function getGitMiniprogramToken(throwOnError = true): string { * @returns - session */ export function getGitMiniprogramSession(throwOnError = true): string { - const { stdout } = spawnSync('git', ['config', 'user.miniprogramSession']) + const { stdout = '' } = spawnSync('git', ['config', 'user.miniprogramSession']) debug('git.miniprogramSession', stdout) - if (!stdout) { + if (!stdout.trim() && throwOnError) { sh.echo(chalk.red(t('Please set git miniprogram session'))) process.exit(1) } diff --git a/packages/gitmars/package.json b/packages/gitmars/package.json index aece79a8..7addcbd4 100644 --- a/packages/gitmars/package.json +++ b/packages/gitmars/package.json @@ -2,7 +2,7 @@ "name": "gitmars", "description": "这是一个git工作流工具", "type": "module", - "version": "7.2.0", + "version": "7.3.0", "private": false, "bin": { "gitm": "lib/gitm.mjs" diff --git a/packages/go/package.json b/packages/go/package.json index 57c7dcad..27e18202 100644 --- a/packages/go/package.json +++ b/packages/go/package.json @@ -1,7 +1,7 @@ { "name": "@gitmars/go", "description": "gitmars go", - "version": "7.2.0", + "version": "7.3.0", "private": false, "main": "./dist/index.cjs.js", "module": "./dist/index.esm-bundler.js", diff --git a/packages/hook/package.json b/packages/hook/package.json index 9273aa9e..e87d0798 100644 --- a/packages/hook/package.json +++ b/packages/hook/package.json @@ -1,7 +1,7 @@ { "name": "@gitmars/hook", "description": "gitmars hook", - "version": "7.2.0", + "version": "7.3.0", "private": false, "main": "./dist/index.cjs.js", "module": "./dist/index.esm-bundler.js", diff --git a/packages/utils/package.json b/packages/utils/package.json index 6f278f15..45fe351a 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -1,7 +1,7 @@ { "name": "@gitmars/utils", "description": "gitmars utils", - "version": "7.2.0", + "version": "7.3.0", "private": false, "main": "./dist/index.cjs.js", "module": "./dist/index.esm-bundler.js",