json-to-js.js 304 B

123456
  1. const fs = require('fs');
  2. const jsonA = JSON.parse(fs.readFileSync(process.argv[2]).toString());
  3. const jsonB = JSON.parse(fs.readFileSync(process.argv[3]).toString());
  4. const obj = { ...jsonA, ...jsonB };
  5. fs.writeFileSync(process.argv[4], "window." + process.argv[5] + " = " + JSON.stringify(obj) + ";");