with-package
Run any command with package.json properties exposed as environment variables
Last updated 3 years ago by bahmutov .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install with-package 
SYNC missed versions from official npm registry.

with-package

Run any command with package.json properties exposed as environment variables

NPM

Build status semantic-release renovate-app badge

Imagine you want to use variables from the package.json in the script commands. Now you can. For example, let us say you want to commit and tag the git branch with the current version label. Install with-package and use it as first keyword in the command

npm install --save-dev with-package
"scripts": {
  "release": "with-package git commit -am pkg.version && with-package git tag pkg.version"
},

Just refer to any primitive property of package.json as pkg.<property name>. Objects and arrays are not supported. If you need to debug the substitution, add --debug or -d flag to the command.

with-package echo this is pkg.description --debug

Note: some of the package.json variables are already exposed as environment variables, see this doc.

Small print

Author: Gleb Bahmutov © 2015 @bahmutov glebbahmutov.com glebbahmutov.com/blog

License: MIT - do anything with the code, but don't blame me if it does not work.

Spread the word: tweet, star on github, etc.

Support: if you find any problems with this module, email / tweet / open issue on Github

Current Tags

  • 1.0.2                                ...           latest (3 years ago)

5 Versions

  • 1.0.2                                ...           3 years ago
  • 1.0.1                                ...           3 years ago
  • 1.0.0                                ...           3 years ago
  • 0.2.0                                ...           6 years ago
  • 0.1.0                                ...           6 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (3)
Dev Dependencies (4)

Copyright 2014 - 2017 © taobao.org |