@releasekit/publish 0.3.0 → 0.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/dist/cli.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env node
2
+ import { Command } from 'commander';
3
+
4
+ declare function createPublishCommand(): Command;
5
+
6
+ export { createPublishCommand };
package/dist/cli.js CHANGED
@@ -1 +1,81 @@
1
1
  #!/usr/bin/env node
2
+ import {
3
+ BasePublishError,
4
+ EXIT_CODES,
5
+ PipelineError,
6
+ loadConfig,
7
+ parseInput,
8
+ readPackageVersion,
9
+ runPipeline,
10
+ setJsonMode,
11
+ setLogLevel
12
+ } from "./chunk-ZMMZ7S6G.js";
13
+
14
+ // src/cli.ts
15
+ import { realpathSync } from "fs";
16
+ import { fileURLToPath } from "url";
17
+ import { Command } from "commander";
18
+ function createPublishCommand() {
19
+ return new Command("publish").description("Publish packages to registries with git tagging and GitHub releases").option("--input <path>", "Path to version output JSON (default: stdin)").option("--config <path>", "Path to releasekit config").option("--registry <type>", "Registry to publish to (npm, cargo, all)", "all").option("--npm-auth <method>", "NPM auth method (oidc, token, auto)", "auto").option("--dry-run", "Simulate all operations", false).option("--skip-git", "Skip git commit/tag/push", false).option("--skip-publish", "Skip registry publishing", false).option("--skip-github-release", "Skip GitHub Release creation", false).option("--skip-verification", "Skip post-publish verification", false).option("--json", "Output results as JSON", false).option("--verbose", "Verbose logging", false).action(async (options) => {
20
+ if (options.verbose) setLogLevel("debug");
21
+ if (options.json) setJsonMode(true);
22
+ try {
23
+ const config = loadConfig({ configPath: options.config });
24
+ const input = await parseInput(options.input);
25
+ if (options.npmAuth !== "auto") {
26
+ config.npm.auth = options.npmAuth;
27
+ }
28
+ const cliOptions = {
29
+ input: options.input,
30
+ config: options.config,
31
+ registry: options.registry,
32
+ npmAuth: options.npmAuth,
33
+ dryRun: options.dryRun,
34
+ skipGit: options.skipGit,
35
+ skipPublish: options.skipPublish,
36
+ skipGithubRelease: options.skipGithubRelease,
37
+ skipVerification: options.skipVerification,
38
+ json: options.json,
39
+ verbose: options.verbose
40
+ };
41
+ const output = await runPipeline(input, config, cliOptions);
42
+ if (options.json) {
43
+ console.log(JSON.stringify(output, null, 2));
44
+ }
45
+ } catch (err) {
46
+ if (err instanceof PipelineError && options.json) {
47
+ console.log(
48
+ JSON.stringify(
49
+ {
50
+ error: err.message,
51
+ failedStage: err.failedStage,
52
+ partialOutput: err.partialOutput
53
+ },
54
+ null,
55
+ 2
56
+ )
57
+ );
58
+ process.exit(EXIT_CODES.PUBLISH_ERROR);
59
+ }
60
+ if (BasePublishError.isPublishError(err)) {
61
+ err.logError();
62
+ process.exit(EXIT_CODES.PUBLISH_ERROR);
63
+ }
64
+ console.error(err instanceof Error ? err.message : String(err));
65
+ process.exit(EXIT_CODES.GENERAL_ERROR);
66
+ }
67
+ });
68
+ }
69
+ var isMain = (() => {
70
+ try {
71
+ return process.argv[1] ? realpathSync(process.argv[1]) === fileURLToPath(import.meta.url) : false;
72
+ } catch {
73
+ return false;
74
+ }
75
+ })();
76
+ if (isMain) {
77
+ createPublishCommand().name("releasekit-publish").version(readPackageVersion(import.meta.url)).parse();
78
+ }
79
+ export {
80
+ createPublishCommand
81
+ };
@@ -0,0 +1,9 @@
1
+ export { getDefaultConfig, loadConfig } from './config.ts';
2
+ export { BasePublishError, PipelineError, PublishError, PublishErrorCode, createPublishError } from './errors/index.ts';
3
+ export { runPipeline } from './pipeline/index.ts';
4
+ export { parseInput } from './stages/input.ts';
5
+ export { CargoConfig, GitConfig, GitHubReleaseConfig, GitHubReleaseResult, GitResult, NpmConfig, PipelineContext, PublishCliOptions, PublishConfig, PublishOutput, PublishResult, VerificationResult, VerifyConfig } from './types.ts';
6
+ export { detectNpmAuth, hasCargoAuth } from './utils/auth.ts';
7
+ export { CargoManifest, extractPathDeps, parseCargoToml, updateCargoVersion } from './utils/cargo.ts';
8
+ export { PackageManager, detectPackageManager } from './utils/package-manager.ts';
9
+ export { getDistTag, isPrerelease } from './utils/semver.ts';
package/dist/index.js ADDED
@@ -0,0 +1,38 @@
1
+ import {
2
+ BasePublishError,
3
+ PipelineError,
4
+ PublishError,
5
+ PublishErrorCode,
6
+ createPublishError,
7
+ detectNpmAuth,
8
+ detectPackageManager,
9
+ extractPathDeps,
10
+ getDefaultConfig,
11
+ getDistTag,
12
+ hasCargoAuth,
13
+ isPrerelease,
14
+ loadConfig,
15
+ parseCargoToml,
16
+ parseInput,
17
+ runPipeline,
18
+ updateCargoVersion
19
+ } from "./chunk-ZMMZ7S6G.js";
20
+ export {
21
+ BasePublishError,
22
+ PipelineError,
23
+ PublishError,
24
+ PublishErrorCode,
25
+ createPublishError,
26
+ detectNpmAuth,
27
+ detectPackageManager,
28
+ extractPathDeps,
29
+ getDefaultConfig,
30
+ getDistTag,
31
+ hasCargoAuth,
32
+ isPrerelease,
33
+ loadConfig,
34
+ parseCargoToml,
35
+ parseInput,
36
+ runPipeline,
37
+ updateCargoVersion
38
+ };
@@ -0,0 +1,177 @@
1
+ # GitHub Releases
2
+
3
+ `@releasekit/publish` creates a GitHub Release for each published package. This guide covers configuration options and how to use LLM-generated prose as the release body.
4
+
5
+ ## Enabling GitHub Releases
6
+
7
+ GitHub Releases are enabled by default. Requires `GITHUB_TOKEN` with `contents: write` permission.
8
+
9
+ ```json
10
+ {
11
+ "publish": {
12
+ "githubRelease": {
13
+ "enabled": true
14
+ }
15
+ }
16
+ }
17
+ ```
18
+
19
+ To disable:
20
+
21
+ ```json
22
+ {
23
+ "publish": {
24
+ "githubRelease": { "enabled": false }
25
+ }
26
+ }
27
+ ```
28
+
29
+ ---
30
+
31
+ ## Release Body (`body`)
32
+
33
+ Controls what appears in the GitHub Release description.
34
+
35
+ | Value | Behaviour |
36
+ |-------|-----------|
37
+ | `"auto"` (default) | Use LLM release notes if available, otherwise changelog entries, otherwise GitHub auto-generated notes |
38
+ | `"releaseNotes"` | Use LLM-generated prose release notes (requires `notes.releaseNotes.llm.tasks.releaseNotes: true`) |
39
+ | `"changelog"` | Use the formatted changelog entries for this version |
40
+ | `"generated"` | GitHub's auto-generated release notes (from merged PRs and commits) |
41
+ | `"none"` | No release body |
42
+
43
+ ```json
44
+ {
45
+ "publish": {
46
+ "githubRelease": {
47
+ "body": "releaseNotes"
48
+ }
49
+ }
50
+ }
51
+ ```
52
+
53
+ ---
54
+
55
+ ## Using LLM-Generated Release Notes
56
+
57
+ To populate the GitHub Release body with LLM-written prose:
58
+
59
+ **1. Enable the `releaseNotes` LLM task in notes config:**
60
+
61
+ ```json
62
+ {
63
+ "notes": {
64
+ "releaseNotes": {
65
+ "llm": {
66
+ "provider": "openai",
67
+ "model": "gpt-4o-mini",
68
+ "tasks": { "releaseNotes": true }
69
+ }
70
+ }
71
+ },
72
+ "publish": {
73
+ "githubRelease": {
74
+ "body": "releaseNotes"
75
+ }
76
+ }
77
+ }
78
+ ```
79
+
80
+ The notes step runs first, the LLM generates prose release notes, and the publish step forwards them to the GitHub Release API.
81
+
82
+ If `body` is `"auto"` (default), LLM release notes are used automatically when available — no extra config needed.
83
+
84
+ **2. Optionally write release notes to a file** as well:
85
+
86
+ ```json
87
+ {
88
+ "notes": {
89
+ "releaseNotes": {
90
+ "mode": "root",
91
+ "llm": {
92
+ "provider": "anthropic",
93
+ "model": "claude-haiku-4-5",
94
+ "tasks": { "releaseNotes": true }
95
+ }
96
+ }
97
+ }
98
+ }
99
+ ```
100
+
101
+ When `mode` is set, a `RELEASE_NOTES.md` file is written in addition to the GitHub Release being populated.
102
+
103
+ ---
104
+
105
+ ## Draft Releases
106
+
107
+ Releases are created as drafts by default, giving you a chance to review before publishing.
108
+
109
+ ```json
110
+ {
111
+ "publish": {
112
+ "githubRelease": {
113
+ "draft": true
114
+ }
115
+ }
116
+ }
117
+ ```
118
+
119
+ Set `"draft": false` to publish releases immediately.
120
+
121
+ ---
122
+
123
+ ## Prerelease Marking
124
+
125
+ ```json
126
+ {
127
+ "publish": {
128
+ "githubRelease": {
129
+ "prerelease": "auto"
130
+ }
131
+ }
132
+ }
133
+ ```
134
+
135
+ | Value | Behaviour |
136
+ |-------|-----------|
137
+ | `"auto"` (default) | Marked as prerelease when the version contains a prerelease identifier (e.g. `1.0.0-beta.1`) |
138
+ | `true` | Always marked as prerelease |
139
+ | `false` | Never marked as prerelease |
140
+
141
+ ---
142
+
143
+ ## Per-Package Releases
144
+
145
+ In a monorepo, a separate GitHub Release is created for each published package by default.
146
+
147
+ ```json
148
+ {
149
+ "publish": {
150
+ "githubRelease": {
151
+ "perPackage": true
152
+ }
153
+ }
154
+ }
155
+ ```
156
+
157
+ Set `"perPackage": false` to create a single release for the entire repo.
158
+
159
+ ---
160
+
161
+ ## Full Configuration Reference
162
+
163
+ ```json
164
+ {
165
+ "publish": {
166
+ "githubRelease": {
167
+ "enabled": true,
168
+ "draft": true,
169
+ "prerelease": "auto",
170
+ "perPackage": true,
171
+ "body": "auto"
172
+ }
173
+ }
174
+ }
175
+ ```
176
+
177
+ See the [@releasekit/publish README](../README.md) for all options.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@releasekit/publish",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "Publish packages to npm and crates.io with git tagging and GitHub releases",
5
5
  "type": "module",
6
6
  "module": "./dist/index.js",
@@ -41,6 +41,7 @@
41
41
  "license": "MIT",
42
42
  "files": [
43
43
  "dist",
44
+ "docs",
44
45
  "README.md",
45
46
  "LICENSE"
46
47
  ],