Make sure fix lockfile uses the correct file path

This commit is contained in:
bumi 2019-06-17 09:38:47 +02:00
parent 32a123a825
commit 1702c22084

View File

@ -5,6 +5,7 @@
// https://github.com/aragon/aragon-cli/blob/master/docs-internal/Dependencies.md#regenerate-the-lockfiles // https://github.com/aragon/aragon-cli/blob/master/docs-internal/Dependencies.md#regenerate-the-lockfiles
const fs = require('fs') const fs = require('fs')
const path = require('path')
function replaceAll(string, mapObject) { function replaceAll(string, mapObject) {
const regex = new RegExp(Object.keys(mapObject).join('|'), 'gi') const regex = new RegExp(Object.keys(mapObject).join('|'), 'gi')
@ -21,11 +22,12 @@ async function fixLockfile(path, replacementMap) {
const originalText = JSON.stringify(originalJson, null, 2) const originalText = JSON.stringify(originalJson, null, 2)
const fixedText = replaceAll(originalText, replacementMap) const fixedText = replaceAll(originalText, replacementMap)
const fixedJson = JSON.parse(fixedText) const fixedJson = JSON.parse(fixedText)
console.log('writing file', path);
await fs.writeFileSync(path, JSON.stringify(fixedJson, null, 2)) await fs.writeFileSync(path, JSON.stringify(fixedJson, null, 2))
} }
// //
const LOCKFILE_PATH = '../package-lock.json' const LOCKFILE_PATH = path.join(__dirname, '..', 'package-lock.json')
const replacementMap = { const replacementMap = {
// //