foundry-release-base
v1.0.2
Published
CLI base for foundry release commands
Downloads
105
Readme
foundry-release-base
CLI base for foundry release commands
This was built to make creating foundry-release-spec integrations as easy as possible.
Getting Started
Install the module with: npm install foundry-release-base
// Inside of `my-release-command.js`
// Define our command
var FoundryReleaseBase = require('foundry-release-base');
var pkg = require('./package.json');
var myReleaseCommand = new FoundryReleaseBase({
// Define action to run on `my-release-plugin update-files`
updateFiles: function (params) { // params = {version, message}
// Update files for release
},
// Define action to run on `my-release-plugin commit`
commit: function (params) { // params = {version, message}
// Commit changes to files
},
// Define action to run on `my-release-plugin register`
register: function (params) { // params = {version, message}
// Register our package to its repository
},
// Define action to run on `my-release-plugin publish`
publish: function (params) { // params = {version, message}
// Publish our package to its repository
}
});
myReleaseCommand.version(pkg.version);
// Parse CLI arguments
myReleaseCommand.parse(process.argv);
Usage from CLI:
# Invoke each of the respective functions from above
node my-release-command.js update-files "1.0.0" "Release 1.0.0"
node my-release-command.js commit "1.0.0" "Release 1.0.0"
node my-release-command.js register "1.0.0" "Release 1.0.0"
node my-release-command.js publish "1.0.0" "Release 1.0.0"
Documentation
foundry-release-base
exposes FoundryReleaseBase
via its module.exports
.
FoundryReleaseBase(params)
FoundryReleaseBase
is a constructor that inherits from Command
from commander.js.
- params
Object
- Container for methods and options- updateFiles
Function
- Optional function that updates package's files as part of its release- For example, this could update
package.json
for annpm
release - Function signature should match
function (params, cb)
- params
Object
- Container for release information- version
String
- Semantic version for the current release - message
String
- Subject giving information about release
- version
- cb
Function
- Error-first callback to notifyFoundryReleaseBase
of when task is complete- Function signature will be
function (err)
whereerr
is either anError
ornull
- Upon non-error callback, we will exit with a 0 exit code
- Upon error callback, we will throw the
Error
which leads to a non-zero exit code
- Function signature will be
- params
- For example, this could update
- updateFilesDescription
String
- Optional description to use forupdate-files
command in--help
- commit
Function
- Optional function that saves changes to files as part of its release- For example, this could run
git commit
for agit
release - Function signature will be the same as
updateFiles
- For example, this could run
- commitDescription
String
- Optional description to use forcommit
command in--help
- register
Function
- Optional function that register package to its repository as part of its release- For example, this could run
bower register
for abower
release - Function signature will be the same as
updateFiles
- For example, this could run
- registerDescription
String
- Optional description to use forregister
command in--help
- publish
Function
- Optional function that publish package to its repository as part of its release- For example, this could run
npm publish
for annpm
release - Function signature will be the same as
updateFiles
- For example, this could run
- publishDescription
String
- Optional description to use forpublish
command in--help
- updateFiles
foundryReleaseBase.*
FoundryReleaseBase
inherits from Command
from commander.js. As a result, we support all of the methods provided by commander.js. This include .version()
, .parse()
. Please see commander.js' documentation for more information.
// Add support for running `--version` on CLI
var pkg = require('./package.json');
myReleaseCommand.version(pkg.version);
// Interpret CLI argument
myReleaseCommand.parse(process.argv);
Documentation: https://github.com/tj/commander.js
Contributing
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint via npm run lint
and test via npm test
.
Donating
Support this project and others by twolfson via gratipay.
Unlicense
As of Sep 26 2015, Todd Wolfson has released this repository and its contents to the public domain.
It has been released under the UNLICENSE.