const pjson = require('./package.json'); const fs = require('fs'); const run = () => { const bin = pjson.bin || {}; bin['find-typos'] = 'start.js'; pjson.bin = bin; fs.writeFile('./package.json', JSON.stringify(pjson, null, 2), (err) => { if (err) throw err; console.log('package.json has been updated!'); }); } run();