@@ -7,6 +7,8 @@ var checkPlatform = npmInstallChecks.checkPlatform
7
7
var checkGit = npmInstallChecks . checkGit
8
8
var asyncMap = require ( 'slide' ) . asyncMap
9
9
var chain = require ( 'slide' ) . chain
10
+ var clone = require ( 'lodash.clonedeep' )
11
+ var normalizePackageData = require ( 'normalize-package-data' )
10
12
var npm = require ( '../npm.js' )
11
13
var andFinishTracker = require ( './and-finish-tracker.js' )
12
14
var flattenTree = require ( './flatten-tree.js' )
@@ -28,7 +30,7 @@ module.exports = function (idealTree, log, next) {
28
30
mod . parent && ! isInLink ( mod ) && [ checkGit , mod . realpath ] ,
29
31
[ checkErrors , mod , idealTree ]
30
32
] , done )
31
- } , andValidateAllPeerDeps ( idealTree , andFinishTracker ( log , next ) ) )
33
+ } , andValidateAllPeerDeps ( idealTree , andCheckTop ( idealTree , andFinishTracker ( log , next ) ) ) )
32
34
}
33
35
34
36
function isInLink ( mod ) {
@@ -54,3 +56,24 @@ function andValidateAllPeerDeps (idealTree, next) {
54
56
next ( er )
55
57
}
56
58
}
59
+
60
+ function andCheckTop ( idealTree , next ) {
61
+ validate ( 'OF' , arguments )
62
+ if ( idealTree . package . error ) {
63
+ return next
64
+ } else {
65
+ return function ( er ) {
66
+ // FIXME: when we replace read-package-json with something less magic,
67
+ // this should done elsewhere.
68
+ // As it is, the package has already been normalized and thus some
69
+ // errors are suppressed.
70
+ var pkg = clone ( idealTree . package )
71
+ normalizePackageData ( pkg , function ( warn ) {
72
+ var warnObj = new Error ( pkg . _id + ' ' + warn )
73
+ warnObj . code = 'EPACKAGEJSON'
74
+ idealTree . warnings . push ( warnObj )
75
+ } , false )
76
+ next ( er )
77
+ }
78
+ }
79
+ }
0 commit comments