@releasekit/release 0.3.0-next.4 → 0.3.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 +127 -4
- package/dist/cli.js +0 -40
- package/package.json +15 -15
- package/dist/chunk-ONEIHH2F.js +0 -100
- package/dist/cli.cjs +0 -160
- package/dist/cli.d.cts +0 -1
- package/dist/cli.d.ts +0 -1
- package/dist/index.cjs +0 -136
- package/dist/index.d.cts +0 -29
- package/dist/index.d.ts +0 -29
- package/dist/index.js +0 -6
package/README.md
CHANGED
|
@@ -20,6 +20,8 @@ npm install -g @releasekit/release
|
|
|
20
20
|
pnpm add -g @releasekit/release
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
+
> **Note:** This package is ESM only and requires Node.js 20+.
|
|
24
|
+
|
|
23
25
|
## Quick Start
|
|
24
26
|
|
|
25
27
|
```bash
|
|
@@ -48,6 +50,8 @@ If no releasable changes are found after step 1, the command exits with code 0 a
|
|
|
48
50
|
|
|
49
51
|
## CLI Reference
|
|
50
52
|
|
|
53
|
+
### `releasekit release`
|
|
54
|
+
|
|
51
55
|
| Flag | Description | Default |
|
|
52
56
|
|------|-------------|---------|
|
|
53
57
|
| `-c, --config <path>` | Path to config file | `releasekit.config.json` |
|
|
@@ -56,6 +60,7 @@ If no releasable changes are found after step 1, the command exits with code 0 a
|
|
|
56
60
|
| `-p, --prerelease [id]` | Create prerelease version | — |
|
|
57
61
|
| `-s, --sync` | Synchronized versioning across all packages | `false` |
|
|
58
62
|
| `-t, --target <packages>` | Target specific packages (comma-separated) | all |
|
|
63
|
+
| `--branch <name>` | Git branch to push to | current branch |
|
|
59
64
|
| `--skip-notes` | Skip changelog generation | `false` |
|
|
60
65
|
| `--skip-publish` | Skip registry publishing and git operations | `false` |
|
|
61
66
|
| `--skip-git` | Skip git commit/tag/push | `false` |
|
|
@@ -66,6 +71,22 @@ If no releasable changes are found after step 1, the command exits with code 0 a
|
|
|
66
71
|
| `-q, --quiet` | Suppress non-error output | `false` |
|
|
67
72
|
| `--project-dir <path>` | Project directory | cwd |
|
|
68
73
|
|
|
74
|
+
### `releasekit preview`
|
|
75
|
+
|
|
76
|
+
Posts a release preview comment on a pull request showing what would be released if merged.
|
|
77
|
+
|
|
78
|
+
| Flag | Description | Default |
|
|
79
|
+
|------|-------------|---------|
|
|
80
|
+
| `-c, --config <path>` | Path to config file | `releasekit.config.json` |
|
|
81
|
+
| `-d, --dry-run` | Print comment markdown to stdout instead of posting | `false` |
|
|
82
|
+
| `-p, --prerelease [id]` | Force prerelease preview (auto-detected by default) | — |
|
|
83
|
+
| `--stable` | Force stable release preview (graduation from prerelease) | `false` |
|
|
84
|
+
| `--pr <number>` | PR number (auto-detected from GitHub Actions) | — |
|
|
85
|
+
| `--repo <owner/repo>` | Repository (auto-detected from `GITHUB_REPOSITORY`) | — |
|
|
86
|
+
| `--project-dir <path>` | Project directory | cwd |
|
|
87
|
+
|
|
88
|
+
The preview command reads PR labels to determine release behavior. See [CI Configuration](#ci-configuration) for label configuration.
|
|
89
|
+
|
|
69
90
|
## Usage Examples
|
|
70
91
|
|
|
71
92
|
### In CI (GitHub Actions)
|
|
@@ -91,10 +112,10 @@ jobs:
|
|
|
91
112
|
if: "!contains(github.event.head_commit.message, '[skip ci]')"
|
|
92
113
|
runs-on: ubuntu-latest
|
|
93
114
|
steps:
|
|
94
|
-
- uses: actions/checkout@
|
|
115
|
+
- uses: actions/checkout@v6
|
|
95
116
|
with:
|
|
96
117
|
fetch-depth: 0
|
|
97
|
-
- uses: actions/setup-node@
|
|
118
|
+
- uses: actions/setup-node@v6
|
|
98
119
|
- run: npm install -g @releasekit/release
|
|
99
120
|
- run: releasekit release
|
|
100
121
|
```
|
|
@@ -144,14 +165,116 @@ if (result) {
|
|
|
144
165
|
|
|
145
166
|
## Configuration
|
|
146
167
|
|
|
147
|
-
|
|
168
|
+
Create a `releasekit.config.json` in your project root. Add `$schema` for editor autocompletion and validation:
|
|
169
|
+
|
|
170
|
+
```json
|
|
171
|
+
{
|
|
172
|
+
"$schema": "https://goosewobbler.github.io/releasekit/schema.json",
|
|
173
|
+
"version": {
|
|
174
|
+
"preset": "angular",
|
|
175
|
+
"packages": ["./"]
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
```
|
|
148
179
|
|
|
149
|
-
See the individual package READMEs for
|
|
180
|
+
The release command reads the `version`, `notes`, and `publish` sections. See the individual package READMEs for all available options:
|
|
150
181
|
|
|
151
182
|
- [@releasekit/version](../version/README.md) — versioning options
|
|
152
183
|
- [@releasekit/notes](../notes/README.md) — changelog options
|
|
153
184
|
- [@releasekit/publish](../publish/README.md) — publishing options
|
|
154
185
|
|
|
186
|
+
### CI Configuration
|
|
187
|
+
|
|
188
|
+
The `ci` section controls automation behavior:
|
|
189
|
+
|
|
190
|
+
```jsonc
|
|
191
|
+
{
|
|
192
|
+
"ci": {
|
|
193
|
+
// How releases are delivered
|
|
194
|
+
"releaseStrategy": "direct", // "manual" | "direct" | "standing-pr" | "scheduled"
|
|
195
|
+
|
|
196
|
+
// What triggers a release
|
|
197
|
+
"releaseTrigger": "label", // "commit" | "label"
|
|
198
|
+
|
|
199
|
+
// Enable/disable PR preview comments
|
|
200
|
+
"prPreview": true,
|
|
201
|
+
|
|
202
|
+
// Customise PR label names
|
|
203
|
+
"labels": {
|
|
204
|
+
"stable": "release:stable",
|
|
205
|
+
"prerelease": "release:prerelease",
|
|
206
|
+
"skip": "release:skip",
|
|
207
|
+
"major": "release:major",
|
|
208
|
+
"minor": "release:minor",
|
|
209
|
+
"patch": "release:patch"
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
#### Release Trigger
|
|
216
|
+
|
|
217
|
+
**`label`** (default) — A PR label (`release:patch`, `release:minor`, or `release:major`) is required to trigger a release. The label determines the bump type. PRs without a release label will not trigger a release when merged.
|
|
218
|
+
|
|
219
|
+
**`commit`** — Conventional commits drive the bump type automatically. Every merge can trigger a release. Use the `release:skip` label to prevent a release, or `release:major` to override the commit-derived bump to major.
|
|
220
|
+
|
|
221
|
+
Both modes support `release:stable` and `release:prerelease` as modifiers.
|
|
222
|
+
|
|
223
|
+
#### Release Strategy
|
|
224
|
+
|
|
225
|
+
| Strategy | Description |
|
|
226
|
+
|----------|-------------|
|
|
227
|
+
| `direct` | Release is triggered when a PR is merged to the main branch |
|
|
228
|
+
| `manual` | Releases are triggered manually (e.g. via `workflow_dispatch`) |
|
|
229
|
+
| `standing-pr` | Changes accumulate in a standing release PR *(planned)* |
|
|
230
|
+
| `scheduled` | Releases are triggered on a schedule *(planned)* |
|
|
231
|
+
|
|
232
|
+
### PR Preview
|
|
233
|
+
|
|
234
|
+
The `releasekit preview` command posts a comment on pull requests showing what would be released. It reads PR labels from GitHub and adapts its messaging based on `releaseStrategy` and `releaseTrigger`.
|
|
235
|
+
|
|
236
|
+
Add this workflow to `.github/workflows/release-preview.yml`:
|
|
237
|
+
|
|
238
|
+
```yaml
|
|
239
|
+
name: Release Preview
|
|
240
|
+
|
|
241
|
+
on:
|
|
242
|
+
pull_request:
|
|
243
|
+
branches: [main]
|
|
244
|
+
types: [opened, synchronize, labeled, unlabeled]
|
|
245
|
+
|
|
246
|
+
concurrency:
|
|
247
|
+
group: release-preview-${{ github.event.pull_request.number }}
|
|
248
|
+
cancel-in-progress: true
|
|
249
|
+
|
|
250
|
+
permissions:
|
|
251
|
+
pull-requests: write
|
|
252
|
+
contents: read
|
|
253
|
+
|
|
254
|
+
jobs:
|
|
255
|
+
preview:
|
|
256
|
+
name: Release Preview
|
|
257
|
+
runs-on: ubuntu-latest
|
|
258
|
+
steps:
|
|
259
|
+
- uses: actions/checkout@v6
|
|
260
|
+
with:
|
|
261
|
+
fetch-depth: 0
|
|
262
|
+
|
|
263
|
+
- uses: actions/setup-node@v6
|
|
264
|
+
with:
|
|
265
|
+
node-version: '20'
|
|
266
|
+
|
|
267
|
+
- name: Install dependencies
|
|
268
|
+
run: npm ci
|
|
269
|
+
|
|
270
|
+
- name: Release preview
|
|
271
|
+
run: npx releasekit preview
|
|
272
|
+
env:
|
|
273
|
+
GITHUB_TOKEN: ${{ github.token }}
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
A template is also available at [`templates/workflows/release-preview.yml`](../../templates/workflows/release-preview.yml).
|
|
277
|
+
|
|
155
278
|
## License
|
|
156
279
|
|
|
157
280
|
MIT
|
package/dist/cli.js
CHANGED
|
@@ -1,41 +1 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
runRelease
|
|
4
|
-
} from "./chunk-ONEIHH2F.js";
|
|
5
|
-
|
|
6
|
-
// src/cli.ts
|
|
7
|
-
import { EXIT_CODES } from "@releasekit/core";
|
|
8
|
-
import { Command } from "commander";
|
|
9
|
-
var program = new Command();
|
|
10
|
-
program.name("releasekit").description("Unified release pipeline: version, changelog, and publish").version("0.1.0").command("release", { isDefault: true }).description("Run the full release pipeline").option("-c, --config <path>", "Path to config file").option("-d, --dry-run", "Preview all steps without side effects", false).option("-b, --bump <type>", "Force bump type (patch|minor|major)").option("-p, --prerelease [identifier]", "Create prerelease version").option("-s, --sync", "Use synchronized versioning across all packages", false).option("-t, --target <packages>", "Target specific packages (comma-separated)").option("--skip-notes", "Skip changelog generation", false).option("--skip-publish", "Skip registry publishing and git operations", false).option("--skip-git", "Skip git commit/tag/push", false).option("--skip-github-release", "Skip GitHub release creation", false).option("--skip-verification", "Skip post-publish verification", false).option("-j, --json", "Output results as JSON", false).option("-v, --verbose", "Verbose logging", false).option("-q, --quiet", "Suppress non-error output", false).option("--project-dir <path>", "Project directory", process.cwd()).action(async (opts) => {
|
|
11
|
-
const options = {
|
|
12
|
-
config: opts.config,
|
|
13
|
-
dryRun: opts.dryRun,
|
|
14
|
-
bump: opts.bump,
|
|
15
|
-
prerelease: opts.prerelease,
|
|
16
|
-
sync: opts.sync,
|
|
17
|
-
target: opts.target,
|
|
18
|
-
skipNotes: opts.skipNotes,
|
|
19
|
-
skipPublish: opts.skipPublish,
|
|
20
|
-
skipGit: opts.skipGit,
|
|
21
|
-
skipGithubRelease: opts.skipGithubRelease,
|
|
22
|
-
skipVerification: opts.skipVerification,
|
|
23
|
-
json: opts.json,
|
|
24
|
-
verbose: opts.verbose,
|
|
25
|
-
quiet: opts.quiet,
|
|
26
|
-
projectDir: opts.projectDir
|
|
27
|
-
};
|
|
28
|
-
try {
|
|
29
|
-
const result = await runRelease(options);
|
|
30
|
-
if (options.json && result) {
|
|
31
|
-
console.log(JSON.stringify(result, null, 2));
|
|
32
|
-
}
|
|
33
|
-
if (!result) {
|
|
34
|
-
process.exit(0);
|
|
35
|
-
}
|
|
36
|
-
} catch (error) {
|
|
37
|
-
console.error(error instanceof Error ? error.message : String(error));
|
|
38
|
-
process.exit(EXIT_CODES.GENERAL_ERROR);
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
program.parse();
|
package/package.json
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@releasekit/release",
|
|
3
|
-
"version": "0.3.0
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Unified release pipeline: version, changelog, and publish in a single command",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"main": "./dist/index.cjs",
|
|
7
6
|
"module": "./dist/index.js",
|
|
8
7
|
"types": "./dist/index.d.ts",
|
|
9
8
|
"exports": {
|
|
@@ -11,15 +10,12 @@
|
|
|
11
10
|
"import": {
|
|
12
11
|
"types": "./dist/index.d.ts",
|
|
13
12
|
"default": "./dist/index.js"
|
|
14
|
-
},
|
|
15
|
-
"require": {
|
|
16
|
-
"types": "./dist/index.d.cts",
|
|
17
|
-
"default": "./dist/index.cjs"
|
|
18
13
|
}
|
|
19
14
|
}
|
|
20
15
|
},
|
|
21
16
|
"bin": {
|
|
22
|
-
"releasekit": "dist/
|
|
17
|
+
"releasekit": "dist/dispatcher.js",
|
|
18
|
+
"releasekit-release": "dist/cli.js"
|
|
23
19
|
},
|
|
24
20
|
"keywords": [
|
|
25
21
|
"release",
|
|
@@ -48,12 +44,14 @@
|
|
|
48
44
|
"access": "public"
|
|
49
45
|
},
|
|
50
46
|
"dependencies": {
|
|
47
|
+
"@octokit/rest": "^22.0.1",
|
|
48
|
+
"chalk": "^5.6.2",
|
|
51
49
|
"commander": "^14.0.3",
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"@releasekit/
|
|
55
|
-
"@releasekit/version": "0.3.0
|
|
56
|
-
"@releasekit/
|
|
50
|
+
"smol-toml": "^1.6.1",
|
|
51
|
+
"zod": "^4.3.6",
|
|
52
|
+
"@releasekit/notes": "0.3.0",
|
|
53
|
+
"@releasekit/version": "0.3.0",
|
|
54
|
+
"@releasekit/publish": "0.3.0"
|
|
57
55
|
},
|
|
58
56
|
"devDependencies": {
|
|
59
57
|
"@biomejs/biome": "^2.4.6",
|
|
@@ -62,14 +60,16 @@
|
|
|
62
60
|
"@vitest/coverage-v8": "^4.1.0",
|
|
63
61
|
"tsup": "^8.5.1",
|
|
64
62
|
"typescript": "^5.9.3",
|
|
65
|
-
"vitest": "^4.1.0"
|
|
63
|
+
"vitest": "^4.1.0",
|
|
64
|
+
"@releasekit/core": "0.0.0",
|
|
65
|
+
"@releasekit/config": "0.0.0"
|
|
66
66
|
},
|
|
67
67
|
"engines": {
|
|
68
68
|
"node": ">=20"
|
|
69
69
|
},
|
|
70
70
|
"scripts": {
|
|
71
|
-
"build": "tsup
|
|
72
|
-
"dev": "tsup
|
|
71
|
+
"build": "tsup",
|
|
72
|
+
"dev": "tsup --watch",
|
|
73
73
|
"clean": "rm -rf dist coverage .turbo",
|
|
74
74
|
"test": "vitest run",
|
|
75
75
|
"test:unit": "vitest run --coverage",
|
package/dist/chunk-ONEIHH2F.js
DELETED
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
// src/release.ts
|
|
2
|
-
import { info, setJsonMode, setLogLevel, setQuietMode, success } from "@releasekit/core";
|
|
3
|
-
async function runRelease(options) {
|
|
4
|
-
if (options.verbose) setLogLevel("debug");
|
|
5
|
-
if (options.quiet) setQuietMode(true);
|
|
6
|
-
if (options.json) setJsonMode(true);
|
|
7
|
-
info("Running version analysis...");
|
|
8
|
-
const versionOutput = await runVersionStep(options);
|
|
9
|
-
if (versionOutput.updates.length === 0) {
|
|
10
|
-
info("No releasable changes found");
|
|
11
|
-
return null;
|
|
12
|
-
}
|
|
13
|
-
info(`Found ${versionOutput.updates.length} package update(s)`);
|
|
14
|
-
for (const update of versionOutput.updates) {
|
|
15
|
-
info(` ${update.packageName} \u2192 ${update.newVersion}`);
|
|
16
|
-
}
|
|
17
|
-
let notesGenerated = false;
|
|
18
|
-
let packageNotes;
|
|
19
|
-
let notesFiles = [];
|
|
20
|
-
if (!options.skipNotes) {
|
|
21
|
-
info("Generating release notes...");
|
|
22
|
-
const notesResult = await runNotesStep(versionOutput, options);
|
|
23
|
-
packageNotes = notesResult.packageNotes;
|
|
24
|
-
notesFiles = notesResult.files;
|
|
25
|
-
notesGenerated = true;
|
|
26
|
-
success("Release notes generated");
|
|
27
|
-
}
|
|
28
|
-
let publishOutput;
|
|
29
|
-
if (!options.skipPublish) {
|
|
30
|
-
info("Publishing...");
|
|
31
|
-
publishOutput = await runPublishStep(versionOutput, options, packageNotes, notesFiles);
|
|
32
|
-
success("Publish complete");
|
|
33
|
-
}
|
|
34
|
-
return { versionOutput, notesGenerated, publishOutput };
|
|
35
|
-
}
|
|
36
|
-
async function runVersionStep(options) {
|
|
37
|
-
const { loadConfig, VersionEngine, enableJsonOutput, getJsonData } = await import("@releasekit/version");
|
|
38
|
-
enableJsonOutput(options.dryRun);
|
|
39
|
-
const config = loadConfig({ cwd: options.projectDir, configPath: options.config });
|
|
40
|
-
if (options.dryRun) config.dryRun = true;
|
|
41
|
-
if (options.sync) config.sync = true;
|
|
42
|
-
if (options.bump) config.type = options.bump;
|
|
43
|
-
if (options.prerelease) {
|
|
44
|
-
config.prereleaseIdentifier = options.prerelease === true ? "next" : options.prerelease;
|
|
45
|
-
config.isPrerelease = true;
|
|
46
|
-
}
|
|
47
|
-
const cliTargets = options.target ? options.target.split(",").map((t) => t.trim()) : [];
|
|
48
|
-
if (cliTargets.length > 0) {
|
|
49
|
-
config.packages = cliTargets;
|
|
50
|
-
}
|
|
51
|
-
const engine = new VersionEngine(config);
|
|
52
|
-
const pkgsResult = await engine.getWorkspacePackages();
|
|
53
|
-
const resolvedCount = pkgsResult.packages.length;
|
|
54
|
-
if (resolvedCount === 0) {
|
|
55
|
-
throw new Error("No packages found in workspace");
|
|
56
|
-
}
|
|
57
|
-
if (config.sync) {
|
|
58
|
-
engine.setStrategy("sync");
|
|
59
|
-
await engine.run(pkgsResult);
|
|
60
|
-
} else if (resolvedCount === 1) {
|
|
61
|
-
engine.setStrategy("single");
|
|
62
|
-
await engine.run(pkgsResult);
|
|
63
|
-
} else {
|
|
64
|
-
engine.setStrategy("async");
|
|
65
|
-
await engine.run(pkgsResult, cliTargets);
|
|
66
|
-
}
|
|
67
|
-
return getJsonData();
|
|
68
|
-
}
|
|
69
|
-
async function runNotesStep(versionOutput, options) {
|
|
70
|
-
const { parsePackageVersioner, runPipeline, loadConfig, getDefaultConfig } = await import("@releasekit/notes");
|
|
71
|
-
const config = loadConfig(options.projectDir, options.config);
|
|
72
|
-
if (config.output.length === 0) {
|
|
73
|
-
config.output = getDefaultConfig().output;
|
|
74
|
-
}
|
|
75
|
-
const input = parsePackageVersioner(JSON.stringify(versionOutput));
|
|
76
|
-
const result = await runPipeline(input, config, options.dryRun);
|
|
77
|
-
return { packageNotes: result.packageNotes, files: result.files };
|
|
78
|
-
}
|
|
79
|
-
async function runPublishStep(versionOutput, options, releaseNotes, additionalFiles) {
|
|
80
|
-
const { runPipeline, loadConfig } = await import("@releasekit/publish");
|
|
81
|
-
const config = loadConfig({ configPath: options.config });
|
|
82
|
-
const publishOptions = {
|
|
83
|
-
dryRun: options.dryRun,
|
|
84
|
-
registry: "all",
|
|
85
|
-
npmAuth: "auto",
|
|
86
|
-
skipGit: options.skipGit,
|
|
87
|
-
skipPublish: false,
|
|
88
|
-
skipGithubRelease: options.skipGithubRelease,
|
|
89
|
-
skipVerification: options.skipVerification,
|
|
90
|
-
json: options.json,
|
|
91
|
-
verbose: options.verbose,
|
|
92
|
-
releaseNotes,
|
|
93
|
-
additionalFiles
|
|
94
|
-
};
|
|
95
|
-
return runPipeline(versionOutput, config, publishOptions);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
export {
|
|
99
|
-
runRelease
|
|
100
|
-
};
|
package/dist/cli.cjs
DELETED
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
var __create = Object.create;
|
|
4
|
-
var __defProp = Object.defineProperty;
|
|
5
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
18
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
19
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
20
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
21
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
22
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
23
|
-
mod
|
|
24
|
-
));
|
|
25
|
-
|
|
26
|
-
// src/cli.ts
|
|
27
|
-
var import_core2 = require("@releasekit/core");
|
|
28
|
-
var import_commander = require("commander");
|
|
29
|
-
|
|
30
|
-
// src/release.ts
|
|
31
|
-
var import_core = require("@releasekit/core");
|
|
32
|
-
async function runRelease(options) {
|
|
33
|
-
if (options.verbose) (0, import_core.setLogLevel)("debug");
|
|
34
|
-
if (options.quiet) (0, import_core.setQuietMode)(true);
|
|
35
|
-
if (options.json) (0, import_core.setJsonMode)(true);
|
|
36
|
-
(0, import_core.info)("Running version analysis...");
|
|
37
|
-
const versionOutput = await runVersionStep(options);
|
|
38
|
-
if (versionOutput.updates.length === 0) {
|
|
39
|
-
(0, import_core.info)("No releasable changes found");
|
|
40
|
-
return null;
|
|
41
|
-
}
|
|
42
|
-
(0, import_core.info)(`Found ${versionOutput.updates.length} package update(s)`);
|
|
43
|
-
for (const update of versionOutput.updates) {
|
|
44
|
-
(0, import_core.info)(` ${update.packageName} \u2192 ${update.newVersion}`);
|
|
45
|
-
}
|
|
46
|
-
let notesGenerated = false;
|
|
47
|
-
let packageNotes;
|
|
48
|
-
let notesFiles = [];
|
|
49
|
-
if (!options.skipNotes) {
|
|
50
|
-
(0, import_core.info)("Generating release notes...");
|
|
51
|
-
const notesResult = await runNotesStep(versionOutput, options);
|
|
52
|
-
packageNotes = notesResult.packageNotes;
|
|
53
|
-
notesFiles = notesResult.files;
|
|
54
|
-
notesGenerated = true;
|
|
55
|
-
(0, import_core.success)("Release notes generated");
|
|
56
|
-
}
|
|
57
|
-
let publishOutput;
|
|
58
|
-
if (!options.skipPublish) {
|
|
59
|
-
(0, import_core.info)("Publishing...");
|
|
60
|
-
publishOutput = await runPublishStep(versionOutput, options, packageNotes, notesFiles);
|
|
61
|
-
(0, import_core.success)("Publish complete");
|
|
62
|
-
}
|
|
63
|
-
return { versionOutput, notesGenerated, publishOutput };
|
|
64
|
-
}
|
|
65
|
-
async function runVersionStep(options) {
|
|
66
|
-
const { loadConfig, VersionEngine, enableJsonOutput, getJsonData } = await import("@releasekit/version");
|
|
67
|
-
enableJsonOutput(options.dryRun);
|
|
68
|
-
const config = loadConfig({ cwd: options.projectDir, configPath: options.config });
|
|
69
|
-
if (options.dryRun) config.dryRun = true;
|
|
70
|
-
if (options.sync) config.sync = true;
|
|
71
|
-
if (options.bump) config.type = options.bump;
|
|
72
|
-
if (options.prerelease) {
|
|
73
|
-
config.prereleaseIdentifier = options.prerelease === true ? "next" : options.prerelease;
|
|
74
|
-
config.isPrerelease = true;
|
|
75
|
-
}
|
|
76
|
-
const cliTargets = options.target ? options.target.split(",").map((t) => t.trim()) : [];
|
|
77
|
-
if (cliTargets.length > 0) {
|
|
78
|
-
config.packages = cliTargets;
|
|
79
|
-
}
|
|
80
|
-
const engine = new VersionEngine(config);
|
|
81
|
-
const pkgsResult = await engine.getWorkspacePackages();
|
|
82
|
-
const resolvedCount = pkgsResult.packages.length;
|
|
83
|
-
if (resolvedCount === 0) {
|
|
84
|
-
throw new Error("No packages found in workspace");
|
|
85
|
-
}
|
|
86
|
-
if (config.sync) {
|
|
87
|
-
engine.setStrategy("sync");
|
|
88
|
-
await engine.run(pkgsResult);
|
|
89
|
-
} else if (resolvedCount === 1) {
|
|
90
|
-
engine.setStrategy("single");
|
|
91
|
-
await engine.run(pkgsResult);
|
|
92
|
-
} else {
|
|
93
|
-
engine.setStrategy("async");
|
|
94
|
-
await engine.run(pkgsResult, cliTargets);
|
|
95
|
-
}
|
|
96
|
-
return getJsonData();
|
|
97
|
-
}
|
|
98
|
-
async function runNotesStep(versionOutput, options) {
|
|
99
|
-
const { parsePackageVersioner, runPipeline, loadConfig, getDefaultConfig } = await import("@releasekit/notes");
|
|
100
|
-
const config = loadConfig(options.projectDir, options.config);
|
|
101
|
-
if (config.output.length === 0) {
|
|
102
|
-
config.output = getDefaultConfig().output;
|
|
103
|
-
}
|
|
104
|
-
const input = parsePackageVersioner(JSON.stringify(versionOutput));
|
|
105
|
-
const result = await runPipeline(input, config, options.dryRun);
|
|
106
|
-
return { packageNotes: result.packageNotes, files: result.files };
|
|
107
|
-
}
|
|
108
|
-
async function runPublishStep(versionOutput, options, releaseNotes, additionalFiles) {
|
|
109
|
-
const { runPipeline, loadConfig } = await import("@releasekit/publish");
|
|
110
|
-
const config = loadConfig({ configPath: options.config });
|
|
111
|
-
const publishOptions = {
|
|
112
|
-
dryRun: options.dryRun,
|
|
113
|
-
registry: "all",
|
|
114
|
-
npmAuth: "auto",
|
|
115
|
-
skipGit: options.skipGit,
|
|
116
|
-
skipPublish: false,
|
|
117
|
-
skipGithubRelease: options.skipGithubRelease,
|
|
118
|
-
skipVerification: options.skipVerification,
|
|
119
|
-
json: options.json,
|
|
120
|
-
verbose: options.verbose,
|
|
121
|
-
releaseNotes,
|
|
122
|
-
additionalFiles
|
|
123
|
-
};
|
|
124
|
-
return runPipeline(versionOutput, config, publishOptions);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
// src/cli.ts
|
|
128
|
-
var program = new import_commander.Command();
|
|
129
|
-
program.name("releasekit").description("Unified release pipeline: version, changelog, and publish").version("0.1.0").command("release", { isDefault: true }).description("Run the full release pipeline").option("-c, --config <path>", "Path to config file").option("-d, --dry-run", "Preview all steps without side effects", false).option("-b, --bump <type>", "Force bump type (patch|minor|major)").option("-p, --prerelease [identifier]", "Create prerelease version").option("-s, --sync", "Use synchronized versioning across all packages", false).option("-t, --target <packages>", "Target specific packages (comma-separated)").option("--skip-notes", "Skip changelog generation", false).option("--skip-publish", "Skip registry publishing and git operations", false).option("--skip-git", "Skip git commit/tag/push", false).option("--skip-github-release", "Skip GitHub release creation", false).option("--skip-verification", "Skip post-publish verification", false).option("-j, --json", "Output results as JSON", false).option("-v, --verbose", "Verbose logging", false).option("-q, --quiet", "Suppress non-error output", false).option("--project-dir <path>", "Project directory", process.cwd()).action(async (opts) => {
|
|
130
|
-
const options = {
|
|
131
|
-
config: opts.config,
|
|
132
|
-
dryRun: opts.dryRun,
|
|
133
|
-
bump: opts.bump,
|
|
134
|
-
prerelease: opts.prerelease,
|
|
135
|
-
sync: opts.sync,
|
|
136
|
-
target: opts.target,
|
|
137
|
-
skipNotes: opts.skipNotes,
|
|
138
|
-
skipPublish: opts.skipPublish,
|
|
139
|
-
skipGit: opts.skipGit,
|
|
140
|
-
skipGithubRelease: opts.skipGithubRelease,
|
|
141
|
-
skipVerification: opts.skipVerification,
|
|
142
|
-
json: opts.json,
|
|
143
|
-
verbose: opts.verbose,
|
|
144
|
-
quiet: opts.quiet,
|
|
145
|
-
projectDir: opts.projectDir
|
|
146
|
-
};
|
|
147
|
-
try {
|
|
148
|
-
const result = await runRelease(options);
|
|
149
|
-
if (options.json && result) {
|
|
150
|
-
console.log(JSON.stringify(result, null, 2));
|
|
151
|
-
}
|
|
152
|
-
if (!result) {
|
|
153
|
-
process.exit(0);
|
|
154
|
-
}
|
|
155
|
-
} catch (error) {
|
|
156
|
-
console.error(error instanceof Error ? error.message : String(error));
|
|
157
|
-
process.exit(import_core2.EXIT_CODES.GENERAL_ERROR);
|
|
158
|
-
}
|
|
159
|
-
});
|
|
160
|
-
program.parse();
|
package/dist/cli.d.cts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
package/dist/cli.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
package/dist/index.cjs
DELETED
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
|
|
30
|
-
// src/index.ts
|
|
31
|
-
var index_exports = {};
|
|
32
|
-
__export(index_exports, {
|
|
33
|
-
runRelease: () => runRelease
|
|
34
|
-
});
|
|
35
|
-
module.exports = __toCommonJS(index_exports);
|
|
36
|
-
|
|
37
|
-
// src/release.ts
|
|
38
|
-
var import_core = require("@releasekit/core");
|
|
39
|
-
async function runRelease(options) {
|
|
40
|
-
if (options.verbose) (0, import_core.setLogLevel)("debug");
|
|
41
|
-
if (options.quiet) (0, import_core.setQuietMode)(true);
|
|
42
|
-
if (options.json) (0, import_core.setJsonMode)(true);
|
|
43
|
-
(0, import_core.info)("Running version analysis...");
|
|
44
|
-
const versionOutput = await runVersionStep(options);
|
|
45
|
-
if (versionOutput.updates.length === 0) {
|
|
46
|
-
(0, import_core.info)("No releasable changes found");
|
|
47
|
-
return null;
|
|
48
|
-
}
|
|
49
|
-
(0, import_core.info)(`Found ${versionOutput.updates.length} package update(s)`);
|
|
50
|
-
for (const update of versionOutput.updates) {
|
|
51
|
-
(0, import_core.info)(` ${update.packageName} \u2192 ${update.newVersion}`);
|
|
52
|
-
}
|
|
53
|
-
let notesGenerated = false;
|
|
54
|
-
let packageNotes;
|
|
55
|
-
let notesFiles = [];
|
|
56
|
-
if (!options.skipNotes) {
|
|
57
|
-
(0, import_core.info)("Generating release notes...");
|
|
58
|
-
const notesResult = await runNotesStep(versionOutput, options);
|
|
59
|
-
packageNotes = notesResult.packageNotes;
|
|
60
|
-
notesFiles = notesResult.files;
|
|
61
|
-
notesGenerated = true;
|
|
62
|
-
(0, import_core.success)("Release notes generated");
|
|
63
|
-
}
|
|
64
|
-
let publishOutput;
|
|
65
|
-
if (!options.skipPublish) {
|
|
66
|
-
(0, import_core.info)("Publishing...");
|
|
67
|
-
publishOutput = await runPublishStep(versionOutput, options, packageNotes, notesFiles);
|
|
68
|
-
(0, import_core.success)("Publish complete");
|
|
69
|
-
}
|
|
70
|
-
return { versionOutput, notesGenerated, publishOutput };
|
|
71
|
-
}
|
|
72
|
-
async function runVersionStep(options) {
|
|
73
|
-
const { loadConfig, VersionEngine, enableJsonOutput, getJsonData } = await import("@releasekit/version");
|
|
74
|
-
enableJsonOutput(options.dryRun);
|
|
75
|
-
const config = loadConfig({ cwd: options.projectDir, configPath: options.config });
|
|
76
|
-
if (options.dryRun) config.dryRun = true;
|
|
77
|
-
if (options.sync) config.sync = true;
|
|
78
|
-
if (options.bump) config.type = options.bump;
|
|
79
|
-
if (options.prerelease) {
|
|
80
|
-
config.prereleaseIdentifier = options.prerelease === true ? "next" : options.prerelease;
|
|
81
|
-
config.isPrerelease = true;
|
|
82
|
-
}
|
|
83
|
-
const cliTargets = options.target ? options.target.split(",").map((t) => t.trim()) : [];
|
|
84
|
-
if (cliTargets.length > 0) {
|
|
85
|
-
config.packages = cliTargets;
|
|
86
|
-
}
|
|
87
|
-
const engine = new VersionEngine(config);
|
|
88
|
-
const pkgsResult = await engine.getWorkspacePackages();
|
|
89
|
-
const resolvedCount = pkgsResult.packages.length;
|
|
90
|
-
if (resolvedCount === 0) {
|
|
91
|
-
throw new Error("No packages found in workspace");
|
|
92
|
-
}
|
|
93
|
-
if (config.sync) {
|
|
94
|
-
engine.setStrategy("sync");
|
|
95
|
-
await engine.run(pkgsResult);
|
|
96
|
-
} else if (resolvedCount === 1) {
|
|
97
|
-
engine.setStrategy("single");
|
|
98
|
-
await engine.run(pkgsResult);
|
|
99
|
-
} else {
|
|
100
|
-
engine.setStrategy("async");
|
|
101
|
-
await engine.run(pkgsResult, cliTargets);
|
|
102
|
-
}
|
|
103
|
-
return getJsonData();
|
|
104
|
-
}
|
|
105
|
-
async function runNotesStep(versionOutput, options) {
|
|
106
|
-
const { parsePackageVersioner, runPipeline, loadConfig, getDefaultConfig } = await import("@releasekit/notes");
|
|
107
|
-
const config = loadConfig(options.projectDir, options.config);
|
|
108
|
-
if (config.output.length === 0) {
|
|
109
|
-
config.output = getDefaultConfig().output;
|
|
110
|
-
}
|
|
111
|
-
const input = parsePackageVersioner(JSON.stringify(versionOutput));
|
|
112
|
-
const result = await runPipeline(input, config, options.dryRun);
|
|
113
|
-
return { packageNotes: result.packageNotes, files: result.files };
|
|
114
|
-
}
|
|
115
|
-
async function runPublishStep(versionOutput, options, releaseNotes, additionalFiles) {
|
|
116
|
-
const { runPipeline, loadConfig } = await import("@releasekit/publish");
|
|
117
|
-
const config = loadConfig({ configPath: options.config });
|
|
118
|
-
const publishOptions = {
|
|
119
|
-
dryRun: options.dryRun,
|
|
120
|
-
registry: "all",
|
|
121
|
-
npmAuth: "auto",
|
|
122
|
-
skipGit: options.skipGit,
|
|
123
|
-
skipPublish: false,
|
|
124
|
-
skipGithubRelease: options.skipGithubRelease,
|
|
125
|
-
skipVerification: options.skipVerification,
|
|
126
|
-
json: options.json,
|
|
127
|
-
verbose: options.verbose,
|
|
128
|
-
releaseNotes,
|
|
129
|
-
additionalFiles
|
|
130
|
-
};
|
|
131
|
-
return runPipeline(versionOutput, config, publishOptions);
|
|
132
|
-
}
|
|
133
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
134
|
-
0 && (module.exports = {
|
|
135
|
-
runRelease
|
|
136
|
-
});
|
package/dist/index.d.cts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { VersionOutput } from '@releasekit/core';
|
|
2
|
-
import { PublishOutput } from '@releasekit/publish';
|
|
3
|
-
|
|
4
|
-
interface ReleaseOptions {
|
|
5
|
-
config?: string;
|
|
6
|
-
dryRun: boolean;
|
|
7
|
-
bump?: string;
|
|
8
|
-
prerelease?: string | boolean;
|
|
9
|
-
sync: boolean;
|
|
10
|
-
target?: string;
|
|
11
|
-
skipNotes: boolean;
|
|
12
|
-
skipPublish: boolean;
|
|
13
|
-
skipGit: boolean;
|
|
14
|
-
skipGithubRelease: boolean;
|
|
15
|
-
skipVerification: boolean;
|
|
16
|
-
json: boolean;
|
|
17
|
-
verbose: boolean;
|
|
18
|
-
quiet: boolean;
|
|
19
|
-
projectDir: string;
|
|
20
|
-
}
|
|
21
|
-
interface ReleaseOutput {
|
|
22
|
-
versionOutput: VersionOutput;
|
|
23
|
-
notesGenerated: boolean;
|
|
24
|
-
publishOutput?: PublishOutput;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
declare function runRelease(options: ReleaseOptions): Promise<ReleaseOutput | null>;
|
|
28
|
-
|
|
29
|
-
export { type ReleaseOptions, type ReleaseOutput, runRelease };
|
package/dist/index.d.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { VersionOutput } from '@releasekit/core';
|
|
2
|
-
import { PublishOutput } from '@releasekit/publish';
|
|
3
|
-
|
|
4
|
-
interface ReleaseOptions {
|
|
5
|
-
config?: string;
|
|
6
|
-
dryRun: boolean;
|
|
7
|
-
bump?: string;
|
|
8
|
-
prerelease?: string | boolean;
|
|
9
|
-
sync: boolean;
|
|
10
|
-
target?: string;
|
|
11
|
-
skipNotes: boolean;
|
|
12
|
-
skipPublish: boolean;
|
|
13
|
-
skipGit: boolean;
|
|
14
|
-
skipGithubRelease: boolean;
|
|
15
|
-
skipVerification: boolean;
|
|
16
|
-
json: boolean;
|
|
17
|
-
verbose: boolean;
|
|
18
|
-
quiet: boolean;
|
|
19
|
-
projectDir: string;
|
|
20
|
-
}
|
|
21
|
-
interface ReleaseOutput {
|
|
22
|
-
versionOutput: VersionOutput;
|
|
23
|
-
notesGenerated: boolean;
|
|
24
|
-
publishOutput?: PublishOutput;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
declare function runRelease(options: ReleaseOptions): Promise<ReleaseOutput | null>;
|
|
28
|
-
|
|
29
|
-
export { type ReleaseOptions, type ReleaseOutput, runRelease };
|