1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 01:39:44 +01:00
metamask-extension/development/show-deps-install-scripts.js
kumavis e1efb4d7ac
ci - install deps - limit install scripts to whitelist (#7208)
* ci - install deps - limit install scripts to those needed for build

* Update .circleci/scripts/deps-install.sh

Co-Authored-By: Mark Stacey <markjstacey@gmail.com>

* ci - install deps - expand install scripts needed for tests

* ci - install deps - expand install scripts needed for integration tests

* ci - install deps - fix node-sass script ref

* github - set codeowners for scripts/deps-install

* development - add utility to show deps with install scripts

* lint fix

* deps - move read-installed to devDeps
2019-09-25 20:01:10 +08:00

29 lines
1.1 KiB
JavaScript

// This script lists all dependencies that have package install scripts
const path = require('path')
const readInstalled = require('read-installed')
const installScripts = ['preinstall', 'install', 'postinstall']
readInstalled('./', { dev: true }, function (err, data) {
if (err) throw err
const deps = data.dependencies
Object.entries(deps).forEach(([packageName, packageData]) => {
const packageScripts = packageData.scripts || {}
const scriptKeys = Reflect.ownKeys(packageScripts)
const hasInstallScript = installScripts.some(installKey => scriptKeys.includes(installKey))
if (!hasInstallScript) return
const matchingScripts = {}
if (packageScripts.preinstall) matchingScripts.preinstall = packageScripts.preinstall
if (packageScripts.install) matchingScripts.install = packageScripts.install
if (packageScripts.postinstall) matchingScripts.postinstall = packageScripts.postinstall
const scriptNames = Reflect.ownKeys(matchingScripts)
const relativePath = path.relative(process.cwd(), packageData.path)
console.log(`${packageName}: ${relativePath} ${scriptNames}`)
})
})