Skip to content

Commit

Permalink
Added lock-versions admin tool.
Browse files Browse the repository at this point in the history
  • Loading branch information
ricmoo committed Sep 1, 2019
1 parent 85b4db7 commit 2187604
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 8 deletions.
41 changes: 41 additions & 0 deletions admin/cmds/lock-versions.js
Original file line number Diff line number Diff line change
@@ -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(`<bold:Locking ${ info.name }:>`);
shown = true;
}
log(` <green:${ name }>: ${ deps[name] } => <bold:${ value.substring(2) }>`);
deps[name] = value;
});
});
savePackage(dirname, info);
});

})();
8 changes: 0 additions & 8 deletions admin/cmds/update-versions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 2187604

Please sign in to comment.