diff --git a/admin/cmds/lock-versions.js b/admin/cmds/lock-versions.js new file mode 100644 index 000000000..81a1274f7 --- /dev/null +++ b/admin/cmds/lock-versions.js @@ -0,0 +1,41 @@ +"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) => { + if (versions[name] == null) { return; } + const value = ">=" + versions[name]; + if (value !== deps[name]) + if (!deps[name]) { return; } + if (!shown) { + log(``); + shown = true; + } + log(` : ${ deps[name] } => `); + deps[name] = value; + }); + }); + savePackage(dirname, info); + }); + +})(); diff --git a/admin/cmds/update-versions.js b/admin/cmds/update-versions.js index e7031847e..9c245e219 100644 --- a/admin/cmds/update-versions.js +++ b/admin/cmds/update-versions.js @@ -51,14 +51,6 @@ if (process.argv.length > 2) { // Get local package.json (update the tarballHash) let info = await updatePackage(dirname); - /* - let info = await updatePackage(dirname, { - repository: { - type: "git", - url: "git://github.com/ethers-io/ethers.js.git" - } - }); - */ // Get the remote package.json (or sub in a placeholder for new pacakges) let npmInfo = await getPackageVersion(info.name);