Skip to content

Commit 287e851

Browse files
author
zhengyanan18
committed
refactor: 移除无用代码
1 parent 4664176 commit 287e851

File tree

3 files changed

+1
-13
lines changed

3 files changed

+1
-13
lines changed

Diff for: packages/taro-cli/postinstall.js

+1-8
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,11 @@ const axios = require('axios')
33

44
axios.get('https://taro.jd.com/', { timeout: 5000 })
55
.then(() => {
6-
// JD内网
7-
// console.log('*******JD内网:*******')
8-
exec('taro global-config add-plugin @jdtaro/plugin-build-report-performance@latest --registry http://registry.m.jd.com', (error, stdout, stderr) => {
6+
exec('taro global-config add-plugin @jdtaro/plugin-build-report-performance@latest --registry http://registry.m.jd.com', (error, _stdout, _stderr) => {
97
if (error) {
108
console.error(`install performance plugin error: ${error}`)
11-
return
129
}
13-
console.log(`install performance plugin stdout: ${stdout}`)
14-
console.log(`install performance plugin stderr: ${stderr}`)
1510
})
1611
})
1712
.catch(() => {
18-
// 公网
19-
// console.log('*******公网:*******')
2013
})

Diff for: packages/taro-service/src/Config.ts

-2
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,8 @@ export default class Config {
5050
this.configPath = resolveScriptPath(path.join(this.appPath, CONFIG_DIR_NAME, DEFAULT_CONFIG_FILE))
5151
if (!fs.existsSync(this.configPath)) {
5252
if (this.disableGlobalConfig) return
53-
// 没有项目config,说明是全局命令,加载所有全局插件
5453
this.initGlobalConfig()
5554
} else {
56-
// 有项目config,说明是Taro项目内命令,加载该命令相关的全局插件`@jdtaro/plugin-${command}...`
5755
this.initGlobalConfig(configEnv.command)
5856
createSwcRegister({
5957
only: [

Diff for: packages/taro-service/src/utils/index.ts

-3
Original file line numberDiff line numberDiff line change
@@ -117,21 +117,18 @@ export function printHelpLog (command, optionsList: Map<string, string>, synopsi
117117
}
118118
}
119119

120-
// 对于全局配置,如果command为空,则返回全部。否则只返回command相关的插件和presets
121120
export function filterGlobalConfig (globalConfig: IProjectConfig, command: string) {
122121
if (!command) {
123122
return globalConfig
124123
}
125124
const config = globalConfig
126125

127-
// 如果有command,则只留下command相关的plugin
128126
const RelatedPluginTag = `@jdtaro/plugin-${command}`
129127
if (config.plugins) {
130128
config.plugins = config.plugins.filter(pluginName => {
131129
return pluginName.includes(RelatedPluginTag)
132130
})
133131
}
134132

135-
// TODO:如果有presets,则只留下command相关的presets.当前无这样的需求
136133
return config
137134
}

0 commit comments

Comments
 (0)