1 | # grunt-bump
|
2 |
|
3 | **Bump package version, create tag, commit, push...**
|
4 |
|
5 | ## Installation
|
6 |
|
7 | Install npm package, next to your project's `Gruntfile.js` file:
|
8 |
|
9 | npm install grunt-bump --save-dev
|
10 |
|
11 | Add this line to your project's `Gruntfile.js`:
|
12 |
|
13 | grunt.loadNpmTasks('grunt-bump');
|
14 |
|
15 |
|
16 | ## Usage
|
17 |
|
18 | Let's say current version is `0.0.1`.
|
19 |
|
20 | ````
|
21 | $ grunt bump
|
22 | >> Version bumped to 0.0.2
|
23 | >> Committed as "Release v0.0.2"
|
24 | >> Tagged as "v0.0.2"
|
25 | >> Pushed to origin
|
26 |
|
27 | $ grunt bump:patch
|
28 | >> Version bumped to 0.0.3
|
29 | >> Committed as "Release v0.0.3"
|
30 | >> Tagged as "v0.0.3"
|
31 | >> Pushed to origin
|
32 |
|
33 | $ grunt bump:minor
|
34 | >> Version bumped to 0.1.0
|
35 | >> Committed as "Release v0.1.0"
|
36 | >> Tagged as "v0.1.0"
|
37 | >> Pushed to origin
|
38 |
|
39 | $ grunt bump:major
|
40 | >> Version bumped to 1.0.0
|
41 | >> Committed as "Release v1.0.0"
|
42 | >> Tagged as "v1.0.0"
|
43 | >> Pushed to origin
|
44 |
|
45 | $ grunt bump:git
|
46 | >> Version bumped to 1.0.0-1-ge96c
|
47 | >> Committed as "Release v1.0.0-1-ge96c"
|
48 | >> Tagged as "v1.0.0-1-ge96c"
|
49 | >> Pushed to origin
|
50 | ````
|
51 |
|
52 | Sometimes you want to run another task between bumping the version and commiting, for instance generate changelog. You can use `bump-only` and `bump-commit` to achieve that:
|
53 |
|
54 | ```bash
|
55 | $ grunt bump-only:minor
|
56 | $ grunt changelog
|
57 | $ grunt bump-commit
|
58 | ```
|
59 |
|
60 | ## Configuration
|
61 |
|
62 | This shows all the available config options with their default values.
|
63 |
|
64 | ```js
|
65 | bump: {
|
66 | options: {
|
67 | files: ['package.json'],
|
68 | updateConfigs: [],
|
69 | commit: true,
|
70 | commitMessage: 'Release v%VERSION%',
|
71 | commitFiles: ['package.json'], // '-a' for all files
|
72 | createTag: true,
|
73 | tagName: 'v%VERSION%',
|
74 | tagMessage: 'Version %VERSION%',
|
75 | push: true,
|
76 | pushTo: 'upstream',
|
77 | gitDescribeOptions: '--tags --always --abbrev=1 --dirty=-d' // options to use with '$ git describe'
|
78 | }
|
79 | }
|
80 | ```
|
81 |
|
82 | ### files
|
83 | List of files to bump. Maybe you wanna bump 'component.json' as well ?
|
84 |
|
85 | ### updateConfigs
|
86 | Sometimes you load the content of `package.json` into a grunt config. This will update the config property, so that even tasks running in the same grunt process see the updated value.
|
87 |
|
88 | ```js
|
89 | bump: {
|
90 | files: ['package.json', 'component.json'],
|
91 | updateConfigs: ['pkg', 'component']
|
92 | }
|
93 | ```
|
94 |
|
95 | ### commit
|
96 | Do you wanna commit the changes ?
|
97 |
|
98 | ### commitMessage
|
99 | If so, what is the commit message ? You can use `%VERSION%` which will get replaced with the new version.
|
100 |
|
101 | ### commitFiles
|
102 | An array of files that you wanna commit. You can use `['-a']` to commit all files.
|
103 |
|
104 | ### createTag
|
105 | Do you wanna create a tag ?
|
106 |
|
107 | ### tagName
|
108 | If so, this is the name of that tag (`%VERSION%` placeholder is available).
|
109 |
|
110 | ### tagMessage
|
111 | Yep, you guessed right, it's the message of that tag - description (`%VERSION%` placeholder is available).
|
112 |
|
113 | ### push
|
114 | Do you wanna push all these changes ?
|
115 |
|
116 | ### pushTo
|
117 | If so, which remote branch would you like to push to ?
|