Created
July 4, 2018 11:42
-
-
Save iamhosseindhv/24d6558a55942521af67c71a70e12db5 to your computer and use it in GitHub Desktop.
Simple Node.js script to edit JSON files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var fs = require('fs'); | |
| const inputPath = 'composer.json'; | |
| const outputPath = 'composer.json'; | |
| var composerfile; | |
| fs.readFile(inputPath, 'utf8', function (err, data) { | |
| if (err) throw err; | |
| composerfile = JSON.parse(data); | |
| composerfile.config['vendor-dir'] = "./../path-to-vendor"; | |
| // delete composerfile.config['vendor-dir']; | |
| fs.writeFileSync(outputPath, JSON.stringify(composerfile, null, 2) , 'utf-8'); | |
| }); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment