Remove unused package-lock.json files before building

This commit is contained in:
lee-dohm 2018-01-04 12:54:28 -08:00
parent c97e8f084c
commit fa96a90e12
No known key found for this signature in database
GPG Key ID: A27E146D71F5F6B6
2 changed files with 19 additions and 0 deletions

View File

@ -58,6 +58,7 @@ const CONFIG = require('./config')
let binariesPromise = Promise.resolve()
if (!argv.existingBinaries) {
cleanPackageLock()
checkChromedriverVersion()
cleanOutputDirectory()
copyAssets()

View File

@ -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)
}
}