I have a nodejs
project.
Where i have few dependencies in package.json
in the "scripts" section i have added "preinstall":"node preinstall"
The preinstall
script generates the dependencies on the runtime and update package.json, so that can be available for actuall npm install
call.
preinstall.js
is something like this
const pkg = require('./package.json')
pkg.dependencies['new-package'] = 'latest';
require('fs').writeFileSync('./package.json', JSON.stringify(pkg, null, 2))
I get an additional diff as below in package.json
-}
\ No newline at end of file
+}
How to get rid of this? I don't want this diff after i write the json file.