fix(bazel): http_archive url not updated

This commit is contained in:
Dmitry 2019-03-19 10:57:50 +02:00 committed by Rhys Arkins
parent 6eec81fc49
commit bc997ce82e

View file

@ -60,7 +60,9 @@ async function updateDependency(fileContent, upgrade) {
.createHash('sha256')
.update(file)
.digest('hex');
const currentPattern = /(urls\s*=\s*\[")[^"]+("])/;
const currentPattern = upgrade.def.includes('urls')
? /(urls\s*=\s*\[")[^"]+("])/
: /(url\s*=\s*")[^"]+(")/;
newDef = upgrade.def.replace(currentPattern, `$1${newUrl}$2`);
newDef = newDef.replace(/(sha256\s*=\s*)"[^"]+"/, `$1"${hash}"`);
newDef = newDef.replace(