From edc4ec819bffa4606f759fef8140657c0a91742f Mon Sep 17 00:00:00 2001 From: lu17301156525 Date: Mon, 22 Apr 2024 01:20:38 -0700 Subject: [PATCH 1/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8C=BA=E5=9D=97?= =?UTF-8?q?=E6=A8=A1=E7=89=88=E4=B8=8B=E8=BD=BD=E6=96=B9=E5=BC=8F=E4=B8=BA?= =?UTF-8?q?pnpm,=E4=BF=AE=E6=94=B9=E5=8C=BA=E5=9D=97=E5=8F=91=E5=B8=83?= =?UTF-8?q?=E7=8E=AF=E5=A2=83=E5=8F=98=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/service/cnpm.ts | 10 +++++----- app/service/material-center/vueBlockBuilder.ts | 6 +++--- config/config.default.ts | 10 +++++++--- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/app/service/cnpm.ts b/app/service/cnpm.ts index 1cef34d..9ceecc5 100644 --- a/app/service/cnpm.ts +++ b/app/service/cnpm.ts @@ -15,13 +15,13 @@ import { Service } from 'egg'; export default class CnpmService extends Service { authToken = this.config.authToken; registry = this.config.registry; - + tokenRegistry = this.config.tokenRegistry async loginInNpm(packagePath) { const commands = [ 'npm config set strict-ssl false', - `npm config set registry https://${this.registry}`, - `npm config set //${this.registry}:_authToken=${this.authToken}`, - `npm whoami --registry https://${this.registry}` + `npm config set registry ${this.registry}`, + `npm config set //${this.tokenRegistry}:_authToken=${this.authToken}`, + `npm whoami --registry ${this.registry}` ]; return this.ctx.helper.execCommandWithCatch(commands, { cwd: packagePath }, 'login npm'); } @@ -30,5 +30,5 @@ export default class CnpmService extends Service { const commands = ['npm publish --access=public']; return this.ctx.helper.execCommandWithCatch(commands, { cwd: packagePath }, 'publish cnpm'); } - + } diff --git a/app/service/material-center/vueBlockBuilder.ts b/app/service/material-center/vueBlockBuilder.ts index fbcf535..90e1d4c 100644 --- a/app/service/material-center/vueBlockBuilder.ts +++ b/app/service/material-center/vueBlockBuilder.ts @@ -13,7 +13,7 @@ import spawn from 'cross-spawn'; import { Service } from 'egg'; import * as fs from 'fs-extra'; import * as path from 'path'; -export default class VueBlockBuilder extends Service{ +export default class VueBlockBuilder extends Service { base = this.config.buildground baseNpm = this.config.baseNpm framework = 'Vue' @@ -45,7 +45,7 @@ export default class VueBlockBuilder extends Service{ cwd: buildGround }) await this.spawnCommand(['npm', 'init', '-y'], { cwd: buildGround }) - const registries = this.config.npmRegistryOptions + const registries = this.config.cnpmRegistryOptions await this.spawnCommand(['npm', 'pack', baseNpm, ...registries, '--strict-ssl=false'], { cwd: buildGround }) @@ -54,7 +54,7 @@ export default class VueBlockBuilder extends Service{ await this.spawnCommand(['tar', '-xzvf', tgz], { cwd: buildGround }) await fs.copy(path.join(buildGround, 'package'), buildGround) await this.spawnCommand( - ['npm', 'install', ...registries, '--no-audit', '--no-fund', '--production=false', '--strict-ssl=false'], + ['pnpm', 'install', ...registries, '--production=false'], { cwd: buildGround } diff --git a/config/config.default.ts b/config/config.default.ts index 20bf13e..458eba6 100644 --- a/config/config.default.ts +++ b/config/config.default.ts @@ -9,10 +9,10 @@ * A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS. * */ -import * as path from 'path'; import { EggAppConfig, PowerPartial } from 'egg'; +import * as path from 'path'; +import { E_FOUNDATION_MODEL, E_SchemaFormatFunc } from '../app/lib/enum'; import { I_SchemaConvert } from '../app/lib/interface'; -import { E_SchemaFormatFunc, E_FOUNDATION_MODEL } from '../app/lib/enum'; export default (appInfo) => { @@ -281,10 +281,14 @@ export default (appInfo) => { '--registry=https://registry.npmjs.org/', ]; + config.cnpmRegistryOptions = [ + '--registry=http://registry.npmmirror.com/' + ]; config.buildground = '/tmp/buildground'; config.baseNpm = '@opentiny/tiny-engine-block-build'; config.authToken = process.env.NPM_AUTH_TOKEN; // 替换为自己的npm token - config.registry = 'registry.npmjs.org/'; + config.registry = 'https://registry.npmjs.org/'; + config.tokenRegistry = 'registry.npmjs.org/'; config.projectName = process.env.GIT_REPO; // 应用发布git仓库地址 config.gitBranch = process.env.GIT_BRANCH; // 应用发布git代码默认提交分支 config.userName = process.env.GIT_USERNAME; From acd14db61cf741f5d731dba92faa8e8c29d18d02 Mon Sep 17 00:00:00 2001 From: lu17301156525 Date: Tue, 23 Apr 2024 00:17:16 -0700 Subject: [PATCH 2/5] =?UTF-8?q?=E6=A0=B9=E6=8D=AEreview=E6=84=8F=E8=A7=81?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: lu17301156525 --- app/service/cnpm.ts | 3 +-- config/config.default.ts | 9 ++++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/app/service/cnpm.ts b/app/service/cnpm.ts index 9ceecc5..206bad6 100644 --- a/app/service/cnpm.ts +++ b/app/service/cnpm.ts @@ -15,12 +15,11 @@ import { Service } from 'egg'; export default class CnpmService extends Service { authToken = this.config.authToken; registry = this.config.registry; - tokenRegistry = this.config.tokenRegistry async loginInNpm(packagePath) { const commands = [ 'npm config set strict-ssl false', `npm config set registry ${this.registry}`, - `npm config set //${this.tokenRegistry}:_authToken=${this.authToken}`, + `npm config set //${this.registry.split("//")?.[1]}:_authToken=${this.authToken}`, `npm whoami --registry ${this.registry}` ]; return this.ctx.helper.execCommandWithCatch(commands, { cwd: packagePath }, 'login npm'); diff --git a/config/config.default.ts b/config/config.default.ts index ebfe1ae..8399e83 100644 --- a/config/config.default.ts +++ b/config/config.default.ts @@ -250,7 +250,7 @@ export default (appInfo) => { config.aiChat = (messages = []) => { return { [E_FOUNDATION_MODEL.GPT_35_TURBO]: { - httpRequestUrl: (process.env.OPENAI_API_URL || 'https://api.openai.com')+'/v1/chat/completions', + httpRequestUrl: (process.env.OPENAI_API_URL || 'https://api.openai.com') + '/v1/chat/completions', httpRequestOption: { ...commonRequestOption, data: { @@ -265,7 +265,7 @@ export default (appInfo) => { }, ////本地兼容opanai-api接口的 大语言模型,如chatGLM6b,通义千问 等。你也可以分开成多个 [E_FOUNDATION_MODEL.Local_GPT]: { - httpRequestUrl: (process.env.Local_GPT_API_URL || 'http://127.0.0.1:8000')+'/v1/chat/completions', + httpRequestUrl: (process.env.Local_GPT_API_URL || 'http://127.0.0.1:8000') + '/v1/chat/completions', httpRequestOption: { ...commonRequestOption, data: { @@ -295,15 +295,14 @@ export default (appInfo) => { config.npmRegistryOptions = [ '--registry=https://registry.npmjs.org/', ]; - + // 国内镜像 config.cnpmRegistryOptions = [ '--registry=http://registry.npmmirror.com/' ]; config.buildground = '/tmp/buildground'; config.baseNpm = '@opentiny/tiny-engine-block-build'; config.authToken = process.env.NPM_AUTH_TOKEN; // 替换为自己的npm token - config.registry = 'https://registry.npmjs.org/'; - config.tokenRegistry = 'registry.npmjs.org/'; + config.registry = 'https://registry.npmjs.org/'; //如果部署了私仓可替换为自己私仓地址 config.projectName = process.env.GIT_REPO; // 应用发布git仓库地址 config.gitBranch = process.env.GIT_BRANCH; // 应用发布git代码默认提交分支 config.userName = process.env.GIT_USERNAME; From 3006756456026b503569914101f9e936a3d6bd25 Mon Sep 17 00:00:00 2001 From: lu17301156525 Date: Tue, 23 Apr 2024 00:28:02 -0700 Subject: [PATCH 3/5] =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E6=A3=80=E8=A7=86?= =?UTF-8?q?=E6=84=8F=E8=A7=81=E4=BF=AE=E6=94=B9=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: lu17301156525 --- config/config.default.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/config.default.ts b/config/config.default.ts index 8399e83..a92b164 100644 --- a/config/config.default.ts +++ b/config/config.default.ts @@ -302,7 +302,7 @@ export default (appInfo) => { config.buildground = '/tmp/buildground'; config.baseNpm = '@opentiny/tiny-engine-block-build'; config.authToken = process.env.NPM_AUTH_TOKEN; // 替换为自己的npm token - config.registry = 'https://registry.npmjs.org/'; //如果部署了私仓可替换为自己私仓地址 + config.registry = 'https://registry.npmjs.org/'; // 如果部署了私仓。可以替换为私仓地址 config.projectName = process.env.GIT_REPO; // 应用发布git仓库地址 config.gitBranch = process.env.GIT_BRANCH; // 应用发布git代码默认提交分支 config.userName = process.env.GIT_USERNAME; From 081ea9d4fff698ed352249157dc8fbe9991e9781 Mon Sep 17 00:00:00 2001 From: lu17301156525 Date: Tue, 23 Apr 2024 00:28:34 -0700 Subject: [PATCH 4/5] =?UTF-8?q?Revert=20"=E6=A0=B9=E6=8D=AE=E6=A3=80?= =?UTF-8?q?=E8=A7=86=E6=84=8F=E8=A7=81=E4=BF=AE=E6=94=B9=E4=BB=A3=E7=A0=81?= =?UTF-8?q?"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 3006756456026b503569914101f9e936a3d6bd25. --- config/config.default.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/config.default.ts b/config/config.default.ts index a92b164..8399e83 100644 --- a/config/config.default.ts +++ b/config/config.default.ts @@ -302,7 +302,7 @@ export default (appInfo) => { config.buildground = '/tmp/buildground'; config.baseNpm = '@opentiny/tiny-engine-block-build'; config.authToken = process.env.NPM_AUTH_TOKEN; // 替换为自己的npm token - config.registry = 'https://registry.npmjs.org/'; // 如果部署了私仓。可以替换为私仓地址 + config.registry = 'https://registry.npmjs.org/'; //如果部署了私仓可替换为自己私仓地址 config.projectName = process.env.GIT_REPO; // 应用发布git仓库地址 config.gitBranch = process.env.GIT_BRANCH; // 应用发布git代码默认提交分支 config.userName = process.env.GIT_USERNAME; From c866632452ce8ec115dad02760d2db2d9dbb5ad1 Mon Sep 17 00:00:00 2001 From: lu17301156525 Date: Tue, 23 Apr 2024 00:30:47 -0700 Subject: [PATCH 5/5] =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E6=A3=80=E8=A7=86?= =?UTF-8?q?=E6=84=8F=E8=A7=81=E4=BF=AE=E6=94=B9=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: lu17301156525 --- config/config.default.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/config.default.ts b/config/config.default.ts index 8399e83..dfc268e 100644 --- a/config/config.default.ts +++ b/config/config.default.ts @@ -302,7 +302,7 @@ export default (appInfo) => { config.buildground = '/tmp/buildground'; config.baseNpm = '@opentiny/tiny-engine-block-build'; config.authToken = process.env.NPM_AUTH_TOKEN; // 替换为自己的npm token - config.registry = 'https://registry.npmjs.org/'; //如果部署了私仓可替换为自己私仓地址 + config.registry = 'https://registry.npmjs.org/'; // 如果部署了私仓可替换为自己私仓地址 config.projectName = process.env.GIT_REPO; // 应用发布git仓库地址 config.gitBranch = process.env.GIT_BRANCH; // 应用发布git代码默认提交分支 config.userName = process.env.GIT_USERNAME;