2019-09-01 06:58:54 +03:00
|
|
|
"use strict";
|
|
|
|
|
|
|
|
const { getOrdered, loadPackage } = require("../depgraph");
|
|
|
|
const { savePackage } = require("../local");
|
|
|
|
const { log } = require("../log");
|
|
|
|
|
|
|
|
(async function() {
|
|
|
|
let versions = { };
|
|
|
|
|
|
|
|
const dirnames = getOrdered();
|
|
|
|
|
|
|
|
dirnames.forEach((dirname) => {
|
|
|
|
let info = loadPackage(dirname);
|
|
|
|
if (info.name.split("/")[0] === "@ethersproject" || info.name === "ethers") {
|
|
|
|
versions[info.name] = info.version;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
dirnames.forEach((dirname) => {
|
|
|
|
const info = loadPackage(dirname);
|
|
|
|
let shown = false;
|
|
|
|
["dependencies", "devDependencies"].forEach((key) => {
|
|
|
|
const deps = info[key];
|
|
|
|
if (!deps) { return; }
|
|
|
|
Object.keys(deps).forEach((name) => {
|
2020-06-13 06:59:06 +03:00
|
|
|
// Not a package in this monorepoa
|
|
|
|
const version = versions[name];
|
|
|
|
if (version == null) { return; }
|
|
|
|
|
|
|
|
const value = ((version.indexOf("beta") !== -1) ? ">=": "^") + version;
|
|
|
|
|
|
|
|
// No change
|
|
|
|
if (value === deps[name]) { return; }
|
|
|
|
|
|
|
|
// Show a header for the first change
|
2019-09-01 06:58:54 +03:00
|
|
|
if (!shown) {
|
|
|
|
log(`<bold:Locking ${ info.name }:>`);
|
|
|
|
shown = true;
|
|
|
|
}
|
2020-06-13 06:59:06 +03:00
|
|
|
|
|
|
|
// Show the locked version
|
|
|
|
log(` <green:${ name }>: ${ deps[name] } => <bold:${ value.replace(">", ">") }>`);
|
2019-09-01 06:58:54 +03:00
|
|
|
deps[name] = value;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
savePackage(dirname, info);
|
|
|
|
});
|
|
|
|
|
|
|
|
})();
|