Skip to content

Commit 6826a91

Browse files
committed
【fix】Dependency check util
1 parent 061db9d commit 6826a91

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

build/webpack.config.base.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,14 @@ const pkg = require('../package.json');
77

88
function compareDependencies(pkgName, dependenciesToCompare, rootDependencies = pkg.dependencies) {
99
Object.keys(dependenciesToCompare).forEach(name => {
10-
if (!rootDependencies[name] || rootDependencies[name] !== dependenciesToCompare[name]) {
10+
if(!rootDependencies[name]){
11+
console.log(chalk.red(`Dependency error [${pkgName}]: The dependency ${name} not in root package.json!\n`));
12+
}
13+
if (rootDependencies[name] !== dependenciesToCompare[name]) {
1114
if (rootDependencies[name].includes('file:src/')){
1215
return;
1316
}
14-
console.log(chalk.red(`ERROR [${pkgName}]: The dependency ${name} version can not match in root package.json!\n`));
17+
console.log(chalk.red(`Dependency error [${pkgName}]: The dependency ${name} version can not match in root package.json!\n`));
1518
}
1619
});
1720
}
@@ -24,7 +27,7 @@ function checkRootDependencies(dependenciesToCompare, rootDependencies = pkg.dep
2427
return;
2528
}
2629
if (!clientDepsList.some(deps => Object.keys(deps).some(item => item === name))) {
27-
console.log(chalk.red(`ERROR: The dependency ${name} version can not match in (${clientNames.join('|')}) package.json!\n`));
30+
console.log(chalk.red(`Dependency error: The dependency ${name} version can not match in (${clientNames.join('|')}) package.json!\n`));
2831
}
2932
});
3033
}

0 commit comments

Comments
 (0)