facebook/fbjs

[fbjs-scripts] gulp/check-dependencies breaks with resolutionDependencies

Closed this issue · 0 comments

I just had a weird breakage while upgrading dependencies of draft-js:

[11:07:47] TypeError: Cannot read property 'natives' of undefined
    at /Users/procidac/Development/gh/claudiopro/draft-js/node_modules/fbjs-scripts/gulp/check-dependencies.js:53:38
    at Array.forEach (<anonymous>)
    at ChildProcess.<anonymous> (/Users/procidac/Development/gh/claudiopro/draft-js/node_modules/fbjs-scripts/gulp/check-dependencies.js:49:20)
    at emitTwo (events.js:126:13)
    at ChildProcess.emit (events.js:214:7)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
[11:07:47] 'check-dependencies' errored after 837 ms

See Travis CI build failure here: https://travis-ci.org/facebook/draft-js/jobs/503030214

Debugging information

Here's the full list of outdated data reported by check-dependencies:

babel-eslint,7.2.3,7.2.3,10.0.1,devDependencies,https://github.com/babel/babel-eslint
del,2.2.2,2.2.2,4.0.0,devDependencies,https://github.com/sindresorhus/del#readme
envify,3.4.1,3.4.1,4.1.0,devDependencies,https://github.com/hughsk/envify#readme
es6-shim,0.34.4,0.34.4,0.35.4,devDependencies,https://github.com/paulmillr/es6-shim/
eslint,4.19.1,4.19.1,5.15.1,devDependencies,https://eslint.org
eslint-config-prettier,2.10.0,2.10.0,4.1.0,devDependencies,https://github.com/prettier/eslint-config-prettier#readme
eslint-plugin-babel,4.1.2,4.1.2,5.3.0,devDependencies,https://github.com/babel/eslint-plugin-babel#readme
eslint-plugin-flowtype,2.50.3,2.50.3,3.4.2,devDependencies,https://github.com/gajus/eslint-plugin-flowtype#readme
eslint-plugin-prettier,2.7.0,2.7.0,3.0.1,devDependencies,https://github.com/prettier/eslint-plugin-prettier#readme
eslint-plugin-relay,0.0.8,0.0.8,1.0.0,devDependencies,https://github.com/relayjs/eslint-plugin-relay.git
flow-bin,0.92.1,0.92.1,0.94.0,devDependencies,https://github.com/flowtype/flow-bin#readme
gulp-clean-css,2.4.0,2.4.0,4.0.0,devDependencies,https://github.com/scniro/gulp-clean-css#readme
gulp-concat-css,2.3.0,2.3.0,3.1.0,devDependencies,https://github.com/mariocasciaro/gulp-concat-css
gulp-flatten,0.2.0,0.2.0,0.4.0,devDependencies,https://github.com/armed/gulp-flatten
gulp-header,1.8.2,1.8.2,2.0.7,devDependencies,https://github.com/tracker1/gulp-header#readme
gulp-uglify,1.5.4,1.5.4,3.0.2,devDependencies,https://github.com/terinjokes/gulp-uglify/
immutable,3.7.6,3.7.6,4.0.0-rc.12,dependencies,https://facebook.github.com/immutable-js
natives,1.1.3,1.1.3,1.1.6,resolutionDependencies,https://github.com/addaleax/natives#readme
prettier,1.13.6,1.13.6,1.16.4,devDependencies,https://prettier.io
stats-webpack-plugin,0.6.2,0.6.2,0.7.0,devDependencies,https://github.com/unindented/stats-webpack-plugin#readme
through2,2.0.5,2.0.5,3.0.1,devDependencies,https://github.com/rvagg/through2#readme
uglifyjs-webpack-plugin,1.3.0,1.3.0,2.1.2,devDependencies,https://github.com/webpack-contrib/uglifyjs-webpack-plugin
webpack-stream,4.0.3,4.0.3,5.2.1,devDependencies,https://github.com/shama/webpack-stream

The culprit seems to be this line looking for a nested property of an undefined resolutionDependencies property:

      outdatedData.forEach(function(row) {
        var name = row[0];
        var current = row[1];
        var type = row[4];
        var requested = pkgData[type][name]; // <-- TypeError: Cannot read property 'natives' of undefined

while package.json has a resolutions field:

  "resolutions": {
    "gulp/**/natives": "1.1.3"
  },

Found while authoring facebookarchive/draft-js#2027