mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-28 23:06:37 +01:00
466ece4588
This reverts commit1110287fe1
, reversing changes made to72eb233ee9
.
29 lines
1.1 KiB
JavaScript
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}`)
|
|
})
|
|
})
|