2021-03-10 10:09:11 -05:00
|
|
|
const packageJson = require('../../package.json');
|
|
|
|
|
2020-03-02 13:07:42 -05:00
|
|
|
const blockedDependencies = packageJson.blockedDependencies || {};
|
2021-03-10 10:09:11 -05:00
|
|
|
const { dependencies } = packageJson;
|
|
|
|
const { devDependencies } = packageJson;
|
2020-03-02 13:07:42 -05:00
|
|
|
const blockedDependenciesNames = Object.keys(blockedDependencies);
|
|
|
|
const blockedDependenciesFound = blockedDependenciesNames.filter(
|
2020-12-23 16:10:24 -05:00
|
|
|
(blockedDependency) => dependencies[blockedDependency] || devDependencies[blockedDependency],
|
2020-03-02 13:07:42 -05:00
|
|
|
);
|
|
|
|
|
|
|
|
if (blockedDependenciesFound.length) {
|
|
|
|
console.log('The following package.json dependencies are not allowed:');
|
|
|
|
|
2020-12-23 16:10:24 -05:00
|
|
|
blockedDependenciesFound.forEach((blockedDependency) => {
|
2020-03-02 13:07:42 -05:00
|
|
|
const infoLink = blockedDependencies[blockedDependency];
|
|
|
|
|
|
|
|
console.log(`- ${blockedDependency}: See ${infoLink} for more information.`);
|
|
|
|
});
|
|
|
|
|
|
|
|
process.exit(-1);
|
|
|
|
}
|