https://github.com/pyramation/package-merge
https://github.com/pyramation/package-merge
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/pyramation/package-merge
- Owner: pyramation
- License: mit
- Created: 2020-07-31T23:37:04.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-07-31T23:46:39.000Z (almost 6 years ago)
- Last Synced: 2025-03-13T02:03:52.543Z (over 1 year ago)
- Language: JavaScript
- Size: 5.86 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# package-merge
NOTE: this is originally the source code from `package-merge`, but it was missing deps so I had to re-package it.
Intelligently merge `package.json` files.
This is pretty much built for yeoman. It attempts to combine two separate `package.json` files into one, respecting as much existing content as possible including already existing dependencies and `package.json` formatting.
```javascript
var merge = require('package-merge');
var dst = fs.readFileSync('package.a.json');
var src = fs.readFileSync('package.b.json');
// Create a new `package.json`
console.log(merge(dst, src));
```
It allows you to do things like define scripts or dependencies that you would like to include as part of a larger project.
Merging:
```json
{
"name": "my-package",
"dependencies": {
"babel": "^5.2.2",
"lodash": "^3.2.5"
}
}
```
```json
{
"dependencies": {
"babel": "^5.4.1",
"eslint": "^0.22.1"
}
}
```
results in:
```json
{
"name": "my-package",
"dependencies": {
"babel": "^5.4.1",
"lodash": "^3.2.5",
"eslint": "^0.22.1"
}
}
```