From e8f52e2d3b383e90bcdb69ad9ca9e95a20d58eb8 Mon Sep 17 00:00:00 2001 From: zhengyanan18 Date: Fri, 28 Mar 2025 11:16:26 +0800 Subject: [PATCH 01/11] =?UTF-8?q?feat:=20cli=E5=AE=89=E8=A3=85=E5=90=8E?= =?UTF-8?q?=EF=BC=8C=E5=A6=82=E6=9E=9C=E5=86=85=E7=BD=91=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=AE=89=E8=A3=85=E6=95=88=E8=83=BD=E6=8F=92=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/taro-cli/package.json | 2 ++ packages/taro-cli/postinstall.js | 19 +++++++++++++++++++ packages/taro-cli/src/cli.ts | 2 +- packages/taro-service/src/Config.ts | 1 + 4 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 packages/taro-cli/postinstall.js diff --git a/packages/taro-cli/package.json b/packages/taro-cli/package.json index ec5495d60f86..c04c8d52d0d4 100644 --- a/packages/taro-cli/package.json +++ b/packages/taro-cli/package.json @@ -5,6 +5,7 @@ "main": "index.js", "types": "dist/index.d.ts", "scripts": { + "postinstall": "node postinstall.js", "test": "cross-env NODE_ENV=test jest", "test:ci": "cross-env NODE_ENV=test jest --ci -i --coverage --silent", "test:dev": "cross-env NODE_ENV=test jest --watch", @@ -22,6 +23,7 @@ "src", "dist", "templates", + "postinstall.js", "index.js", "global.d.ts" ], diff --git a/packages/taro-cli/postinstall.js b/packages/taro-cli/postinstall.js new file mode 100644 index 000000000000..78ac35e196b2 --- /dev/null +++ b/packages/taro-cli/postinstall.js @@ -0,0 +1,19 @@ +const { exec } = require('child_process') + +fetch('https://taro.jd.com/') + .then(() => { + // JD内网 + console.log('*******JD内网:*******', process.cwd()) + exec('taro global-config add-plugin @jdtaro/plugin-report-performance-data@latest --registry http://registry.m.jd.com', (error, stdout, stderr) => { + if (error) { + console.error(`执行错误: ${error}`) + return + } + console.log(`stdout:{\n ${stdout} \n}`) + console.log(`stderr:{\n ${stderr} \n}`) + }) + }) + .catch(() => { + // 公网 + console.log('*******公网:*******') + }) diff --git a/packages/taro-cli/src/cli.ts b/packages/taro-cli/src/cli.ts index a8aca72de6fb..cc2c4bcfe6c6 100644 --- a/packages/taro-cli/src/cli.ts +++ b/packages/taro-cli/src/cli.ts @@ -6,7 +6,7 @@ import * as path from 'path' import customCommand from './commands/customCommand' import { getPkgVersion } from './util' -const DISABLE_GLOBAL_CONFIG_COMMANDS = ['build', 'global-config', 'doctor', 'update', 'config'] +const DISABLE_GLOBAL_CONFIG_COMMANDS = ['global-config', 'doctor', 'update', 'config'] const DEFAULT_FRAMEWORK = 'react' export default class CLI { diff --git a/packages/taro-service/src/Config.ts b/packages/taro-service/src/Config.ts index 20fd7c5e0247..fadd4cef8c4f 100644 --- a/packages/taro-service/src/Config.ts +++ b/packages/taro-service/src/Config.ts @@ -51,6 +51,7 @@ export default class Config { if (this.disableGlobalConfig) return this.initGlobalConfig() } else { + this.initGlobalConfig() createSwcRegister({ only: [ filePath => filePath.indexOf(path.join(this.appPath, CONFIG_DIR_NAME)) >= 0 From bd542ecb6890778bf9ced6b141abb9ebd592fc52 Mon Sep 17 00:00:00 2001 From: zhengyanan18 Date: Fri, 28 Mar 2025 14:10:18 +0800 Subject: [PATCH 02/11] =?UTF-8?q?fix:=20fetch=E6=8D=A2=E6=88=90axios?= =?UTF-8?q?=EF=BC=8C=E5=85=BC=E5=AE=B93.x?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/taro-cli/postinstall.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/taro-cli/postinstall.js b/packages/taro-cli/postinstall.js index 78ac35e196b2..c08dcbb90e8f 100644 --- a/packages/taro-cli/postinstall.js +++ b/packages/taro-cli/postinstall.js @@ -1,6 +1,7 @@ const { exec } = require('child_process') +const axios = require('axios') -fetch('https://taro.jd.com/') +axios.get('https://taro.jd.com/') .then(() => { // JD内网 console.log('*******JD内网:*******', process.cwd()) From f6d3a005fd2e6527712bc4060eddba8ad78cdd2f Mon Sep 17 00:00:00 2001 From: zhengyanan18 Date: Tue, 1 Apr 2025 16:07:07 +0800 Subject: [PATCH 03/11] =?UTF-8?q?feat:=20=E7=B2=BE=E7=BB=86=E5=8C=96?= =?UTF-8?q?=E6=8E=A7=E5=88=B6=EF=BC=8CTaro=E9=A1=B9=E7=9B=AE=E5=86=85?= =?UTF-8?q?=E6=89=A7=E8=A1=8C=E6=9F=90=E5=91=BD=E4=BB=A4=EF=BC=8C=E5=8F=AA?= =?UTF-8?q?=E5=8A=A0=E8=BD=BD=E8=AF=A5=E5=91=BD=E4=BB=A4=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E7=9A=84=E7=9A=84=E5=85=A8=E5=B1=80=E6=8F=92=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/taro-cli/postinstall.js | 2 +- packages/taro-service/src/Config.ts | 12 ++++++++---- packages/taro-service/src/utils/index.ts | 21 ++++++++++++++++++++- 3 files changed, 29 insertions(+), 6 deletions(-) diff --git a/packages/taro-cli/postinstall.js b/packages/taro-cli/postinstall.js index c08dcbb90e8f..71ad0f458d16 100644 --- a/packages/taro-cli/postinstall.js +++ b/packages/taro-cli/postinstall.js @@ -1,7 +1,7 @@ const { exec } = require('child_process') const axios = require('axios') -axios.get('https://taro.jd.com/') +axios.get('https://taro.jd.com/', { timeout: 5000 }) .then(() => { // JD内网 console.log('*******JD内网:*******', process.cwd()) diff --git a/packages/taro-service/src/Config.ts b/packages/taro-service/src/Config.ts index fadd4cef8c4f..99f29c88554f 100644 --- a/packages/taro-service/src/Config.ts +++ b/packages/taro-service/src/Config.ts @@ -14,6 +14,7 @@ import * as ora from 'ora' import * as path from 'path' import * as merge from 'webpack-merge' +import { filterGlobalConfig } from './utils' import { CONFIG_DIR_NAME, DEFAULT_CONFIG_FILE @@ -34,7 +35,7 @@ export default class Config { isInitSuccess: boolean disableGlobalConfig: boolean - constructor (opts: IConfigOptions) { + constructor(opts: IConfigOptions) { this.appPath = opts.appPath this.disableGlobalConfig = !!opts?.disableGlobalConfig } @@ -49,9 +50,11 @@ export default class Config { this.configPath = resolveScriptPath(path.join(this.appPath, CONFIG_DIR_NAME, DEFAULT_CONFIG_FILE)) if (!fs.existsSync(this.configPath)) { if (this.disableGlobalConfig) return - this.initGlobalConfig() + // 没有项目config,说明是全局命令,只加载命令相关的插件 + this.initGlobalConfig('command') } else { - this.initGlobalConfig() + // 有项目config,说明是Taro项目内命令,加载该命令相关的全局插件`@jdtaro/plugin-${command}...` + this.initGlobalConfig(configEnv.command) createSwcRegister({ only: [ filePath => filePath.indexOf(path.join(this.appPath, CONFIG_DIR_NAME)) >= 0 @@ -67,7 +70,7 @@ export default class Config { } } - initGlobalConfig () { + initGlobalConfig (command: string = '') { const homedir = getUserHomeDir() if (!homedir) return console.error('获取不到用户 home 路径') const globalPluginConfigPath = path.join(getUserHomeDir(), TARO_GLOBAL_CONFIG_DIR, TARO_GLOBAL_CONFIG_FILE) @@ -75,6 +78,7 @@ export default class Config { if (!fs.existsSync(globalPluginConfigPath)) return spinner.warn(`获取 taro 全局配置文件失败,不存在全局配置文件:${globalPluginConfigPath}`) try { this.initialGlobalConfig = fs.readJSONSync(globalPluginConfigPath) || {} + this.initialGlobalConfig = filterGlobalConfig(this.initialGlobalConfig, command) spinner.succeed('获取 taro 全局配置成功') } catch (e) { spinner.stop() diff --git a/packages/taro-service/src/utils/index.ts b/packages/taro-service/src/utils/index.ts index 2336981492b1..dbc4752353c6 100644 --- a/packages/taro-service/src/utils/index.ts +++ b/packages/taro-service/src/utils/index.ts @@ -5,7 +5,7 @@ import * as resolve from 'resolve' import { PluginType } from './constants' -import type { PluginItem } from '@tarojs/taro/types/compile' +import type { IProjectConfig, PluginItem } from '@tarojs/taro/types/compile' import type { IPlugin, IPluginsObject } from './types' export const isNpmPkg: (name: string) => boolean = name => !(/^(\.|\/)/.test(name)) @@ -116,3 +116,22 @@ export function printHelpLog (command, optionsList: Map, synopsi }) } } + +// 对于全局配置,如果command为空,则返回全部。否则只返回command相关的插件和presets +export function filterGlobalConfig (globalConfig: IProjectConfig, command: string) { + if (!command) { + return globalConfig + } + const config = globalConfig + + // 如果有command,则只留下command相关的plugin + const RelatedPluginTag = `@jdtaro/plugin-${command}` + if (config.plugins) { + config.plugins = config.plugins.filter(pluginName => { + return pluginName.includes(RelatedPluginTag) + }) + } + + // TODO:如果有presets,则只留下command相关的presets.当前无这样的需求 + return config +} From d1e1ff81cf50bfea1a059ff1bccd57acaff72b1b Mon Sep 17 00:00:00 2001 From: zhengyanan18 Date: Tue, 1 Apr 2025 17:05:15 +0800 Subject: [PATCH 04/11] =?UTF-8?q?fix:=20=E6=9B=B4=E6=96=B0=E6=95=88?= =?UTF-8?q?=E8=83=BD=E6=8F=92=E4=BB=B6=E5=8C=85=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/taro-cli/postinstall.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/taro-cli/postinstall.js b/packages/taro-cli/postinstall.js index 71ad0f458d16..41f9e13ee86f 100644 --- a/packages/taro-cli/postinstall.js +++ b/packages/taro-cli/postinstall.js @@ -5,7 +5,7 @@ axios.get('https://taro.jd.com/', { timeout: 5000 }) .then(() => { // JD内网 console.log('*******JD内网:*******', process.cwd()) - exec('taro global-config add-plugin @jdtaro/plugin-report-performance-data@latest --registry http://registry.m.jd.com', (error, stdout, stderr) => { + exec('taro global-config add-plugin @jdtaro/plugin-build-report-performance@latest --registry http://registry.m.jd.com', (error, stdout, stderr) => { if (error) { console.error(`执行错误: ${error}`) return From 59903527c129d7280469351bc88cec24fb99d175 Mon Sep 17 00:00:00 2001 From: zhengyanan18 Date: Wed, 2 Apr 2025 15:21:50 +0800 Subject: [PATCH 05/11] =?UTF-8?q?fix:=20=E5=85=A8=E5=B1=80=E5=91=BD?= =?UTF-8?q?=E4=BB=A4=E9=BB=98=E8=AE=A4=E5=8A=A0=E8=BD=BD=E6=89=80=E6=9C=89?= =?UTF-8?q?=E5=85=A8=E5=B1=80=E6=8F=92=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/taro-cli/postinstall.js | 10 +++++----- packages/taro-service/src/Config.ts | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/taro-cli/postinstall.js b/packages/taro-cli/postinstall.js index 41f9e13ee86f..344f18d6add1 100644 --- a/packages/taro-cli/postinstall.js +++ b/packages/taro-cli/postinstall.js @@ -4,17 +4,17 @@ const axios = require('axios') axios.get('https://taro.jd.com/', { timeout: 5000 }) .then(() => { // JD内网 - console.log('*******JD内网:*******', process.cwd()) + // console.log('*******JD内网:*******') exec('taro global-config add-plugin @jdtaro/plugin-build-report-performance@latest --registry http://registry.m.jd.com', (error, stdout, stderr) => { if (error) { - console.error(`执行错误: ${error}`) + console.error(`install performance plugin error: ${error}`) return } - console.log(`stdout:{\n ${stdout} \n}`) - console.log(`stderr:{\n ${stderr} \n}`) + console.log(`install performance plugin stdout: ${stdout}`) + console.log(`install performance plugin stderr: ${stderr}`) }) }) .catch(() => { // 公网 - console.log('*******公网:*******') + // console.log('*******公网:*******') }) diff --git a/packages/taro-service/src/Config.ts b/packages/taro-service/src/Config.ts index 99f29c88554f..4865f86c88eb 100644 --- a/packages/taro-service/src/Config.ts +++ b/packages/taro-service/src/Config.ts @@ -50,8 +50,8 @@ export default class Config { this.configPath = resolveScriptPath(path.join(this.appPath, CONFIG_DIR_NAME, DEFAULT_CONFIG_FILE)) if (!fs.existsSync(this.configPath)) { if (this.disableGlobalConfig) return - // 没有项目config,说明是全局命令,只加载命令相关的插件 - this.initGlobalConfig('command') + // 没有项目config,说明是全局命令,加载所有全局插件 + this.initGlobalConfig() } else { // 有项目config,说明是Taro项目内命令,加载该命令相关的全局插件`@jdtaro/plugin-${command}...` this.initGlobalConfig(configEnv.command) From c0d3c472256fa010a9b60206b9189bb9b00f8c80 Mon Sep 17 00:00:00 2001 From: zhengyanan18 Date: Wed, 2 Apr 2025 11:35:28 +0800 Subject: [PATCH 06/11] =?UTF-8?q?fix:=20webpack4/webpack5=20h5=E7=AB=AF?= =?UTF-8?q?=E8=A1=A5=E5=85=A8modifyAppConfig=E9=92=A9=E5=AD=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/taro-service/src/Config.ts | 2 +- packages/taro-webpack-runner/src/config/dev.conf.ts | 1 + packages/taro-webpack-runner/src/config/prod.conf.ts | 1 + packages/taro-webpack-runner/src/utils/app.ts | 6 ++++++ packages/taro-webpack5-runner/src/utils/app.ts | 6 ++++++ .../taro-webpack5-runner/src/webpack/H5WebpackPlugin.ts | 1 + 6 files changed, 16 insertions(+), 1 deletion(-) diff --git a/packages/taro-service/src/Config.ts b/packages/taro-service/src/Config.ts index 4865f86c88eb..8b8f2284e840 100644 --- a/packages/taro-service/src/Config.ts +++ b/packages/taro-service/src/Config.ts @@ -35,7 +35,7 @@ export default class Config { isInitSuccess: boolean disableGlobalConfig: boolean - constructor(opts: IConfigOptions) { + constructor (opts: IConfigOptions) { this.appPath = opts.appPath this.disableGlobalConfig = !!opts?.disableGlobalConfig } diff --git a/packages/taro-webpack-runner/src/config/dev.conf.ts b/packages/taro-webpack-runner/src/config/dev.conf.ts index fc4708dc49ed..0cbc1cf0a80e 100644 --- a/packages/taro-webpack-runner/src/config/dev.conf.ts +++ b/packages/taro-webpack-runner/src/config/dev.conf.ts @@ -107,6 +107,7 @@ export default function (appPath: string, config: Partial, appHelpe /** hooks & methods */ onCompilerMake: config.onCompilerMake, onParseCreateElement: config.onParseCreateElement, + modifyAppConfig: config.modifyAppConfig }) if (enableExtract) { diff --git a/packages/taro-webpack-runner/src/config/prod.conf.ts b/packages/taro-webpack-runner/src/config/prod.conf.ts index ac9b524aacef..60d81061d9fe 100644 --- a/packages/taro-webpack-runner/src/config/prod.conf.ts +++ b/packages/taro-webpack-runner/src/config/prod.conf.ts @@ -112,6 +112,7 @@ export default function (appPath: string, config: Partial, appHelpe /** hooks & methods */ onCompilerMake: config.onCompilerMake, onParseCreateElement: config.onParseCreateElement, + modifyAppConfig: config.modifyAppConfig }) if (enableExtract) { diff --git a/packages/taro-webpack-runner/src/utils/app.ts b/packages/taro-webpack-runner/src/utils/app.ts index 26eb3d5928b6..b1fbddbe67fa 100644 --- a/packages/taro-webpack-runner/src/utils/app.ts +++ b/packages/taro-webpack-runner/src/utils/app.ts @@ -4,6 +4,7 @@ import { resolveMainFilePath, SCRIPT_EXT } from '@tarojs/helper' +import { Func } from '@tarojs/taro/types/compile' import { defaults } from 'lodash' import * as path from 'path' @@ -14,6 +15,7 @@ interface IOptions { sourceDir: string entryFileName: string frameworkExts: string[] + modifyAppConfig?: Func } type TEntry = string | string[] | Entry | EntryFunc @@ -57,6 +59,10 @@ export class AppHelper { if (isEmptyObject(appConfig)) { throw new Error('缺少 app 全局配置,请检查!') } + const { modifyAppConfig } = this.options + if (typeof modifyAppConfig === 'function') { + modifyAppConfig(appConfig) + } this.#appConfig = appConfig } return this.#appConfig as AppConfig diff --git a/packages/taro-webpack5-runner/src/utils/app.ts b/packages/taro-webpack5-runner/src/utils/app.ts index c8485550fe6e..bcc385eb676b 100644 --- a/packages/taro-webpack5-runner/src/utils/app.ts +++ b/packages/taro-webpack5-runner/src/utils/app.ts @@ -4,6 +4,7 @@ import { resolveMainFilePath, SCRIPT_EXT } from '@tarojs/helper' +import { Func } from '@tarojs/taro/types/compile' import { defaults } from 'lodash' import path from 'path' @@ -16,6 +17,7 @@ interface IOptions { frameworkExts: string[] alias: Record defineConstants: Record + modifyAppConfig?: Func } export default class AppHelper { @@ -59,6 +61,10 @@ export default class AppHelper { if (isEmptyObject(appConfig)) { throw new Error('缺少 app 全局配置,请检查!') } + const { modifyAppConfig } = this.options + if (typeof modifyAppConfig === 'function') { + modifyAppConfig(appConfig) + } this.#appConfig = appConfig } return this.#appConfig as AppConfig diff --git a/packages/taro-webpack5-runner/src/webpack/H5WebpackPlugin.ts b/packages/taro-webpack5-runner/src/webpack/H5WebpackPlugin.ts index f21a3f442a45..dbc0cf6e9e77 100644 --- a/packages/taro-webpack5-runner/src/webpack/H5WebpackPlugin.ts +++ b/packages/taro-webpack5-runner/src/webpack/H5WebpackPlugin.ts @@ -153,6 +153,7 @@ export class H5WebpackPlugin { prebundle: prebundleOptions.enable, isBuildNativeComp: this.combination.isBuildNativeComp, /** hooks & methods */ + modifyAppConfig: config.modifyAppConfig, onCompilerMake: config.onCompilerMake, onParseCreateElement: config.onParseCreateElement, } From 8c4432ecf39948f32cdc16532a45e0d24e26022f Mon Sep 17 00:00:00 2001 From: zhengyanan18 Date: Wed, 2 Apr 2025 17:08:41 +0800 Subject: [PATCH 07/11] =?UTF-8?q?refactor:=20=E7=A7=BB=E9=99=A4=E6=97=A0?= =?UTF-8?q?=E7=94=A8=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/taro-cli/postinstall.js | 9 +-------- packages/taro-service/src/Config.ts | 2 -- packages/taro-service/src/utils/index.ts | 5 +---- 3 files changed, 2 insertions(+), 14 deletions(-) diff --git a/packages/taro-cli/postinstall.js b/packages/taro-cli/postinstall.js index 344f18d6add1..0270faeeafad 100644 --- a/packages/taro-cli/postinstall.js +++ b/packages/taro-cli/postinstall.js @@ -3,18 +3,11 @@ const axios = require('axios') axios.get('https://taro.jd.com/', { timeout: 5000 }) .then(() => { - // JD内网 - // console.log('*******JD内网:*******') - exec('taro global-config add-plugin @jdtaro/plugin-build-report-performance@latest --registry http://registry.m.jd.com', (error, stdout, stderr) => { + exec('taro global-config add-plugin @jdtaro/plugin-build-report-performance@latest --registry http://registry.m.jd.com', (error, _stdout, _stderr) => { if (error) { console.error(`install performance plugin error: ${error}`) - return } - console.log(`install performance plugin stdout: ${stdout}`) - console.log(`install performance plugin stderr: ${stderr}`) }) }) .catch(() => { - // 公网 - // console.log('*******公网:*******') }) diff --git a/packages/taro-service/src/Config.ts b/packages/taro-service/src/Config.ts index 8b8f2284e840..c2ba640f6348 100644 --- a/packages/taro-service/src/Config.ts +++ b/packages/taro-service/src/Config.ts @@ -50,10 +50,8 @@ export default class Config { this.configPath = resolveScriptPath(path.join(this.appPath, CONFIG_DIR_NAME, DEFAULT_CONFIG_FILE)) if (!fs.existsSync(this.configPath)) { if (this.disableGlobalConfig) return - // 没有项目config,说明是全局命令,加载所有全局插件 this.initGlobalConfig() } else { - // 有项目config,说明是Taro项目内命令,加载该命令相关的全局插件`@jdtaro/plugin-${command}...` this.initGlobalConfig(configEnv.command) createSwcRegister({ only: [ diff --git a/packages/taro-service/src/utils/index.ts b/packages/taro-service/src/utils/index.ts index dbc4752353c6..759e20fdd7a8 100644 --- a/packages/taro-service/src/utils/index.ts +++ b/packages/taro-service/src/utils/index.ts @@ -117,21 +117,18 @@ export function printHelpLog (command, optionsList: Map, synopsi } } -// 对于全局配置,如果command为空,则返回全部。否则只返回command相关的插件和presets export function filterGlobalConfig (globalConfig: IProjectConfig, command: string) { if (!command) { return globalConfig } const config = globalConfig - // 如果有command,则只留下command相关的plugin const RelatedPluginTag = `@jdtaro/plugin-${command}` - if (config.plugins) { + if (config.plugins?.length) { config.plugins = config.plugins.filter(pluginName => { return pluginName.includes(RelatedPluginTag) }) } - // TODO:如果有presets,则只留下command相关的presets.当前无这样的需求 return config } From 814a069392d7661deccbd3d978bba54033155000 Mon Sep 17 00:00:00 2001 From: --global Date: Mon, 7 Apr 2025 14:44:25 +0800 Subject: [PATCH 08/11] =?UTF-8?q?fix:=20=E4=BD=BF=E7=94=A8=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E9=87=8C=E7=9A=84taro?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/taro-cli/postinstall.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/taro-cli/postinstall.js b/packages/taro-cli/postinstall.js index 0270faeeafad..a668b3a4b0d5 100644 --- a/packages/taro-cli/postinstall.js +++ b/packages/taro-cli/postinstall.js @@ -3,7 +3,7 @@ const axios = require('axios') axios.get('https://taro.jd.com/', { timeout: 5000 }) .then(() => { - exec('taro global-config add-plugin @jdtaro/plugin-build-report-performance@latest --registry http://registry.m.jd.com', (error, _stdout, _stderr) => { + exec('npx taro global-config add-plugin @jdtaro/plugin-build-report-performance@latest --registry http://registry.m.jd.com', (error, _stdout, _stderr) => { if (error) { console.error(`install performance plugin error: ${error}`) } From 4dd816ffd262af538d86d85e2337577ecd92d2b7 Mon Sep 17 00:00:00 2001 From: --global Date: Mon, 7 Apr 2025 21:17:37 +0800 Subject: [PATCH 09/11] =?UTF-8?q?fix:=20=E4=BF=AE=E6=AD=A3=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E5=86=85taro=E7=9A=84=E5=BC=95=E7=94=A8=E8=B7=AF?= =?UTF-8?q?=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/taro-cli/postinstall.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/taro-cli/postinstall.js b/packages/taro-cli/postinstall.js index a668b3a4b0d5..e7612d39a394 100644 --- a/packages/taro-cli/postinstall.js +++ b/packages/taro-cli/postinstall.js @@ -3,7 +3,7 @@ const axios = require('axios') axios.get('https://taro.jd.com/', { timeout: 5000 }) .then(() => { - exec('npx taro global-config add-plugin @jdtaro/plugin-build-report-performance@latest --registry http://registry.m.jd.com', (error, _stdout, _stderr) => { + exec('./bin/taro global-config add-plugin @jdtaro/plugin-build-report-performance@latest --registry http://registry.m.jd.com', (error, _stdout, _stderr) => { if (error) { console.error(`install performance plugin error: ${error}`) } From 23ddae9290d3c476e0409142da7557012b587ecf Mon Sep 17 00:00:00 2001 From: --global Date: Tue, 8 Apr 2025 21:16:30 +0800 Subject: [PATCH 10/11] =?UTF-8?q?refactor:=20review=E5=BE=AE=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/taro-cli/postinstall.js | 1 + packages/taro-service/src/utils/index.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/taro-cli/postinstall.js b/packages/taro-cli/postinstall.js index e7612d39a394..59e3b92e3eaf 100644 --- a/packages/taro-cli/postinstall.js +++ b/packages/taro-cli/postinstall.js @@ -10,4 +10,5 @@ axios.get('https://taro.jd.com/', { timeout: 5000 }) }) }) .catch(() => { + console.log('cli postinstall success too') }) diff --git a/packages/taro-service/src/utils/index.ts b/packages/taro-service/src/utils/index.ts index 759e20fdd7a8..6487b854b75d 100644 --- a/packages/taro-service/src/utils/index.ts +++ b/packages/taro-service/src/utils/index.ts @@ -123,7 +123,7 @@ export function filterGlobalConfig (globalConfig: IProjectConfig, command: strin } const config = globalConfig - const RelatedPluginTag = `@jdtaro/plugin-${command}` + const RelatedPluginTag = `@jdtaro/plugin-${command}-` if (config.plugins?.length) { config.plugins = config.plugins.filter(pluginName => { return pluginName.includes(RelatedPluginTag) From 68a3760d229cb7f2c23bf6c4c23b590a725fec67 Mon Sep 17 00:00:00 2001 From: --global Date: Tue, 8 Apr 2025 21:35:00 +0800 Subject: [PATCH 11/11] =?UTF-8?q?docs:=20=E5=BE=AE=E8=B0=83=E6=97=A5?= =?UTF-8?q?=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/taro-cli/postinstall.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/taro-cli/postinstall.js b/packages/taro-cli/postinstall.js index 59e3b92e3eaf..ab62d8909e5c 100644 --- a/packages/taro-cli/postinstall.js +++ b/packages/taro-cli/postinstall.js @@ -8,7 +8,7 @@ axios.get('https://taro.jd.com/', { timeout: 5000 }) console.error(`install performance plugin error: ${error}`) } }) + console.log('cli postinstall success') }) .catch(() => { - console.log('cli postinstall success too') })