C. Scott Ananian has submitted this change and it was merged. Change subject: Synchronize package.json unification code with wmf-deploy branch. ......................................................................
Synchronize package.json unification code with wmf-deploy branch. This is a cherry-pick of 4533acd571ec9a5114a1a53233552c16a298d4fe. Change-Id: I7baf0f84ae8b8b0627d68107033a860623684858 --- M Makefile M unify-package-json.js 2 files changed, 29 insertions(+), 8 deletions(-) Approvals: C. Scott Ananian: Verified; Looks good to me, approved diff --git a/Makefile b/Makefile index b591b28..3ff2eab 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ core: export LINK=g++ rm -f ./package.json - npm install prfun semver + npm install core-js@0.9.x prfun@2.1.x semver@4.1.x $(NODE) ./unify-package-json.js npm install npm update diff --git a/unify-package-json.js b/unify-package-json.js index 9dbfaf0..1b99a77 100755 --- a/unify-package-json.js +++ b/unify-package-json.js @@ -11,17 +11,26 @@ * library (since we want to use fancy non-standard Promise features). */ +var haveAllPackages = true; +['core-js','prfun','semver'].forEach(function(pkg) { + try { + require(pkg); + } catch (err) { + console.err( "The '"+pkg+"' library could not be loaded. Please `npm install "+pkg+"`" ); + haveAllPackages = false; + } +}); +if (!haveAllPackages) { + process.exit(1); +} + +require('core-js'); // for Map/Set var child_process = require( 'child_process' ), semver = require( 'semver' ), fs = require( 'fs' ), path = require( 'path' ), - util = require( 'util' ); - -try { - require('prfun/smash'); -} catch ( err ) { - console.err( "The 'prfun' library could not be loaded. Please `npm install prfun`") -} + util = require( 'util' ), + Promise = require( 'prfun' ); function findPackageJson() { var readdir = Promise.promisify(fs.readdir, false, fs); @@ -94,6 +103,18 @@ optdeps = iterate( 'optionalDependencies', packageObjs ); console.info( 'Unifying unified development dependencies' ); glodevdeps = iterate( 'devDependencies', packageObjs ); + // Hack around the 'mw-ocg-bundler' dev dependency; don't make it global + delete glodevdeps['mw-ocg-bundler']; + // Remove optional and dev dependencies if they are already in dependencies + // (In particular we need to remove the `request` package from + // devDependencies so that `npm prune --production` doesn't delete it!) + [ optdeps, glodevdeps ].forEach( function( d ) { + Object.keys(d).forEach( function( pkg ) { + if ( d[pkg] === glodeps[pkg] ) { + delete d[pkg]; + } + } ); + } ); return { 'dependencies': glodeps, -- To view, visit https://gerrit.wikimedia.org/r/313912 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I7baf0f84ae8b8b0627d68107033a860623684858 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/services/ocg-collection Gerrit-Branch: master Gerrit-Owner: C. Scott Ananian <canan...@wikimedia.org> Gerrit-Reviewer: Arlolra <abrea...@wikimedia.org> Gerrit-Reviewer: C. Scott Ananian <canan...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits