@npmcli/arborist 5.2.3 → 5.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -22,6 +22,7 @@ const moveFile = require('@npmcli/move-file')
22
22
  const rimraf = promisify(require('rimraf'))
23
23
  const PackageJson = require('@npmcli/package-json')
24
24
  const packageContents = require('@npmcli/installed-package-contents')
25
+ const runScript = require('@npmcli/run-script')
25
26
  const { checkEngine, checkPlatform } = require('npm-install-checks')
26
27
  const _force = Symbol.for('force')
27
28
 
@@ -1516,6 +1517,30 @@ module.exports = cls => class Reifier extends cls {
1516
1517
 
1517
1518
  if (!this[_global]) {
1518
1519
  await this.actualTree.meta.save()
1520
+ const ignoreScripts = !!this.options.ignoreScripts
1521
+ // if we aren't doing a dry run or ignoring scripts and we actually made changes to the dep
1522
+ // tree, then run the dependencies scripts
1523
+ if (!this[_dryRun] && !ignoreScripts && this.diff && this.diff.children.length) {
1524
+ const { path, package: pkg } = this.actualTree.target
1525
+ const stdio = this.options.foregroundScripts ? 'inherit' : 'pipe'
1526
+ const { scripts = {} } = pkg
1527
+ for (const event of ['predependencies', 'dependencies', 'postdependencies']) {
1528
+ if (Object.prototype.hasOwnProperty.call(scripts, event)) {
1529
+ const timer = `reify:run:${event}`
1530
+ process.emit('time', timer)
1531
+ log.info('run', pkg._id, event, scripts[event])
1532
+ await runScript({
1533
+ event,
1534
+ path,
1535
+ pkg,
1536
+ stdioString: true,
1537
+ stdio,
1538
+ scriptShell: this.options.scriptShell,
1539
+ })
1540
+ process.emit('timeEnd', timer)
1541
+ }
1542
+ }
1543
+ }
1519
1544
  }
1520
1545
  }
1521
1546
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@npmcli/arborist",
3
- "version": "5.2.3",
3
+ "version": "5.3.0",
4
4
  "description": "Manage node_modules trees",
5
5
  "dependencies": {
6
6
  "@isaacs/string-locale-compare": "^1.1.0",