Skip to content
This repository has been archived by the owner on Aug 11, 2022. It is now read-only.

Commit

Permalink
actions,diff-trees: rebuild bundles via npm3 mechanisms
Browse files Browse the repository at this point in the history
Previously this was being done implicitly via `build.linkStuff`– we're now
avoiding that.

PR-URL: #9891
Fixes: #9643
Fixes: #9664
  • Loading branch information
iarna committed Oct 8, 2015
1 parent 5ae842d commit 2289234
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/install/action/build.js
Expand Up @@ -6,7 +6,7 @@ var npm = require('../../npm.js')
module.exports = function (top, buildpath, pkg, log, next) {
log.silly('build', pkg.package.name)
chain([
[build.linkStuff, pkg.package, pkg.path, npm.config.get('global'), false],
[build.linkStuff, pkg.package, pkg.path, npm.config.get('global'), true],
[build.writeBuiltinConf, pkg.package, pkg.path]
], next)
}
13 changes: 12 additions & 1 deletion lib/install/decompose-actions.js
Expand Up @@ -10,11 +10,14 @@ module.exports = function (differences, decomposed, next) {
switch (cmd) {
case 'add':
case 'update':
addSteps(decomposed, pkg, done)
addSteps(decomposed, pkg, done)
break
case 'move':
moveSteps(decomposed, pkg, done)
break
case 'rebuild':
rebuildSteps(decomposed, pkg, done)
break
case 'remove':
case 'update-linked':
default:
Expand Down Expand Up @@ -44,6 +47,14 @@ function moveSteps (decomposed, pkg, done) {
done()
}

function rebuildSteps (decomposed, pkg, done) {
decomposed.push(['preinstall', pkg])
decomposed.push(['build', pkg])
decomposed.push(['install', pkg])
decomposed.push(['postinstall', pkg])
done()
}

function defaultSteps (decomposed, cmd, pkg, done) {
decomposed.push([cmd, pkg])
done()
Expand Down
6 changes: 4 additions & 2 deletions lib/install/diff-trees.js
@@ -1,6 +1,7 @@
'use strict'
var validate = require('aproba')
var npa = require('npm-package-arg')
var npm = require('../npm.js')
var flattenTree = require('./flatten-tree.js')

function nonRegistrySource (pkg) {
Expand Down Expand Up @@ -129,8 +130,9 @@ function diffTrees (oldTree, newTree) {
pkg.isInLink = (pkg.oldPkg && isLink(pkg.oldPkg.parent)) ||
(pkg.parent && isLink(pkg.parent)) ||
requiredByAllLinked(pkg)
if (pkg.fromBundle) return
if (pkg.oldPkg) {
if (pkg.fromBundle) {
if (npm.config.get('rebuild-bundle')) differences.push(['rebuild', pkg])
} else if (pkg.oldPkg) {
if (!pkg.directlyRequested && pkgAreEquiv(pkg.oldPkg.package, pkg.package)) return
if (!pkg.isInLink && (isLink(pkg.oldPkg) || isLink(pkg))) {
differences.push(['update-linked', pkg])
Expand Down

0 comments on commit 2289234

Please sign in to comment.