electron/script/gn-plist-but-with-hashes.js
Milan Burda abec9ead06
refactor: use node scheme imports in scripts (#38846)
* refactor: use node scheme imports in script

* refactor: use node scheme imports in build
2023-06-22 16:21:42 +02:00

16 lines
463 B
JavaScript

const fs = require('node:fs');
const [,, plistPath, outputPath, ...keySet] = process.argv;
const keyPairs = {};
for (let i = 0; i * 2 < keySet.length; i++) {
keyPairs[keySet[i]] = fs.readFileSync(keySet[(keySet.length / 2) + i], 'utf8');
}
let plistContents = fs.readFileSync(plistPath, 'utf8');
for (const key of Object.keys(keyPairs)) {
plistContents = plistContents.replace(`$\{${key}}`, keyPairs[key]);
}
fs.writeFileSync(outputPath, plistContents);