You can write a custom script using JavaScript which capable of replace, delete and add lines.
NPM automaticly execute postinstall
after npm install
command. You need to put your custom script in postinstall within package.json. For an example:
package.json:
{
"name": "my_package",
"description": "",
"version": "1.0.0",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"fix:issue": "node ./scripts/issue.js",
"postinstall": "npm run fix:issue"
},
"repository": {
"type": "git",
"url": "https://github.com/ashleygwilliams/my_package.git"
},
"keywords": [],
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github.com/ashleygwilliams/my_package/issues"
},
"homepage": "https://github.com/ashleygwilliams/my_package"
}