Added lock-versions admin tool.
This commit is contained in:
parent
85b4db7d6d
commit
2187604913
41
admin/cmds/lock-versions.js
Normal file
41
admin/cmds/lock-versions.js
Normal file
@ -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);
|
||||||
|
});
|
||||||
|
|
||||||
|
})();
|
@ -51,14 +51,6 @@ if (process.argv.length > 2) {
|
|||||||
|
|
||||||
// Get local package.json (update the tarballHash)
|
// Get local package.json (update the tarballHash)
|
||||||
let info = await updatePackage(dirname);
|
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)
|
// Get the remote package.json (or sub in a placeholder for new pacakges)
|
||||||
let npmInfo = await getPackageVersion(info.name);
|
let npmInfo = await getPackageVersion(info.name);
|
||||||
|
Loading…
Reference in New Issue
Block a user