https://github.com/jonschlinkert/sync-pkg
Minimalist CLI to sync only basic properties from package.json to bower.json
https://github.com/jonschlinkert/sync-pkg
bower json package package-json pkg sync
Last synced: 9 months ago
JSON representation
Minimalist CLI to sync only basic properties from package.json to bower.json
- Host: GitHub
- URL: https://github.com/jonschlinkert/sync-pkg
- Owner: jonschlinkert
- License: mit
- Created: 2014-02-10T09:51:16.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2017-03-16T14:36:20.000Z (almost 9 years ago)
- Last Synced: 2025-04-19T15:35:51.014Z (10 months ago)
- Topics: bower, json, package, package-json, pkg, sync
- Language: JavaScript
- Homepage: https://github.com/jonschlinkert
- Size: 47.9 KB
- Stars: 15
- Watchers: 4
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# sync-pkg [](https://www.npmjs.com/package/sync-pkg) [](https://npmjs.org/package/sync-pkg) [](https://travis-ci.org/jonschlinkert/sync-pkg)
CLI to sync only basic properties from package.json to bower.json.
## Install
Install with [npm](https://www.npmjs.com/):
```sh
$ npm install sync-pkg --save
```
### API
```js
var sync = require('sync-pkg');
// omit fields using glob patterns
sync(['!description', '!foo*']);
// extend existing bower.json
sync(null, {
extend: true
});
// allow empty fields
sync(null, {
empty: true
});
```
## CLI
Run `sync-pkg` in the command line to create and/or update bower.json.
```sh
$ sync-pkg
```
* If `bower.json` exists, it will be updated with values in package.json.
* If `bower.json` does not exist, you will be asked if you want to create one.
### Commands
#### bower
Create a bower.json file and/or update the existing bower.json. Equivalent to running `sync-pkg` without the `bower` command, except that it will automatically create a bower.json file if one does not exist, and you will not be prompted.
```sh
$ sync-pkg bower
```
#### diff
See a visual diff of proposed changes between package.json and bower.json. Does not modify any files.
```sh
$ sync-pkg diff
```
**Example output**

## properties
The [following fields](https://github.com/bower/bower.json-spec) from package.json are used:
* `name`: **required**
* `description`: recommended
* `license`: recommended
* `main`: recommended
* `ignore`: recommended
* `keywords`: recommended
These fields are also included, but are considered optional by bower:
* `repository`
* `homepage`
* `authors`
* `dependencies`
* `devDependencies`
Pull requests or feature requests are welcome!
## Related projects
You might also be interested in these projects:
* [filter-object](https://www.npmjs.com/package/filter-object): Filter an object by its keys or values. Returns a copy of an object filtered… [more](https://www.npmjs.com/package/filter-object) | [homepage](https://github.com/jonschlinkert/filter-object)
* [load-pkg](https://www.npmjs.com/package/load-pkg): Loads the package.json from the root of the user's current project. | [homepage](https://github.com/jonschlinkert/load-pkg)
* [omit-empty](https://www.npmjs.com/package/omit-empty): Recursively omit empty properties from an object. Omits empty objects, arrays, strings or zero. | [homepage](https://github.com/jonschlinkert/omit-empty)
## Contributing
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/sync-pkg/issues/new).
## Building docs
Generate readme and API documentation with [verb](https://github.com/verbose/verb):
```sh
$ npm install verb && npm run docs
```
Or, if [verb](https://github.com/verbose/verb) is installed globally:
```sh
$ verb
```
## Running tests
Install dev dependencies:
```sh
$ npm install -d && npm test
```
## Author
**Jon Schlinkert**
* [github/jonschlinkert](https://github.com/jonschlinkert)
* [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
## License
Copyright © 2016, [Jon Schlinkert](https://github.com/jonschlinkert).
Released under the [MIT license](https://github.com/jonschlinkert/sync-pkg/blob/master/LICENSE).
***
_This file was generated by [verb](https://github.com/verbose/verb), v0.9.0, on May 13, 2016._