code-server/scripts/merge.js

24 lines
657 B
JavaScript
Raw Normal View History

2019-07-31 07:17:54 +08:00
// This is used to merge JSON files (package.json and product.json) and delete a
// few entries we don't want. It's extremely simple, expects very specific
// input, and doesn't have any error handling.
2019-07-06 01:44:33 +08:00
const fs = require("fs");
const a = process.argv[2];
const b = process.argv[3];
const out = process.argv[4];
2019-07-11 07:10:39 +08:00
const json = JSON.parse(process.argv[5] || "{}");
2019-07-06 01:44:33 +08:00
const aJson = JSON.parse(fs.readFileSync(a));
const bJson = JSON.parse(fs.readFileSync(b));
delete aJson.scripts;
delete aJson.dependencies;
delete aJson.devDependencies;
delete aJson.optionalDependencies;
fs.writeFileSync(out, JSON.stringify({
...aJson,
...bJson,
2019-07-11 07:10:39 +08:00
...json,
2019-07-06 01:44:33 +08:00
}, null, 2));