@picgo/bump-version 2.0.0 → 2.1.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.
@@ -1,4 +1,7 @@
1
1
  name: publish
2
+ permissions:
3
+ contents: read
4
+ id-token: write
2
5
 
3
6
  on:
4
7
  push:
@@ -16,12 +19,13 @@ jobs:
16
19
  - name: Setup pnpm
17
20
  uses: pnpm/action-setup@v4
18
21
  with:
22
+ run_install: false
19
23
  version: 10
20
24
 
21
25
  - name: Setup Node.js
22
26
  uses: actions/setup-node@v4
23
27
  with:
24
- node-version: 20
28
+ node-version: 25
25
29
  registry-url: https://registry.npmjs.org
26
30
  cache: pnpm
27
31
 
@@ -31,7 +35,8 @@ jobs:
31
35
  - name: Lint
32
36
  run: pnpm run lint
33
37
 
38
+ - name: Unset NODE_AUTH_TOKEN
39
+ run: unset NODE_AUTH_TOKEN
40
+
34
41
  - name: Publish
35
- run: pnpm publish --access public --no-git-checks
36
- env:
37
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
42
+ run: npm publish --access public --provenance --no-git-checks
package/CHANGELOG.md CHANGED
@@ -1,3 +1,25 @@
1
+ # :tada: 2.1.0 (2026-08-22)
2
+
3
+
4
+ ### :sparkles: Features
5
+
6
+ * add non-interactive mode and an explicit --version ([278d034](https://github.com/PicGo/bump-version/commit/278d034))
7
+
8
+
9
+ ### :bug: Bug Fixes
10
+
11
+ * fix deps bug ([caba420](https://github.com/PicGo/bump-version/commit/caba420))
12
+ * github actions error ([03c0733](https://github.com/PicGo/bump-version/commit/03c0733))
13
+ * write the version when --no-dry is passed ([1c042cd](https://github.com/PicGo/bump-version/commit/1c042cd))
14
+
15
+
16
+ ### :package: Chore
17
+
18
+ * update actions ([4b0c924](https://github.com/PicGo/bump-version/commit/4b0c924))
19
+ * update readme ([1819726](https://github.com/PicGo/bump-version/commit/1819726))
20
+
21
+
22
+
1
23
  # :tada: 2.0.0 (2025-12-10)
2
24
 
3
25
 
package/README.md CHANGED
@@ -24,15 +24,15 @@ It's now only available for Node.js projects. Thanks [standard-version](https://
24
24
  ## Installation
25
25
 
26
26
  ```bash
27
- npm install -D @picgo/bump-version commitizen
27
+ npm install -D @picgo/bump-version commitizen cz-customizable
28
28
 
29
29
  #or
30
30
 
31
- yarn add -D @picgo/bump-version commitizen
31
+ yarn add -D @picgo/bump-version commitizen cz-customizable
32
32
 
33
33
  #or
34
34
 
35
- pnpm add -D @picgo/bump-version commitizen
35
+ pnpm add -D @picgo/bump-version commitizen cz-customizable
36
36
  ```
37
37
 
38
38
  Also, add the following data at the top level in your `package.json` to properly config `bump-version` (replace old `config` if you have already configured `commitizen` or `cz-customizable` before):
@@ -127,7 +127,10 @@ Usage
127
127
  bump-version
128
128
 
129
129
  Example
130
- bump-version -t major
130
+ bump-version -t major Interactive, confirms before running
131
+ bump-version -t minor -y Non-interactive, no TTY needed
132
+ bump-version --version 1.0.0 -y Bump to an exact version
133
+ bump-version -t minor -y -d Preview without changing anything
131
134
 
132
135
  Options
133
136
  -a, --preid-alpha Prerelease id: alpha. Exp. 1.0.0.alpha-0
@@ -147,6 +150,13 @@ Options
147
150
  -t, --type Release type. [major, minor, patch, premajor, preminor, prepatch, prerelease]
148
151
  Default: patch
149
152
 
153
+ -y, --yes Skip all prompts and run immediately. Needs no TTY,
154
+ so it works in CI and in scripts
155
+ Default: false
156
+
157
+ --version Bump to this exact version instead of deriving one
158
+ from --type. A leading "v" is accepted. Exp. 1.0.0
159
+
150
160
  --push Auto push commits to origin master
151
161
  Default: false
152
162
 
@@ -157,6 +167,24 @@ Options
157
167
  Default: changelog will be created
158
168
  ```
159
169
 
170
+ #### Non-interactive use
171
+
172
+ Without `-y` the tool always asks for confirmation, which needs a TTY and therefore fails in CI, in `npm run` chains and in agent sessions. `-y` skips every prompt:
173
+
174
+ ```bash
175
+ bump-version -t minor -y # 0.1.0 -> 0.2.0
176
+ bump-version --version 1.0.0 -y # bump to exactly 1.0.0
177
+ bump-version --version v1.0.0 -y # same; a leading "v" is accepted
178
+ ```
179
+
180
+ `--version` takes precedence over `--type`, and is rejected when it is not valid semver or is not greater than the current version. Invalid input exits with code `1`, so a CI step fails rather than tagging the wrong version.
181
+
182
+ Pair it with `-d` to see exactly what a release would do — the new version, the generated changelog — without writing, committing or tagging anything:
183
+
184
+ ```bash
185
+ bump-version -t minor -y -d
186
+ ```
187
+
160
188
  Don't know which version should be the next? Never mind:
161
189
 
162
190
  If you reject the default next version, then you can choose which version you want or customize one.
package/bin/bump-version CHANGED
@@ -22,8 +22,12 @@ let argv = minimist(process.argv.slice(2), {
22
22
  'file': 'f', // changelog file,
23
23
  'path': 'p', // package.json's path
24
24
  'help': 'h', // help message
25
- 'type': 't' // bump type
26
- }
25
+ 'type': 't', // bump type
26
+ 'yes': 'y' // skip prompts
27
+ },
28
+ // Without this, `--version 1.0.0-beta.1` is parsed as a number and loses
29
+ // everything after the first dot.
30
+ string: ['version', 'type', 'file', 'path']
27
31
  })
28
32
 
29
33
  if (argv.h) {
@@ -38,9 +42,32 @@ if (currentVersion === undefined) {
38
42
  process.exit(0)
39
43
  }
40
44
  let preid = argv.a ? 'alpha' : argv.b ? 'beta' : ''
41
- let nextVersion = semver.inc(currentVersion, releaseType, preid)
42
45
  let releaseTypes = ['major', 'minor', 'patch', 'premajor', 'preminor', 'prepatch', 'prerelease']
43
46
 
47
+ // An explicit --version wins over --type: naming a version is unambiguous,
48
+ // so silently deriving a different one from the type would be surprising.
49
+ let explicitVersion = typeof argv.version === 'string' ? argv.version.trim() : ''
50
+ let nextVersion
51
+ if (explicitVersion !== '') {
52
+ // Accept a leading `v` because that is how the tag is written and how
53
+ // people say it out loud.
54
+ nextVersion = semver.valid(explicitVersion.replace(/^v/, ''))
55
+ if (nextVersion === null) {
56
+ logger(`Invalid version: ${explicitVersion}`, 'error')
57
+ process.exit(1)
58
+ }
59
+ if (semver.lte(nextVersion, currentVersion)) {
60
+ logger(`Version ${nextVersion} is not greater than the current ${currentVersion}!`, 'error')
61
+ process.exit(1)
62
+ }
63
+ } else {
64
+ if (!releaseTypes.includes(releaseType)) {
65
+ logger(`Invalid release type: ${releaseType}. Expected one of ${releaseTypes.join(', ')}`, 'error')
66
+ process.exit(1)
67
+ }
68
+ nextVersion = semver.inc(currentVersion, releaseType, preid)
69
+ }
70
+
44
71
  function generateReleaseTypes (types) {
45
72
  return types.map(item => {
46
73
  let version = semver.inc(currentVersion, item, (preid || 'alpha'))
@@ -71,6 +98,14 @@ BumpVersion -- By PicGo Group
71
98
  `
72
99
  );
73
100
  (async () => {
101
+ // Non-interactive path: no prompt is written at all, so this works with no
102
+ // TTY attached (CI, `pnpm release` from a script, an agent session).
103
+ if (argv.yes) {
104
+ console.log(`Bumping ${currentVersion} -> ${nextVersion}${argv.dry ? ' (dry run)' : ''}`)
105
+ await mainLifeCycle(argv, currentVersion, nextVersion)
106
+ return
107
+ }
108
+
74
109
  let answer = await inquirer.prompt(promptList)
75
110
  if (answer.confirmVersion) {
76
111
  await mainLifeCycle(argv, currentVersion, nextVersion)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@picgo/bump-version",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -9,6 +9,13 @@
9
9
  "publishConfig": {
10
10
  "access": "public"
11
11
  },
12
+ "scripts": {
13
+ "test": "echo \"Error: no test specified\"",
14
+ "cz": "git-cz",
15
+ "release": "node ./bin/bump-version",
16
+ "lint": "eslint --ext .js .",
17
+ "lint:fix": "eslint --ext .js --fix ."
18
+ },
12
19
  "husky": {
13
20
  "hooks": {
14
21
  "pre-commit": "npm run lint",
@@ -17,7 +24,7 @@
17
24
  },
18
25
  "repository": {
19
26
  "type": "git",
20
- "url": "git+https://github.com/PicGo/bump-version.git"
27
+ "url": "https://github.com/PicGo/bump-version"
21
28
  },
22
29
  "author": "Molunerfinn",
23
30
  "license": "MIT",
@@ -62,12 +69,5 @@
62
69
  },
63
70
  "engines": {
64
71
  "node": ">=20.0.0"
65
- },
66
- "scripts": {
67
- "test": "echo \"Error: no test specified\"",
68
- "cz": "git-cz",
69
- "release": "node ./bin/bump-version",
70
- "lint": "eslint --ext .js .",
71
- "lint:fix": "eslint --ext .js --fix ."
72
72
  }
73
- }
73
+ }
@@ -2,9 +2,9 @@ const fs = require('fs')
2
2
  const checkFileAndGetPath = require('./utils').checkFileAndGetPath
3
3
  let versionFiles = ['package.json', 'package-lock.json']
4
4
  module.exports = (argv, version) => {
5
- if (argv.dry === false) {
6
- return Promise.resolve()
7
- }
5
+ // No early return for `dry` here: the write itself is guarded below, so
6
+ // bailing out would also skip it for `--no-dry`, leaving commit and tag to
7
+ // run against an unchanged version.
8
8
  versionFiles = checkFileAndGetPath(argv, versionFiles)
9
9
 
10
10
  for (let file of versionFiles) {
package/src/utils.js CHANGED
@@ -17,7 +17,10 @@ Usage
17
17
  bump-version
18
18
 
19
19
  Example
20
- bump-version -t major
20
+ bump-version -t major Interactive, confirms before running
21
+ bump-version -t minor -y Non-interactive, no TTY needed
22
+ bump-version --version 1.0.0 -y Bump to an exact version
23
+ bump-version -t minor -y -d Preview without changing anything
21
24
 
22
25
  Options
23
26
  -a, --preid-alpha Prerelease id: alpha. Exp. 1.0.0.alpha-0
@@ -37,6 +40,13 @@ Options
37
40
  -t, --type Release type. [major, minor, patch, premajor, preminor, prepatch, prerelease]
38
41
  Default: patch
39
42
 
43
+ -y, --yes Skip all prompts and run immediately. Needs no TTY,
44
+ so it works in CI and in scripts
45
+ Default: false
46
+
47
+ --version Bump to this exact version instead of deriving one
48
+ from --type. A leading "v" is accepted. Exp. 1.0.0
49
+
40
50
  --push Auto push commits to origin master
41
51
  Default: false
42
52