diff options
Diffstat (limited to 'scripts/frontend/block_dependencies.js')
-rw-r--r-- | scripts/frontend/block_dependencies.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/scripts/frontend/block_dependencies.js b/scripts/frontend/block_dependencies.js new file mode 100644 index 00000000000..c9257c9f72b --- /dev/null +++ b/scripts/frontend/block_dependencies.js @@ -0,0 +1,21 @@ +const path = require('path'); +const packageJson = require(path.join(process.cwd(), 'package.json')); +const blockedDependencies = packageJson.blockedDependencies || {}; +const dependencies = packageJson.dependencies; +const devDependencies = packageJson.devDependencies; +const blockedDependenciesNames = Object.keys(blockedDependencies); +const blockedDependenciesFound = blockedDependenciesNames.filter( + blockedDependency => dependencies[blockedDependency] || devDependencies[blockedDependency], +); + +if (blockedDependenciesFound.length) { + console.log('The following package.json dependencies are not allowed:'); + + blockedDependenciesFound.forEach(blockedDependency => { + const infoLink = blockedDependencies[blockedDependency]; + + console.log(`- ${blockedDependency}: See ${infoLink} for more information.`); + }); + + process.exit(-1); +} |