gn-plist-but-with-hashes.js 458 B

12345678910111213141516
  1. const fs = require('fs');
  2. const [,, plistPath, outputPath, ...keySet] = process.argv;
  3. const keyPairs = {};
  4. for (let i = 0; i * 2 < keySet.length; i++) {
  5. keyPairs[keySet[i]] = fs.readFileSync(keySet[(keySet.length / 2) + i], 'utf8');
  6. }
  7. let plistContents = fs.readFileSync(plistPath, 'utf8');
  8. for (const key of Object.keys(keyPairs)) {
  9. plistContents = plistContents.replace(`$\{${key}}`, keyPairs[key]);
  10. }
  11. fs.writeFileSync(outputPath, plistContents);