Write upcoming release info to a JSON file
This plugin requires Grunt
If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
npm install grunt-upcoming --save-dev
In your project's Gruntfile, add a section named
upcoming to the data object passed into
upcoming:default:files:src: 'package.json' dest: 'version%s-info.json''product%s-info.json'patch:files:src: 'package.json' dest: 'patch-info.json'
Run the following from the command line:
$ grunt upcoming
For the example above, that command will generate two files:
The contents will simply be:
The package-name and version will be what is currently in package.json (the src in the default config).
Now run this:
$ grunt upcoming:major
That will generate:
Because there was no config defined for major, the default was run by applying the major release argument. The files listed in the default section contain '%s'. That was replaced in the filename with '-major'.
The output will look something like this:
Valid releases are: major, minor, patch, premajor, preminor, prepatch, or prerelease.
If no section is defined in the config for a release, the default will be used. To define a section for a release, create one named after the release (patch, minor, major, etc.).
The example contains a configuration for patch.
upcoming:default: ...patch:files:src: 'package.json' dest: 'patch-info.json'
Run this at the command line:
$ grunt upcoming:patch
This will result in the patch-info.json file being created.
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.