ump 3.2.1 → 3.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/lib/commands.js +14 -4
- package/lib/config.js +14 -0
- package/lib/utils.js +1 -0
- package/package.json +1 -1
- package/ump.js +2 -0
package/README.md
CHANGED
|
@@ -21,12 +21,14 @@ For programmatic use (i.e. requiring it as a module in a node.js script), instal
|
|
|
21
21
|
* `-m`, `--message`: Message to be used for the commit and tag when `-r` or `-p` is set. Default: Release %s
|
|
22
22
|
* `-r`, `--release`: If set, runs `git add` and `git commit` for the bumped files and pushes a tagged release.
|
|
23
23
|
* `-p`, `--publish`: If set, automatically runs with the `--release` flag and then publishes the release to npm.
|
|
24
|
+
* `-a`, `--autostash`: Default: `true`. Whether to use the `--autostash` flag when running `git pull`
|
|
25
|
+
* `-x`, `--skip-pull`: If set, skips executing the initial git pull command during a release/publish task. USE WITH CAUTION.
|
|
24
26
|
* `-d`, `--debug`: If set, ump will run in debug mode, outputting a json file instead of doing something
|
|
25
27
|
* `-h`, `--help`: Shows help information on the command line
|
|
26
28
|
|
|
27
29
|
## Module Usage
|
|
28
30
|
|
|
29
|
-
The only required option is `files`, which takes an array of files. All other options are the same as the command-line long-hand options
|
|
31
|
+
The only required option is `files`, which takes an array of files. All other options are the same as the command-line *long-hand* options — `message, release, publish, debug` (not `help`). Note: the `skip-pull` option can be written as either kebab case (`skip-pull`) or camel case (`skipPull`).
|
|
30
32
|
|
|
31
33
|
```js
|
|
32
34
|
import ump from 'ump';
|
package/lib/commands.js
CHANGED
|
@@ -27,14 +27,24 @@ const commands = {
|
|
|
27
27
|
gitPull: function gitPull(opts) {
|
|
28
28
|
// Need to pull before mucking with files, so we can stop it if git branch isn't clean.
|
|
29
29
|
// Otherwise files will be bumped and committed but not pushed and things will get messed up.
|
|
30
|
+
// However, if the user is SURE this task can be skipped, the option is available
|
|
31
|
+
|
|
32
|
+
if (opts.skipPull) {
|
|
33
|
+
return {
|
|
34
|
+
log: '',
|
|
35
|
+
cmd: function() {
|
|
36
|
+
log.color('SKIPPED git pull', 'yellow');
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
}
|
|
30
40
|
// **We can autostash on pull because we handle existence of uncommitted files later
|
|
31
|
-
const
|
|
41
|
+
const pull = opts.autostash ? 'git pull --autostash' : 'git pull';
|
|
32
42
|
|
|
33
43
|
return {
|
|
34
|
-
log:
|
|
44
|
+
log: pull,
|
|
35
45
|
cmd: function() {
|
|
36
46
|
|
|
37
|
-
return exec(
|
|
47
|
+
return exec(pull)
|
|
38
48
|
.then(({stdout, stderr}) => {
|
|
39
49
|
console.log(stdout);
|
|
40
50
|
|
|
@@ -45,7 +55,7 @@ const commands = {
|
|
|
45
55
|
utils.error(config.messages.gitPull);
|
|
46
56
|
}
|
|
47
57
|
} else {
|
|
48
|
-
log.color(`Executed ${
|
|
58
|
+
log.color(`Executed ${pull}`, 'cyan');
|
|
49
59
|
}
|
|
50
60
|
})
|
|
51
61
|
.catch((err) => {
|
package/lib/config.js
CHANGED
|
@@ -16,6 +16,8 @@ const config = {
|
|
|
16
16
|
regexPrefix: '(?:\\-\\sv|version[\'"]?\\:\\s*[\'"])',
|
|
17
17
|
regexReplace: '(?:[0-9]+\\.){2}[0-9]+[0-9a-zA-Z\\-_\\+\\.]*',
|
|
18
18
|
regexFlags: 'g',
|
|
19
|
+
autostash: true,
|
|
20
|
+
skipPull: false,
|
|
19
21
|
},
|
|
20
22
|
|
|
21
23
|
messages: {
|
|
@@ -88,6 +90,18 @@ Object.assign(config, {
|
|
|
88
90
|
description: 'If set, automatically runs with the `--release` flag and then publishes the release to npm.',
|
|
89
91
|
type: 'boolean',
|
|
90
92
|
},
|
|
93
|
+
a: {
|
|
94
|
+
alias: 'autostash',
|
|
95
|
+
description: 'Whether to use the --autostash flag when running `git pull`',
|
|
96
|
+
type: 'boolean',
|
|
97
|
+
default: true,
|
|
98
|
+
},
|
|
99
|
+
x: {
|
|
100
|
+
alias: 'skip-pull',
|
|
101
|
+
description: 'If set, skips executing the initial git pull command during a release/publish task. USE WITH CAUTION.',
|
|
102
|
+
type: 'boolean',
|
|
103
|
+
default: false,
|
|
104
|
+
},
|
|
91
105
|
d: {
|
|
92
106
|
alias: 'debug',
|
|
93
107
|
description: 'If set, ump will run in debug mode, outputting a json file instead of doing something',
|
package/lib/utils.js
CHANGED
|
@@ -209,6 +209,7 @@ const utils = {
|
|
|
209
209
|
opts.files = utils.getFiles(opts.files);
|
|
210
210
|
opts.extraFiles = utils.getFiles(opts.extras || []);
|
|
211
211
|
opts.sourceFile = opts.files[0];
|
|
212
|
+
opts.skipPull = opts.skipPull || opts['skip-pull'];
|
|
212
213
|
|
|
213
214
|
// opts.publish always implies opts.release as well (git push && git push --tags)
|
|
214
215
|
if (opts.publish) {
|
package/package.json
CHANGED
package/ump.js
CHANGED
|
@@ -44,7 +44,9 @@ const ump = async function(options) {
|
|
|
44
44
|
|
|
45
45
|
if (opts.release) {
|
|
46
46
|
// opts.dirty = commands.commitDirty(opts);
|
|
47
|
+
|
|
47
48
|
// gitPull needs to happen first, so we don't update files when we can't complete things
|
|
49
|
+
// The skipPull option is available if we are SURE we don't need to pull
|
|
48
50
|
sequence.unshift(commands.gitPull(opts));
|
|
49
51
|
sequence.push(commands.gitRelease(opts));
|
|
50
52
|
}
|