@exadev/semantic-release-workspace 1.1.7 → 1.2.1
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 +29 -2
- package/dist/cli.js +444 -74
- package/dist/index.cjs +429 -72
- package/dist/index.d.cts +17 -3
- package/dist/index.d.ts +17 -3
- package/dist/index.js +429 -73
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AnalyzeCommitsContext, BranchSpec, GenerateNotesContext } from "semantic-release";
|
|
1
|
+
import { AnalyzeCommitsContext, BranchSpec, Commit, GenerateNotesContext } from "semantic-release";
|
|
2
2
|
//#region src/package-name.d.ts
|
|
3
3
|
declare const packageName = "@exadev/semantic-release-workspace";
|
|
4
4
|
//#endregion
|
|
@@ -144,6 +144,8 @@ interface DependencyBumpSource {
|
|
|
144
144
|
type PublishPluginSpec = string | readonly [string] | readonly [string, Record<string, unknown>];
|
|
145
145
|
/** The standard publish pipeline this orchestrator coordinates when a workspace configures none of its own. Every entry reuses the corresponding official plugin -- the orchestrator scopes and sequences them per package, it does not reimplement npm publishing, GitHub release creation, or changelog writing. */
|
|
146
146
|
declare const DEFAULT_PUBLISH_PLUGINS: readonly PublishPluginSpec[];
|
|
147
|
+
/** The standard publish pipeline for `commitStrategy: 'single'`: the same as `DEFAULT_PUBLISH_PLUGINS` minus @semantic-release/git, which that mode never runs -- see `resolvePublishPlugins`'s `forbidGitPlugin` option for why it is rejected outright rather than merely unused. Single-commit mode does its own committing (one combined commit for every released package), so a `prepare`-step git plugin here would create the very per-package commits that mode exists to avoid. */
|
|
148
|
+
declare const SINGLE_COMMIT_DEFAULT_PUBLISH_PLUGINS: readonly PublishPluginSpec[];
|
|
147
149
|
interface ScopedPlugins {
|
|
148
150
|
readonly analyzeCommits: (pluginConfig: Record<string, unknown>, context: AnalyzeCommitsContext & {
|
|
149
151
|
cwd: string;
|
|
@@ -164,6 +166,8 @@ declare function createScopedPlugins(scope: {
|
|
|
164
166
|
readonly analyzeCommitsConfig: Record<string, unknown>;
|
|
165
167
|
readonly generateNotesConfig: Record<string, unknown>;
|
|
166
168
|
readonly bumps: DependencyBumpSource;
|
|
169
|
+
/** Called with the path-filtered commit list every time this package's commits are resolved (from either step, whichever runs first). Optional: `commitStrategy: 'single'` uses it to capture the same filtered list `success()`'s GitHub plugin step needs later, without recomputing `changedPathsSince`/`filterCommitsToDirectory` itself from the outside. */
|
|
170
|
+
readonly onCommitsResolved?: (commits: readonly Commit[]) => void;
|
|
167
171
|
}): ScopedPlugins;
|
|
168
172
|
/**
|
|
169
173
|
* Keeps a commit for the package when any path it changed lies under the package's directory. The trailing-slash prefix comparison stops `packages/a` from matching `packages/abc/x`.
|
|
@@ -177,9 +181,17 @@ declare function filterCommitsToDirectory<T extends {
|
|
|
177
181
|
type ResolvedPublishPlugin = [string, Record<string, unknown>];
|
|
178
182
|
declare function resolvePublishPlugins(specs: readonly PublishPluginSpec[], workspaceRoot: string, options: {
|
|
179
183
|
readonly requireGitPlugin: boolean;
|
|
184
|
+
readonly forbidGitPlugin?: boolean;
|
|
180
185
|
}): readonly ResolvedPublishPlugin[];
|
|
181
186
|
//#endregion
|
|
182
187
|
//#region src/release.d.ts
|
|
188
|
+
/**
|
|
189
|
+
* How a run commits its released changes:
|
|
190
|
+
*
|
|
191
|
+
* - `'per-package'` (the default): today's behaviour, unchanged. Each package's own semantic-release run commits, tags, and pushes itself the moment it releases, and each cross-package dependency bump is its own immediately-pushed commit. This is the byte-for-byte pre-existing behaviour of this package and stays the default so no existing consumer's release history changes shape without opting in.
|
|
192
|
+
* - `'single'`: every package's version bump, changelog, and dependency-range rewrite for the whole run is folded into one combined commit, tagged once per released package (all tags pointing at that one commit), pushed once. Publish-pipeline steps (npm, GitHub) still run per package afterward, scoped to the already-committed-and-tagged state. See `single-commit-release.ts` for the full design.
|
|
193
|
+
*/
|
|
194
|
+
type CommitStrategy = 'per-package' | 'single';
|
|
183
195
|
interface ReleaseWorkspaceOptions {
|
|
184
196
|
/** Directory holding the workspace's `pnpm-workspace.yaml`. Defaults to the process working directory. */
|
|
185
197
|
readonly root?: string;
|
|
@@ -189,7 +201,7 @@ interface ReleaseWorkspaceOptions {
|
|
|
189
201
|
readonly dryRun?: boolean;
|
|
190
202
|
/** Release branch configuration for semantic-release. Defaults to semantic-release's own default branch list. */
|
|
191
203
|
readonly branches?: readonly BranchSpec[];
|
|
192
|
-
/** Publish-pipeline plugins (changelog, npm, GitHub, git), each scoped per package by semantic-release's own `cwd`. Defaults to the standard pipeline in DEFAULT_PUBLISH_PLUGINS
|
|
204
|
+
/** Publish-pipeline plugins (changelog, npm, GitHub, git), each scoped per package by semantic-release's own `cwd`. Defaults to the standard pipeline in DEFAULT_PUBLISH_PLUGINS for `commitStrategy: 'per-package'`, or SINGLE_COMMIT_DEFAULT_PUBLISH_PLUGINS (the same list minus @semantic-release/git) for `commitStrategy: 'single'`. */
|
|
193
205
|
readonly plugins?: readonly PublishPluginSpec[];
|
|
194
206
|
/** Options for the wrapped @semantic-release/commit-analyzer, applied per package after path filtering. */
|
|
195
207
|
readonly analyzeCommits?: Record<string, unknown>;
|
|
@@ -197,6 +209,8 @@ interface ReleaseWorkspaceOptions {
|
|
|
197
209
|
readonly generateNotes?: Record<string, unknown>;
|
|
198
210
|
/** Progress sink for the orchestrator's own narration (semantic-release logs its own detail). Defaults to `console.log`. */
|
|
199
211
|
readonly log?: (message: string) => void;
|
|
212
|
+
/** How the run commits its released changes. Defaults to `'per-package'`, today's exact existing behaviour. See `CommitStrategy` for what each mode does. */
|
|
213
|
+
readonly commitStrategy?: CommitStrategy;
|
|
200
214
|
}
|
|
201
215
|
/** One dependency-range change applied to a dependent package's manifest during the run, attached to the dependent's own outcome. */
|
|
202
216
|
interface AppliedDependencyBump extends DependencyBump {
|
|
@@ -256,4 +270,4 @@ declare class GitCommandError extends WorkspaceReleaseError {
|
|
|
256
270
|
/** The workspace's git state does not support the release operation -- for example a detached HEAD, which names no branch that dependency-bump commits could be pushed to. */
|
|
257
271
|
declare class WorkspaceStateError extends WorkspaceReleaseError {}
|
|
258
272
|
//#endregion
|
|
259
|
-
export { type AppliedDependencyBump, DEFAULT_PUBLISH_PLUGINS, type DependencyBump, type DependencyBumpSource, DependencyCycleError, type DependencyField, type DependencyGraph, type DependencyRangeShape, type DependencyRangeUpdate, GitCommandError, type PackageManifest, type PackageReleaseOutcome, type PublishPluginSpec, ReleaseConfigurationError, type ReleaseWorkspaceOptions, type ResolvedPublishPlugin, type ScopedPlugins, UnsupportedDependencyRangeError, type Workspace, type WorkspaceDependency, WorkspaceDiscoveryError, type WorkspacePackage, WorkspaceReleaseError, type WorkspaceReleaseOutcome, WorkspaceStateError, buildDependencyGraph, classifyDependencyRange, createScopedPlugins, discoverWorkspace, filterCommitsToDirectory, packageName, readManifest, releaseWorkspace, resolvePublishPlugins, topologicalOrder, updateDependencyRange, writeDependencyRange };
|
|
273
|
+
export { type AppliedDependencyBump, type CommitStrategy, DEFAULT_PUBLISH_PLUGINS, type DependencyBump, type DependencyBumpSource, DependencyCycleError, type DependencyField, type DependencyGraph, type DependencyRangeShape, type DependencyRangeUpdate, GitCommandError, type PackageManifest, type PackageReleaseOutcome, type PublishPluginSpec, ReleaseConfigurationError, type ReleaseWorkspaceOptions, type ResolvedPublishPlugin, SINGLE_COMMIT_DEFAULT_PUBLISH_PLUGINS, type ScopedPlugins, UnsupportedDependencyRangeError, type Workspace, type WorkspaceDependency, WorkspaceDiscoveryError, type WorkspacePackage, WorkspaceReleaseError, type WorkspaceReleaseOutcome, WorkspaceStateError, buildDependencyGraph, classifyDependencyRange, createScopedPlugins, discoverWorkspace, filterCommitsToDirectory, packageName, readManifest, releaseWorkspace, resolvePublishPlugins, topologicalOrder, updateDependencyRange, writeDependencyRange };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AnalyzeCommitsContext, BranchSpec, GenerateNotesContext } from "semantic-release";
|
|
1
|
+
import { AnalyzeCommitsContext, BranchSpec, Commit, GenerateNotesContext } from "semantic-release";
|
|
2
2
|
//#region src/package-name.d.ts
|
|
3
3
|
declare const packageName = "@exadev/semantic-release-workspace";
|
|
4
4
|
//#endregion
|
|
@@ -144,6 +144,8 @@ interface DependencyBumpSource {
|
|
|
144
144
|
type PublishPluginSpec = string | readonly [string] | readonly [string, Record<string, unknown>];
|
|
145
145
|
/** The standard publish pipeline this orchestrator coordinates when a workspace configures none of its own. Every entry reuses the corresponding official plugin -- the orchestrator scopes and sequences them per package, it does not reimplement npm publishing, GitHub release creation, or changelog writing. */
|
|
146
146
|
declare const DEFAULT_PUBLISH_PLUGINS: readonly PublishPluginSpec[];
|
|
147
|
+
/** The standard publish pipeline for `commitStrategy: 'single'`: the same as `DEFAULT_PUBLISH_PLUGINS` minus @semantic-release/git, which that mode never runs -- see `resolvePublishPlugins`'s `forbidGitPlugin` option for why it is rejected outright rather than merely unused. Single-commit mode does its own committing (one combined commit for every released package), so a `prepare`-step git plugin here would create the very per-package commits that mode exists to avoid. */
|
|
148
|
+
declare const SINGLE_COMMIT_DEFAULT_PUBLISH_PLUGINS: readonly PublishPluginSpec[];
|
|
147
149
|
interface ScopedPlugins {
|
|
148
150
|
readonly analyzeCommits: (pluginConfig: Record<string, unknown>, context: AnalyzeCommitsContext & {
|
|
149
151
|
cwd: string;
|
|
@@ -164,6 +166,8 @@ declare function createScopedPlugins(scope: {
|
|
|
164
166
|
readonly analyzeCommitsConfig: Record<string, unknown>;
|
|
165
167
|
readonly generateNotesConfig: Record<string, unknown>;
|
|
166
168
|
readonly bumps: DependencyBumpSource;
|
|
169
|
+
/** Called with the path-filtered commit list every time this package's commits are resolved (from either step, whichever runs first). Optional: `commitStrategy: 'single'` uses it to capture the same filtered list `success()`'s GitHub plugin step needs later, without recomputing `changedPathsSince`/`filterCommitsToDirectory` itself from the outside. */
|
|
170
|
+
readonly onCommitsResolved?: (commits: readonly Commit[]) => void;
|
|
167
171
|
}): ScopedPlugins;
|
|
168
172
|
/**
|
|
169
173
|
* Keeps a commit for the package when any path it changed lies under the package's directory. The trailing-slash prefix comparison stops `packages/a` from matching `packages/abc/x`.
|
|
@@ -177,9 +181,17 @@ declare function filterCommitsToDirectory<T extends {
|
|
|
177
181
|
type ResolvedPublishPlugin = [string, Record<string, unknown>];
|
|
178
182
|
declare function resolvePublishPlugins(specs: readonly PublishPluginSpec[], workspaceRoot: string, options: {
|
|
179
183
|
readonly requireGitPlugin: boolean;
|
|
184
|
+
readonly forbidGitPlugin?: boolean;
|
|
180
185
|
}): readonly ResolvedPublishPlugin[];
|
|
181
186
|
//#endregion
|
|
182
187
|
//#region src/release.d.ts
|
|
188
|
+
/**
|
|
189
|
+
* How a run commits its released changes:
|
|
190
|
+
*
|
|
191
|
+
* - `'per-package'` (the default): today's behaviour, unchanged. Each package's own semantic-release run commits, tags, and pushes itself the moment it releases, and each cross-package dependency bump is its own immediately-pushed commit. This is the byte-for-byte pre-existing behaviour of this package and stays the default so no existing consumer's release history changes shape without opting in.
|
|
192
|
+
* - `'single'`: every package's version bump, changelog, and dependency-range rewrite for the whole run is folded into one combined commit, tagged once per released package (all tags pointing at that one commit), pushed once. Publish-pipeline steps (npm, GitHub) still run per package afterward, scoped to the already-committed-and-tagged state. See `single-commit-release.ts` for the full design.
|
|
193
|
+
*/
|
|
194
|
+
type CommitStrategy = 'per-package' | 'single';
|
|
183
195
|
interface ReleaseWorkspaceOptions {
|
|
184
196
|
/** Directory holding the workspace's `pnpm-workspace.yaml`. Defaults to the process working directory. */
|
|
185
197
|
readonly root?: string;
|
|
@@ -189,7 +201,7 @@ interface ReleaseWorkspaceOptions {
|
|
|
189
201
|
readonly dryRun?: boolean;
|
|
190
202
|
/** Release branch configuration for semantic-release. Defaults to semantic-release's own default branch list. */
|
|
191
203
|
readonly branches?: readonly BranchSpec[];
|
|
192
|
-
/** Publish-pipeline plugins (changelog, npm, GitHub, git), each scoped per package by semantic-release's own `cwd`. Defaults to the standard pipeline in DEFAULT_PUBLISH_PLUGINS
|
|
204
|
+
/** Publish-pipeline plugins (changelog, npm, GitHub, git), each scoped per package by semantic-release's own `cwd`. Defaults to the standard pipeline in DEFAULT_PUBLISH_PLUGINS for `commitStrategy: 'per-package'`, or SINGLE_COMMIT_DEFAULT_PUBLISH_PLUGINS (the same list minus @semantic-release/git) for `commitStrategy: 'single'`. */
|
|
193
205
|
readonly plugins?: readonly PublishPluginSpec[];
|
|
194
206
|
/** Options for the wrapped @semantic-release/commit-analyzer, applied per package after path filtering. */
|
|
195
207
|
readonly analyzeCommits?: Record<string, unknown>;
|
|
@@ -197,6 +209,8 @@ interface ReleaseWorkspaceOptions {
|
|
|
197
209
|
readonly generateNotes?: Record<string, unknown>;
|
|
198
210
|
/** Progress sink for the orchestrator's own narration (semantic-release logs its own detail). Defaults to `console.log`. */
|
|
199
211
|
readonly log?: (message: string) => void;
|
|
212
|
+
/** How the run commits its released changes. Defaults to `'per-package'`, today's exact existing behaviour. See `CommitStrategy` for what each mode does. */
|
|
213
|
+
readonly commitStrategy?: CommitStrategy;
|
|
200
214
|
}
|
|
201
215
|
/** One dependency-range change applied to a dependent package's manifest during the run, attached to the dependent's own outcome. */
|
|
202
216
|
interface AppliedDependencyBump extends DependencyBump {
|
|
@@ -256,4 +270,4 @@ declare class GitCommandError extends WorkspaceReleaseError {
|
|
|
256
270
|
/** The workspace's git state does not support the release operation -- for example a detached HEAD, which names no branch that dependency-bump commits could be pushed to. */
|
|
257
271
|
declare class WorkspaceStateError extends WorkspaceReleaseError {}
|
|
258
272
|
//#endregion
|
|
259
|
-
export { type AppliedDependencyBump, DEFAULT_PUBLISH_PLUGINS, type DependencyBump, type DependencyBumpSource, DependencyCycleError, type DependencyField, type DependencyGraph, type DependencyRangeShape, type DependencyRangeUpdate, GitCommandError, type PackageManifest, type PackageReleaseOutcome, type PublishPluginSpec, ReleaseConfigurationError, type ReleaseWorkspaceOptions, type ResolvedPublishPlugin, type ScopedPlugins, UnsupportedDependencyRangeError, type Workspace, type WorkspaceDependency, WorkspaceDiscoveryError, type WorkspacePackage, WorkspaceReleaseError, type WorkspaceReleaseOutcome, WorkspaceStateError, buildDependencyGraph, classifyDependencyRange, createScopedPlugins, discoverWorkspace, filterCommitsToDirectory, packageName, readManifest, releaseWorkspace, resolvePublishPlugins, topologicalOrder, updateDependencyRange, writeDependencyRange };
|
|
273
|
+
export { type AppliedDependencyBump, type CommitStrategy, DEFAULT_PUBLISH_PLUGINS, type DependencyBump, type DependencyBumpSource, DependencyCycleError, type DependencyField, type DependencyGraph, type DependencyRangeShape, type DependencyRangeUpdate, GitCommandError, type PackageManifest, type PackageReleaseOutcome, type PublishPluginSpec, ReleaseConfigurationError, type ReleaseWorkspaceOptions, type ResolvedPublishPlugin, SINGLE_COMMIT_DEFAULT_PUBLISH_PLUGINS, type ScopedPlugins, UnsupportedDependencyRangeError, type Workspace, type WorkspaceDependency, WorkspaceDiscoveryError, type WorkspacePackage, WorkspaceReleaseError, type WorkspaceReleaseOutcome, WorkspaceStateError, buildDependencyGraph, classifyDependencyRange, createScopedPlugins, discoverWorkspace, filterCommitsToDirectory, packageName, readManifest, releaseWorkspace, resolvePublishPlugins, topologicalOrder, updateDependencyRange, writeDependencyRange };
|