genbumppush 0.0.2 → 0.0.4
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 +116 -52
- package/dist/bin.mjs +25 -3
- package/dist/index.d.mts +449 -1
- package/dist/index.mjs +1 -1
- package/dist/{release-cb3ZULZM.mjs → release-gwyqzR0C.mjs} +528 -18
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,23 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://github.com/xcvzmoon/genbumppush/actions/workflows/ci.yml)
|
|
4
4
|
[](https://github.com/xcvzmoon/genbumppush/actions/workflows/release.yml)
|
|
5
|
-
[](https://www.npmjs.com/package/genbumppush)
|
|
6
|
+
[](https://www.npmjs.com/package/genbumppush)
|
|
7
7
|
|
|
8
8
|
`genbumppush` handles the repetitive parts of releasing a Conventional Commit repository. It picks the next semantic version, updates the files you choose, writes the changelog, commits, tags, and can push the branch and tag together.
|
|
9
9
|
|
|
10
|
-
It supports Node packages,
|
|
11
|
-
|
|
12
|
-
## Requirements and installation
|
|
13
|
-
|
|
14
|
-
- Node.js 20.19+
|
|
15
|
-
- Git
|
|
16
|
-
- Conventional Commits
|
|
17
|
-
- An upstream branch when pushing (unless `requireUpstream: false`)
|
|
10
|
+
It supports Node packages, web applications (React, Vue, Solid, Svelte, Astro, Next, Nuxt, etc.), fixed-version monorepos, Tauri applications, and tag-driven publication/deployment. It does not publish packages or create provider releases itself; GitHub Actions or GitLab CI should handle those after the tag is pushed.
|
|
18
11
|
|
|
19
12
|
```bash
|
|
20
|
-
|
|
21
|
-
# or: npm install --save-dev genbumppush
|
|
13
|
+
npm install --save-dev genbumppush
|
|
22
14
|
```
|
|
23
15
|
|
|
24
16
|
```json
|
|
@@ -50,15 +42,15 @@ genbumppush [release] [options]
|
|
|
50
42
|
| `prerelease` | `1.2.4-beta.0` |
|
|
51
43
|
|
|
52
44
|
```bash
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
45
|
+
npm run release # detect from Conventional Commits
|
|
46
|
+
npm run release patch # force a release type
|
|
47
|
+
npm run release preminor --preid beta # start a prerelease channel
|
|
48
|
+
npm run release prerelease --preid beta
|
|
49
|
+
npm run release --dry-run # preview without mutation
|
|
50
|
+
npm run release patch --no-push # local commit and tag only
|
|
51
|
+
npm run release patch --yes # non-interactive
|
|
60
52
|
genbumppush --cwd ../app --config release.config.ts patch
|
|
61
|
-
genbumppush --retry-gitlab v1.2.4
|
|
53
|
+
genbumppush --retry-gitlab v1.2.4 # retry provider release after a successful Git push
|
|
62
54
|
```
|
|
63
55
|
|
|
64
56
|
| Option | Meaning |
|
|
@@ -68,12 +60,13 @@ genbumppush --retry-gitlab v1.2.4 # retry provider release after a successful G
|
|
|
68
60
|
| `--config <path>` | Explicit C12 config file |
|
|
69
61
|
| `--preid <id>` | Identifier containing letters, numbers, and hyphens |
|
|
70
62
|
| `--retry-gitlab <tag>` | Retry GitLab release creation for an existing remote tag |
|
|
63
|
+
| `--retry-github <tag>` | Retry GitHub release creation for an existing remote tag |
|
|
71
64
|
| `--dry-run` | Preview without changing files, Git, or remotes |
|
|
72
65
|
| `--no-push` | Keep commit and tag local |
|
|
73
66
|
| `--yes`, `-y` | Skip confirmation |
|
|
74
67
|
| `--help`, `-h` | Print help |
|
|
75
68
|
|
|
76
|
-
Values are resolved in this order: CLI, config file, the `genbumppush` key in `package.json`, then defaults. A CLI flag such as `--no-push` overrides
|
|
69
|
+
Values are resolved in this order: CLI flags, C12 config file, the `"genbumppush"` key in `package.json`, then defaults. A CLI flag such as `--no-push` overrides both config surfaces.
|
|
77
70
|
|
|
78
71
|
## Commit detection
|
|
79
72
|
|
|
@@ -91,7 +84,7 @@ chore(deps): update vite -> excluded by default
|
|
|
91
84
|
|
|
92
85
|
## Configuration
|
|
93
86
|
|
|
94
|
-
Create `genbumppush.config.ts`:
|
|
87
|
+
Prefer a dedicated C12 file so the config stays typed, commented, and out of dependency diffs. Create `genbumppush.config.ts`:
|
|
95
88
|
|
|
96
89
|
```ts
|
|
97
90
|
import { defineConfig } from 'genbumppush';
|
|
@@ -120,29 +113,83 @@ export default defineConfig({
|
|
|
120
113
|
});
|
|
121
114
|
```
|
|
122
115
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
116
|
+
JavaScript C12 files are also supported. Use `--config <path>` to load a file at another location.
|
|
117
|
+
|
|
118
|
+
### Config in `package.json`
|
|
119
|
+
|
|
120
|
+
For simple setups, the same object can live under the exact top-level key `"genbumppush"` in `package.json`. Other keys are ignored.
|
|
121
|
+
|
|
122
|
+
```json
|
|
123
|
+
{
|
|
124
|
+
"name": "my-app",
|
|
125
|
+
"version": "1.2.3",
|
|
126
|
+
"genbumppush": {
|
|
127
|
+
"changelog": "CHANGELOG.md",
|
|
128
|
+
"files": ["package.json"],
|
|
129
|
+
"git": {
|
|
130
|
+
"remote": "origin",
|
|
131
|
+
"push": true,
|
|
132
|
+
"tagName": "v{{version}}"
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
JSON has no comments and no `defineConfig` typing, so move to `genbumppush.config.ts` once the release config grows nested `github`/`gitlab` blocks or custom hooks. A config file always wins over the `package.json` key.
|
|
139
|
+
|
|
140
|
+
**Never put secrets in either surface.** Tokens, host credentials, and project IDs with credentials belong in the process environment or an uncommitted `.env`. Config may only name which env var to read (for example `tokenEnv`).
|
|
141
|
+
|
|
142
|
+
| Key | Type | Default | Behavior |
|
|
143
|
+
| -------------------------- | ------------------------- | ------------------------------ | --------------------------------------- |
|
|
144
|
+
| `release` | release type | detected | Force release type |
|
|
145
|
+
| `preid` | string | `beta` | Prerelease channel |
|
|
146
|
+
| `changelog` | `false \| true \| string` | `CHANGELOG.md` | Disable, default, or custom path |
|
|
147
|
+
| `excludeDependencyCommits` | boolean | `true` | Ignore non-breaking dependency commits |
|
|
148
|
+
| `files` | string[] | `['package.json']` | Version files |
|
|
149
|
+
| `recursive` | boolean | `false` | Discover nested manifests |
|
|
150
|
+
| `git.remote` | string | `origin` | Remote for checks and push |
|
|
151
|
+
| `git.push` | boolean | `true` | Push branch and tag |
|
|
152
|
+
| `git.sign` | boolean | `false` | Sign commit and tag |
|
|
153
|
+
| `git.requireClean` | boolean | `true` | Reject uncommitted changes |
|
|
154
|
+
| `git.requireUpstream` | boolean | `true` | Require upstream before pushing |
|
|
155
|
+
| `git.commitMessage` | string | `chore(release): v{{version}}` | Commit template |
|
|
156
|
+
| `git.tagName` | string | `v{{version}}` | Tag template |
|
|
157
|
+
| `git.tagMessage` | string | `v{{version}}` | Annotated tag template |
|
|
158
|
+
| `hooks.before` | string or string[] | unset | Commands before file changes |
|
|
159
|
+
| `hooks.after` | string or string[] | unset | Commands after tag/push |
|
|
160
|
+
| `github.enabled` | boolean | `false` | Create a GitHub release after push |
|
|
161
|
+
| `github.host` | string | `github.com` | github.com or GHES host |
|
|
162
|
+
| `github.repo` | string | env / remote | `owner/name` |
|
|
163
|
+
| `github.tokenEnv` | string | auto | Exact env var name (disables fallbacks) |
|
|
164
|
+
| `github.releaseName` | string | tag | Release title template |
|
|
165
|
+
| `gitlab.enabled` | boolean | `false` | Create a GitLab release after push |
|
|
143
166
|
|
|
144
167
|
`{{version}}` is replaced in commit and tag templates. Hooks run through the shell in the repository directory; only use trusted configuration.
|
|
145
168
|
|
|
169
|
+
## Environment variables and `.env`
|
|
170
|
+
|
|
171
|
+
Config never stores secrets — not in `genbumppush.config.ts`, not in `"genbumppush"` inside `package.json`. Those files are committed; tokens must not be. Provider credentials are read from the process environment. On every run, genbumppush loads `.env` from the working directory (same behavior as changelogen). Values already set in the real environment win over `.env`.
|
|
172
|
+
|
|
173
|
+
Preferred names use the `GENBUMPPUSH_` prefix. Legacy provider variables still work as fallbacks:
|
|
174
|
+
|
|
175
|
+
| Purpose | Preferred | Fallbacks |
|
|
176
|
+
| ----------------- | ------------------------------- | ------------------------------------------------------- |
|
|
177
|
+
| GitHub token | `GENBUMPPUSH_GITHUB_TOKEN` | `GITHUB_TOKEN`, `GH_TOKEN`, `CHANGELOGEN_TOKENS_GITHUB` |
|
|
178
|
+
| GitHub host | `GENBUMPPUSH_GITHUB_HOST` | `GITHUB_API_URL` |
|
|
179
|
+
| GitHub repository | `GENBUMPPUSH_GITHUB_REPOSITORY` | `GITHUB_REPOSITORY` |
|
|
180
|
+
| GitLab token | `GENBUMPPUSH_GITLAB_TOKEN` | `GITLAB_TOKEN` |
|
|
181
|
+
| GitLab host | `GENBUMPPUSH_GITLAB_HOST` | `GITLAB_HOST` |
|
|
182
|
+
| GitLab project | `GENBUMPPUSH_GITLAB_PROJECT` | `GITLAB_PROJECT` |
|
|
183
|
+
|
|
184
|
+
When `tokenEnv` is set in config, only that exact variable name is read; the fallback chain is skipped. Leave `tokenEnv` unset to use the preferred/fallback chain above.
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
# .env (do not commit)
|
|
188
|
+
GENBUMPPUSH_GITHUB_TOKEN=ghp_...
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
`.env` is optional. Add it to `.gitignore`. CI should inject the same variables through the job environment instead of a file.
|
|
192
|
+
|
|
146
193
|
## Version-file adapters
|
|
147
194
|
|
|
148
195
|
Every configured file is validated before writes begin. Structured files must agree with the root version; mismatches fail without partial updates.
|
|
@@ -205,13 +252,28 @@ A release commit message alone does not trigger tag workflows. The tag must exis
|
|
|
205
252
|
git push origin main v0.0.1
|
|
206
253
|
```
|
|
207
254
|
|
|
208
|
-
For npm trusted publishing, configure the npm package trusted publisher to match the repository/workflow, keep `id-token: write`, and use a current npm. The included workflow
|
|
255
|
+
For npm trusted publishing, configure the npm package trusted publisher to match the repository/workflow, keep `id-token: write`, and use a current npm. The included workflow enables provenance for public repositories. Private source repositories should set `NPM_CONFIG_PROVENANCE=false` because npm rejects private-source provenance bundles.
|
|
209
256
|
|
|
210
|
-
## GitLab
|
|
257
|
+
## GitHub and GitLab releases
|
|
211
258
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
259
|
+
GitHub Releases are supported as an opt-in provider after the Git branch and tag are pushed atomically. genbumppush uses the exact `git.tagName` string (so custom templates work) and creates or updates the release via the GitHub API (including GHES).
|
|
260
|
+
|
|
261
|
+
```ts
|
|
262
|
+
export default defineConfig({
|
|
263
|
+
git: { push: true },
|
|
264
|
+
github: {
|
|
265
|
+
enabled: true,
|
|
266
|
+
// host: 'github.com', // or a GHES host
|
|
267
|
+
// repo: 'group/project', // or GENBUMPPUSH_GITHUB_REPOSITORY / GITHUB_REPOSITORY / package.json
|
|
268
|
+
// omit tokenEnv to use GENBUMPPUSH_GITHUB_TOKEN, then GITHUB_TOKEN / GH_TOKEN / CHANGELOGEN_TOKENS_GITHUB
|
|
269
|
+
releaseName: 'v{{version}}',
|
|
270
|
+
},
|
|
271
|
+
});
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
If GitHub release creation fails after the Git push succeeds, fix credentials and run `genbumppush --retry-github <tag>`.
|
|
275
|
+
|
|
276
|
+
GitLab release creation remains supported the same way. Configure a project path and provide an API token through the environment:
|
|
215
277
|
|
|
216
278
|
```ts
|
|
217
279
|
export default defineConfig({
|
|
@@ -220,14 +282,12 @@ export default defineConfig({
|
|
|
220
282
|
enabled: true,
|
|
221
283
|
host: 'https://gitlab.com',
|
|
222
284
|
project: 'group/project',
|
|
223
|
-
tokenEnv: 'GITLAB_TOKEN',
|
|
224
285
|
releaseName: 'v{{version}}',
|
|
225
286
|
},
|
|
226
287
|
});
|
|
227
288
|
```
|
|
228
289
|
|
|
229
|
-
`GITLAB_HOST` and `GITLAB_PROJECT`
|
|
230
|
-
must be available as the configured `tokenEnv` (default `GITLAB_TOKEN`). GitLab receives
|
|
290
|
+
Without `tokenEnv`, GitLab tokens resolve from `GENBUMPPUSH_GITLAB_TOKEN`, then `GITLAB_TOKEN`. `GENBUMPPUSH_GITLAB_HOST` / `GITLAB_HOST` and `GENBUMPPUSH_GITLAB_PROJECT` / `GITLAB_PROJECT` cover host and project fallbacks. GitLab receives
|
|
231
291
|
the matching `CHANGELOG.md` section as the release description. If `git.push` is false,
|
|
232
292
|
the provider is rejected because GitLab cannot create a release for an unpublished tag.
|
|
233
293
|
|
|
@@ -251,7 +311,7 @@ Keep artifact publication and GitLab release creation in protected, tag-triggere
|
|
|
251
311
|
|
|
252
312
|
| Scenario | Recommended setup |
|
|
253
313
|
| ---------------------- | -------------------------------------------------- |
|
|
254
|
-
| Local release | `
|
|
314
|
+
| Local release | `npm run release`, confirm interactively |
|
|
255
315
|
| CI release | `genbumppush --yes` with protected Git credentials |
|
|
256
316
|
| Preview only | `genbumppush --dry-run --yes` |
|
|
257
317
|
| Local commit/tag only | `genbumppush patch --no-push --yes` |
|
|
@@ -284,7 +344,7 @@ Run `git status --short` and inspect an existing tag with `git show <tag>`. Comm
|
|
|
284
344
|
|
|
285
345
|
### Private-repository provenance failure
|
|
286
346
|
|
|
287
|
-
npm rejects provenance bundles identifying private GitHub source repositories.
|
|
347
|
+
npm rejects provenance bundles identifying private GitHub source repositories. Set `NPM_CONFIG_PROVENANCE=false` in the publish workflow, or make the source public and keep provenance enabled.
|
|
288
348
|
|
|
289
349
|
### Workflow did not run
|
|
290
350
|
|
|
@@ -306,6 +366,10 @@ vp pack
|
|
|
306
366
|
|
|
307
367
|
The test suite covers CLI parsing, C12 configuration, SemVer edges, JSON/npm/Cargo adapters, recursive workspaces, dry runs, rollback, hooks, tag collisions, detached HEAD, upstream checks, and a real atomic push to a temporary bare Git remote.
|
|
308
368
|
|
|
369
|
+
### Agent skill
|
|
370
|
+
|
|
371
|
+
This repository ships a project skill at `skills/genbumppush/`. Agents working in this checkout can load it for configuration recipes, CLI and error recovery, CI patterns, and library development notes. New conversations that open this worktree pick it up automatically; it is not published on npm.
|
|
372
|
+
|
|
309
373
|
## License
|
|
310
374
|
|
|
311
375
|
MIT
|
package/dist/bin.mjs
CHANGED
|
@@ -1,7 +1,21 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { n as ReleaseError, t as runRelease } from "./release-
|
|
2
|
+
import { n as ReleaseError, t as runRelease } from "./release-gwyqzR0C.mjs";
|
|
3
3
|
import { resolve } from "node:path";
|
|
4
4
|
//#region src/types.ts
|
|
5
|
+
/**
|
|
6
|
+
* Every release type genbumppush can apply.
|
|
7
|
+
*
|
|
8
|
+
* The first seven values match Semantic Versioning. The `pre*` variants
|
|
9
|
+
* enter a prerelease channel (`beta` by default); `prerelease` continues
|
|
10
|
+
* an existing one.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* import type { ReleaseType } from 'genbumppush';
|
|
15
|
+
*
|
|
16
|
+
* const forced: ReleaseType = 'minor';
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
5
19
|
const RELEASE_TYPES = [
|
|
6
20
|
"major",
|
|
7
21
|
"premajor",
|
|
@@ -13,7 +27,7 @@ const RELEASE_TYPES = [
|
|
|
13
27
|
];
|
|
14
28
|
//#endregion
|
|
15
29
|
//#region src/cli.ts
|
|
16
|
-
const HELP_TEXT = `Usage: genbumppush [release] [options]\n\nGenerate a changelog, bump versions, create an annotated tag, and push atomically.\n\nArguments:\n release ${RELEASE_TYPES.join(" | ")}\n\nOptions:\n --cwd <path> Repository directory\n --config <path> Explicit C12 config file\n --preid <id> Prerelease identifier\n --retry-gitlab <tag> Retry GitLab release creation for a pushed tag\n --dry-run Preview without changes\n --no-push Keep commit and tag local\n --yes, -y Skip confirmation\n --help, -h Show help\n`;
|
|
30
|
+
const HELP_TEXT = `Usage: genbumppush [release] [options]\n\nGenerate a changelog, bump versions, create an annotated tag, and push atomically.\n\nArguments:\n release ${RELEASE_TYPES.join(" | ")}\n\nOptions:\n --cwd <path> Repository directory\n --config <path> Explicit C12 config file\n --preid <id> Prerelease identifier\n --retry-gitlab <tag> Retry GitLab release creation for a pushed tag\n --retry-github <tag> Retry GitHub release creation for a pushed tag\n --dry-run Preview without changes\n --no-push Keep commit and tag local\n --yes, -y Skip confirmation\n --help, -h Show help\n`;
|
|
17
31
|
function isType(value) {
|
|
18
32
|
return RELEASE_TYPES.some((item) => item === value);
|
|
19
33
|
}
|
|
@@ -71,6 +85,10 @@ function parseCliOptions(args) {
|
|
|
71
85
|
result.gitlabRetryTag = inlineValue ?? next(args, index, "--retry-gitlab");
|
|
72
86
|
if (inlineValue === void 0) index += 1;
|
|
73
87
|
break;
|
|
88
|
+
case "--retry-github":
|
|
89
|
+
result.githubRetryTag = inlineValue ?? next(args, index, "--retry-github");
|
|
90
|
+
if (inlineValue === void 0) index += 1;
|
|
91
|
+
break;
|
|
74
92
|
default:
|
|
75
93
|
if (isType(arg) && result.release === void 0) {
|
|
76
94
|
result.release = arg;
|
|
@@ -80,6 +98,8 @@ function parseCliOptions(args) {
|
|
|
80
98
|
}
|
|
81
99
|
}
|
|
82
100
|
if (result.gitlabRetryTag !== void 0 && result.release !== void 0) throw new ReleaseError("CONFLICTING_ARGUMENTS", "--retry-gitlab cannot be combined with a release type.");
|
|
101
|
+
if (result.githubRetryTag !== void 0 && result.release !== void 0) throw new ReleaseError("CONFLICTING_ARGUMENTS", "--retry-github cannot be combined with a release type.");
|
|
102
|
+
if (result.gitlabRetryTag !== void 0 && result.githubRetryTag !== void 0) throw new ReleaseError("CONFLICTING_ARGUMENTS", "--retry-gitlab and --retry-github cannot be combined.");
|
|
83
103
|
return result;
|
|
84
104
|
}
|
|
85
105
|
//#endregion
|
|
@@ -89,8 +109,10 @@ try {
|
|
|
89
109
|
if (options.help) console.info(HELP_TEXT);
|
|
90
110
|
else {
|
|
91
111
|
const result = await runRelease(options);
|
|
92
|
-
if (result.
|
|
112
|
+
if (result.githubReleaseCreated) console.info(`GitHub release ${result.tag ?? ""} created.`);
|
|
113
|
+
else if (result.gitlabReleaseCreated) console.info(`GitLab release ${result.tag ?? ""} created.`);
|
|
93
114
|
else if (result.releaseType === void 0) console.info("No releasable commits found.");
|
|
115
|
+
else if (result.dryRun) console.info(`Dry run: would create ${result.tag ?? result.releaseType} from ${result.currentVersion}${result.newVersion !== void 0 ? ` to v${result.newVersion}` : ""}.`);
|
|
94
116
|
else if (!result.dryRun) console.info(`${result.tag ?? result.releaseType} created${result.pushed ? " and pushed" : ""}.`);
|
|
95
117
|
}
|
|
96
118
|
} catch (error) {
|