Giter VIP home page Giter VIP logo

sync-pkg's Introduction

sync-pkg NPM version NPM downloads Build Status

CLI to sync only basic properties from package.json to bower.json.

Install

Install with npm:

$ npm install sync-pkg --save

API

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.

$ 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.

$ sync-pkg bower

diff

See a visual diff of proposed changes between package.json and bower.json. Does not modify any files.

$ sync-pkg diff

Example output

screen shot 2016-05-13 at 12 50 11 pm

properties

The following fields 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: Filter an object by its keys or values. Returns a copy of an object filtered… more | homepage
  • load-pkg: Loads the package.json from the root of the user's current project. | homepage
  • omit-empty: Recursively omit empty properties from an object. Omits empty objects, arrays, strings or zero. | homepage

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

Building docs

Generate readme and API documentation with verb:

$ npm install verb && npm run docs

Or, if verb is installed globally:

$ verb

Running tests

Install dev dependencies:

$ npm install -d && npm test

Author

Jon Schlinkert

License

Copyright © 2016, Jon Schlinkert. Released under the MIT license.


This file was generated by verb, v0.9.0, on May 13, 2016.

sync-pkg's People

Contributors

adjohnson916 avatar jonschlinkert avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

sync-pkg's Issues

Run in CLI

Hi,

Thank you for this very useful tool.

How exactly am I supposed to run in CLI?
I cannot find any CLI executable in the package..

Thanks,
Luis Cruz

replace filter-object with object.omit

this was a nice idea, but it seems like glob filtering is probably unnecessary. @adjohnson916 in the next major bump how about if we just do a simple omit? this still allows the user to pass an array of keys to omit, but it would be less likely to yield unexpected results.

Sync version

Support syncing the version field.

Does the API and/or CLI support optional whitelisting of fields that aren't copied by default?
Yes, it seems to support optional whitelisting in patterns argument in both API and CLI.

Non-destructive mode

There should be a mode that is non-destructive on keys that are not being updated in the sync are left alone in the output bower.json - basically an extend or merge.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.