ump 3.4.0 → 3.5.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 +4 -1
- package/eslint.config.mjs +9 -0
- package/lib/commands.js +1 -1
- package/lib/config.js +23 -21
- package/lib/utils.js +3 -3
- package/package.json +15 -14
- package/ump.js +8 -5
- package/.eslintrc.cjs +0 -6
package/README.md
CHANGED
|
@@ -23,12 +23,15 @@ For programmatic use (i.e. requiring it as a module in a node.js script), instal
|
|
|
23
23
|
* `-p`, `--publish`: If set, automatically runs with the `--release` flag and then publishes the release to npm.
|
|
24
24
|
* `-a`, `--autostash`: Default: `true`. Whether to use the `--autostash` flag when running `git pull`
|
|
25
25
|
* `-x`, `--skip-pull`: If set, skips executing the initial git pull command during a release/publish task. USE WITH CAUTION.
|
|
26
|
+
* `-t`, `--tag-prefix`: Optional prefix for the version in git tag. (e.g. With `--message "Release %s" --tag-prefix version`, The tag might look like "version 1.2.3" and its commit message "Release version 1.2.3")
|
|
26
27
|
* `-d`, `--debug`: If set, ump will run in debug mode, outputting a json file instead of doing something
|
|
27
28
|
* `-h`, `--help`: Shows help information on the command line
|
|
28
29
|
|
|
29
30
|
## Module Usage
|
|
30
31
|
|
|
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`).
|
|
32
|
+
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`).
|
|
33
|
+
|
|
34
|
+
Note: Options can be written as either kebab case (`skip-pull`, `tag-prefix`) or camel case (`skipPull`, `tagPrefix`).
|
|
32
35
|
|
|
33
36
|
```js
|
|
34
37
|
import ump from 'ump';
|
package/lib/commands.js
CHANGED
|
@@ -115,7 +115,7 @@ const commands = {
|
|
|
115
115
|
|
|
116
116
|
gitRelease: function gitRelease(opts) {
|
|
117
117
|
const files = utils.getFiles(opts.files.concat(opts.extras || []));
|
|
118
|
-
const newVersion = opts.newVersion
|
|
118
|
+
const newVersion = `${opts.tagPrefix || ''}${opts.newVersion}`;
|
|
119
119
|
let msg = opts.message.replace('%s', newVersion);
|
|
120
120
|
|
|
121
121
|
msg = utils.escapeQuotes(msg);
|
package/lib/config.js
CHANGED
|
@@ -10,6 +10,7 @@ try {
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
const config = {
|
|
13
|
+
pkgName: pkg.name || '',
|
|
13
14
|
defaults: {
|
|
14
15
|
sourceFile: 'package.json',
|
|
15
16
|
message: 'Release %s',
|
|
@@ -18,6 +19,7 @@ const config = {
|
|
|
18
19
|
regexFlags: 'g',
|
|
19
20
|
autostash: true,
|
|
20
21
|
skipPull: false,
|
|
22
|
+
tagPrefix: '',
|
|
21
23
|
},
|
|
22
24
|
|
|
23
25
|
messages: {
|
|
@@ -40,28 +42,22 @@ const config = {
|
|
|
40
42
|
'prepatch',
|
|
41
43
|
],
|
|
42
44
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
},
|
|
49
|
-
],
|
|
45
|
+
confirmPrompt: {
|
|
46
|
+
message: 'Are you sure you want to continue?',
|
|
47
|
+
name: 'run',
|
|
48
|
+
type: 'confirm',
|
|
49
|
+
},
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
{name: 'restricted'},
|
|
62
|
-
],
|
|
63
|
-
},
|
|
64
|
-
],
|
|
51
|
+
|
|
52
|
+
publishPrompt: {
|
|
53
|
+
name: 'access',
|
|
54
|
+
message: 'Is access public or restricted?',
|
|
55
|
+
default: 'public',
|
|
56
|
+
choices: [
|
|
57
|
+
'public',
|
|
58
|
+
'restricted',
|
|
59
|
+
],
|
|
60
|
+
},
|
|
65
61
|
};
|
|
66
62
|
|
|
67
63
|
Object.assign(config, {
|
|
@@ -102,6 +98,12 @@ Object.assign(config, {
|
|
|
102
98
|
type: 'boolean',
|
|
103
99
|
default: false,
|
|
104
100
|
},
|
|
101
|
+
t: {
|
|
102
|
+
alias: 'tag-prefix',
|
|
103
|
+
description: 'Optional prefix for the version in git tag. (e.g. With `--message "Release %s" --tag-prefix version-`, The tag might look like "version-1.2.3" and its commit message "Release version-1.2.3"',
|
|
104
|
+
type: 'string',
|
|
105
|
+
default: '',
|
|
106
|
+
},
|
|
105
107
|
d: {
|
|
106
108
|
alias: 'debug',
|
|
107
109
|
description: 'If set, ump will run in debug mode, outputting a json file instead of doing something',
|
package/lib/utils.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import path from 'path';
|
|
4
4
|
import fs from 'fs';
|
|
5
5
|
import util from 'util';
|
|
6
|
-
import
|
|
6
|
+
import {globSync} from 'glob';
|
|
7
7
|
import chalk from 'chalk';
|
|
8
8
|
import rc from 'rc';
|
|
9
9
|
import semver from 'semver';
|
|
@@ -53,7 +53,7 @@ const utils = {
|
|
|
53
53
|
|
|
54
54
|
|
|
55
55
|
files.forEach((item) => {
|
|
56
|
-
const fileGlob =
|
|
56
|
+
const fileGlob = globSync(item.file || item, {
|
|
57
57
|
dot: true,
|
|
58
58
|
});
|
|
59
59
|
|
|
@@ -210,7 +210,7 @@ const utils = {
|
|
|
210
210
|
opts.extraFiles = utils.getFiles(opts.extras || []);
|
|
211
211
|
opts.sourceFile = opts.files[0];
|
|
212
212
|
opts.skipPull = opts.skipPull || opts['skip-pull'];
|
|
213
|
-
|
|
213
|
+
opts.tagPrefix = opts.tagPrefix || opts['tag-prefix'];
|
|
214
214
|
// opts.publish always implies opts.release as well (git push && git push --tags)
|
|
215
215
|
if (opts.publish) {
|
|
216
216
|
opts.release = true;
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ump",
|
|
3
3
|
"title": "ump",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.5.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",
|
|
8
8
|
"test:clean": "rm -rf ./test/testarea",
|
|
9
9
|
"test:pre": "npm run lint && mkdir -p \"./test/testarea\"",
|
|
10
10
|
"test:run": "node_modules/.bin/mocha --delay --reporter spec",
|
|
11
|
-
"lint": "eslint
|
|
11
|
+
"lint": "eslint *.js bin lib test"
|
|
12
12
|
},
|
|
13
13
|
"repository": {
|
|
14
14
|
"type": "git",
|
|
@@ -28,22 +28,23 @@
|
|
|
28
28
|
"node": ">=14"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"
|
|
32
|
-
"
|
|
31
|
+
"@inquirer/confirm": "^5.0.0",
|
|
32
|
+
"@inquirer/select": "^4.0.0",
|
|
33
|
+
"chalk": "^5.3.0",
|
|
34
|
+
"fs-extra": "^11.2.0",
|
|
33
35
|
"git-config": "^0.0.7",
|
|
34
|
-
"glob": "^
|
|
35
|
-
"inquirer": "^9.1.4",
|
|
36
|
+
"glob": "^11.0.0",
|
|
36
37
|
"rc": "^1.2.8",
|
|
37
|
-
"semver": "^7.3
|
|
38
|
-
"update-notifier": "^
|
|
39
|
-
"yargs": "^17.
|
|
38
|
+
"semver": "^7.6.3",
|
|
39
|
+
"update-notifier": "^7.3.1",
|
|
40
|
+
"yargs": "^17.7.2"
|
|
40
41
|
},
|
|
41
42
|
"devDependencies": {
|
|
42
|
-
"@types/mocha": "^10.0.
|
|
43
|
-
"chai": "^
|
|
44
|
-
"eslint": "^
|
|
45
|
-
"eslint-config-kswedberg": "^
|
|
46
|
-
"mocha": "^
|
|
43
|
+
"@types/mocha": "^10.0.9",
|
|
44
|
+
"chai": "^5.1.1",
|
|
45
|
+
"eslint": "^9.13.0",
|
|
46
|
+
"eslint-config-kswedberg": "^7.1.0",
|
|
47
|
+
"mocha": "^10.7.3"
|
|
47
48
|
},
|
|
48
49
|
"license": "MIT"
|
|
49
50
|
}
|
package/ump.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import select from '@inquirer/select';
|
|
4
|
+
import confirm from '@inquirer/confirm';
|
|
4
5
|
|
|
5
6
|
import {utils, peach} from './lib/utils.js';
|
|
6
7
|
import {commands} from './lib/commands.js';
|
|
@@ -37,9 +38,11 @@ const ump = async function(options) {
|
|
|
37
38
|
sequence.push(commands.extras(opts));
|
|
38
39
|
}
|
|
39
40
|
|
|
41
|
+
|
|
40
42
|
// opts.inquire is set to true automatically for CLI usage
|
|
41
|
-
if (opts.publish && opts.inquire) {
|
|
42
|
-
opts.publishFlags =
|
|
43
|
+
if (opts.publish && opts.inquire && config.pkgName.startsWith('@')) {
|
|
44
|
+
opts.publishFlags = {};
|
|
45
|
+
opts.publishFlags[config.publishPrompt.name] = await select(config.publishPrompt);
|
|
43
46
|
}
|
|
44
47
|
|
|
45
48
|
if (opts.release) {
|
|
@@ -55,9 +58,9 @@ const ump = async function(options) {
|
|
|
55
58
|
|
|
56
59
|
// opts.inquire is set to true automatically for CLI usage
|
|
57
60
|
if (opts.inquire) {
|
|
58
|
-
const
|
|
61
|
+
const run = await confirm(config.confirmPrompt);
|
|
59
62
|
|
|
60
|
-
if (!
|
|
63
|
+
if (!run) {
|
|
61
64
|
console.log(sequence);
|
|
62
65
|
|
|
63
66
|
return log.color('\nHalted execution. Not bumping files.', 'red');
|