ump 3.3.0 → 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 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: `message, release, publish, debug` (not `help`).
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,6 +27,16 @@ 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
41
  const pull = opts.autostash ? 'git pull --autostash' : 'git pull';
32
42
 
package/lib/config.js CHANGED
@@ -17,6 +17,7 @@ const config = {
17
17
  regexReplace: '(?:[0-9]+\\.){2}[0-9]+[0-9a-zA-Z\\-_\\+\\.]*',
18
18
  regexFlags: 'g',
19
19
  autostash: true,
20
+ skipPull: false,
20
21
  },
21
22
 
22
23
  messages: {
@@ -89,17 +90,23 @@ Object.assign(config, {
89
90
  description: 'If set, automatically runs with the `--release` flag and then publishes the release to npm.',
90
91
  type: 'boolean',
91
92
  },
92
- d: {
93
- alias: 'debug',
94
- description: 'If set, ump will run in debug mode, outputting a json file instead of doing something',
95
- type: 'boolean',
96
- },
97
93
  a: {
98
94
  alias: 'autostash',
99
95
  description: 'Whether to use the --autostash flag when running `git pull`',
100
96
  type: 'boolean',
101
97
  default: true,
102
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
+ },
105
+ d: {
106
+ alias: 'debug',
107
+ description: 'If set, ump will run in debug mode, outputting a json file instead of doing something',
108
+ type: 'boolean',
109
+ },
103
110
  extras: {
104
111
  description: 'Array of objects. ONLY AVAILABLE VIA .umprc OR when using ump() AS MODULE. Props: file, prefix (optional regex string), replaced (optional regex string), flags (optional). See https://github.com/kswedberg/ump/blob/master/README.md for more info.',
105
112
  },
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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ump",
3
3
  "title": "ump",
4
- "version": "3.3.0",
4
+ "version": "3.4.0",
5
5
  "description": "Bump without the B",
6
6
  "scripts": {
7
7
  "test": "npm run test:clean && npm run test:pre && npm run test:run",
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
  }