Skip to content

Commit

Permalink
fix(cli): 修复编译 ui 库及 plugin 时报错的问题,close #4965
Browse files Browse the repository at this point in the history
  • Loading branch information
luckyadam committed Dec 2, 2019
1 parent a42bc6e commit 36ef638
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
1 change: 0 additions & 1 deletion packages/taro-cli/src/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export default async function build (appPath, buildConfig: IBuildConfig) {
} else if (type !== BUILD_TYPES.H5 && (type !== BUILD_TYPES.QUICKAPP || !watch)) {
Util.emptyDirectory(outputPath)
}
await Util.checkCliAndFrameworkVersion(appPath, type)
switch (type) {
case BUILD_TYPES.H5:
buildForH5(appPath, { watch, port })
Expand Down
4 changes: 3 additions & 1 deletion packages/taro-cli/src/h5/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ import {
promoteRelativePath,
recursiveMerge,
replaceAliasPath,
resolveScriptPath
resolveScriptPath,
checkCliAndFrameworkVersion
} from '../util'
import {
convertAstExpressionToVariable as toVar,
Expand Down Expand Up @@ -1452,6 +1453,7 @@ export { Compiler }

export async function build (appPath: string, buildConfig: IBuildConfig) {
process.env.TARO_ENV = BUILD_TYPES.H5
await checkCliAndFrameworkVersion(appPath, BUILD_TYPES.H5)
const compiler = new Compiler(appPath)
await compiler.clean()
await compiler.buildTemp()
Expand Down
4 changes: 3 additions & 1 deletion packages/taro-cli/src/mini/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ import {
unzip,
shouldUseYarn,
shouldUseCnpm,
resolvePureScriptPath
resolvePureScriptPath,
checkCliAndFrameworkVersion
} from '../util'
import { processTypeEnum, BUILD_TYPES } from '../util/constants'
import { IMiniAppBuildConfig } from '../util/types'
Expand Down Expand Up @@ -265,6 +266,7 @@ export async function build (
const buildData = envHasBeenSet ? getBuildData() : setBuildData(appPath, adapter)
const isQuickApp = adapter === BUILD_TYPES.QUICKAPP
let quickappJSON
await checkCliAndFrameworkVersion(appPath, adapter)
process.env.TARO_ENV = adapter
if (!envHasBeenSet) {
setIsProduction(process.env.NODE_ENV === 'production' || !watch)
Expand Down
3 changes: 2 additions & 1 deletion packages/taro-cli/src/rn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -343,8 +343,9 @@ function installDep (path: string) {
export { Compiler }

export async function build (appPath: string, buildConfig: IBuildConfig) {
const {watch} = buildConfig
const { watch } = buildConfig
process.env.TARO_ENV = BUILD_TYPES.RN
await Util.checkCliAndFrameworkVersion(appPath, BUILD_TYPES.RN)
const compiler = new Compiler(appPath)
fs.ensureDirSync(compiler.tempPath)
const t0 = performance.now()
Expand Down
3 changes: 2 additions & 1 deletion packages/taro-cli/src/util/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,8 @@ export async function checkCliAndFrameworkVersion (appPath, buildAdapter) {
process.exit(1)
}
} else {
printLog(processTypeEnum.WARNING, '依赖安装', chalk.red(`项目依赖 ${frameworkName} 未安装,或安装有误!`))
printLog(processTypeEnum.WARNING, '依赖安装', chalk.red(`项目依赖 ${frameworkName} 未安装,或安装有误,请重新安装此依赖!`))
process.exit(1)
}
}

Expand Down

0 comments on commit 36ef638

Please sign in to comment.