From fa96a90e12b82b87987a79caa4d2bd72e3189423 Mon Sep 17 00:00:00 2001 From: lee-dohm <1038121+lee-dohm@users.noreply.github.com> Date: Thu, 4 Jan 2018 12:54:28 -0800 Subject: [PATCH 1/2] Remove unused package-lock.json files before building --- script/build | 1 + script/lib/clean-package-lock.js | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 script/lib/clean-package-lock.js diff --git a/script/build b/script/build index acc54cdac..48c82d0a7 100755 --- a/script/build +++ b/script/build @@ -58,6 +58,7 @@ const CONFIG = require('./config') let binariesPromise = Promise.resolve() if (!argv.existingBinaries) { + cleanPackageLock() checkChromedriverVersion() cleanOutputDirectory() copyAssets() diff --git a/script/lib/clean-package-lock.js b/script/lib/clean-package-lock.js new file mode 100644 index 000000000..01376c9c5 --- /dev/null +++ b/script/lib/clean-package-lock.js @@ -0,0 +1,18 @@ +// This module exports a function that deletes all `package-lock.json` files that do +// not exist under a `node_modules` directory. + +'use strict' + +const CONFIG = require('../config') +const fs = require('fs-extra') +const glob = require('glob') +const path = require('path') + +module.exports = function () { + console.log('Deleting problematic package-lock.json files') + let paths = glob.sync(path.join(CONFIG.repositoryRootPath, '**', 'package-lock.json'), {ignore: path.join('**', 'node_modules', '**')}) + + for (let path of paths) { + fs.unlinkSync(path) + } +} From 1aeff19eabe605fb7b508d7f5d82b2a6384e9df3 Mon Sep 17 00:00:00 2001 From: lee-dohm <1038121+lee-dohm@users.noreply.github.com> Date: Thu, 4 Jan 2018 13:02:21 -0800 Subject: [PATCH 2/2] Forgot to check in the require --- script/build | 1 + 1 file changed, 1 insertion(+) diff --git a/script/build b/script/build index 48c82d0a7..55cebe96d 100755 --- a/script/build +++ b/script/build @@ -28,6 +28,7 @@ const argv = yargs const checkChromedriverVersion = require('./lib/check-chromedriver-version') const cleanOutputDirectory = require('./lib/clean-output-directory') +const cleanPackageLock = require('./lib/clean-package-lock') const codeSignOnMac = require('./lib/code-sign-on-mac') const codeSignOnWindows = require('./lib/code-sign-on-windows') const compressArtifacts = require('./lib/compress-artifacts')