shama / napa

:wine_glass: A helper for installing stuff without a package.json with npm.
MIT License
413 stars 34 forks source link

napa Build Status AppVeyor Code Climate David js-standard-style

A helper for installing repos without a package.json with npm.

NPM

usage

Install with npm install napa --save-dev then setup your local package.json scripts as such:

{
  "scripts": {
    "install": "napa username/repo"
  }
}

Now when you run npm install it will git clone git://github.com/username/repo node_modules/repo.

Want to name the package something else?

{
  "scripts": {
    "install": "napa username/repo:adifferentname"
  }
}

Now it will install to node_modules/adifferentname.

Want to install a package not on github?

{
  "scripts": {
    "install": "napa git://example.com/user/repo:privatepackage"
  }
}

Multiple packages?

{
  "scripts": {
    "install": "napa user/repo1:dude user/repo2:rad user/repo3:cool"
  }
}

Prefer a more structured approach?

{
  "scripts": {
    "install": "napa"
  },
  "napa": {
    "foo": "username/repo",
    "bar": "git@example.com:user/repo"
  }
}

Looking to just download a tagged release/a branch/a specific commit on github or just a zip or tar.gz url?

{
  "scripts": {
    "install": "napa"
  },
  "napa": {
    "foo": "username/repo#v1.2.3",
    "bar": "username/bar#some-branch",
    "baz": "username/baz#347259472813400c7a982690acaa516292a8be40",
    "qoo": "https://example.com/downloads/release.tar.gz",
    "fuz": "git+https://yourcompany.com/repos/project.git",
    "goo": "git+ssh://yourcompany.com/repos/project.git"
  }
}

Additional configuration

The application currently supports the following configuration options under a napa-config property in package.json.

Option name Default value Desctiption
cache true Set to false to completely disable package caching
cache-path '<OS temp>/cache' Override default path to a specific location
(relative to the current working directory)
log-level 'info' Set the log level: 'silent'/'error'/'warn'/'verbose'/'silly'
{
  "napa-config": {
    "cache": false,
    "cache-path": "../.napa-cache",
    "log-level": "error"
  }
}

Using Node.js < 4?

Please use npm install napa@2.3.0 and upgrade your Node.js.

Release History

Please view https://github.com/shama/napa/commits/master for history.

License

Copyright (c) 2017 Kyle Robinson Young Licensed under the MIT license.