You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
abp/npm/replace-with-tilde.js

28 lines
601 B

const glob = require("glob");
const fse = require("fs-extra");
function replace(filePath) {
const pkg = fse.readJsonSync(filePath);
const { dependencies } = pkg;
if (!dependencies) return;
Object.keys(dependencies).forEach((key) => {
if (key.includes("@abp/")) {
dependencies[key] = dependencies[key].replace("^", "~");
}
});
fse.writeJsonSync(filePath, { ...pkg, dependencies }, { spaces: 2 });
}
glob("./packs/**/package.json", {}, (er, files) => {
files.forEach((path) => {
if (path.includes("node_modules")) {
return;
}
replace(path);
});
});