pubm 0.0.5 → 0.1.2
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 +60 -126
- package/bin/cli.js +958 -315
- package/dist/index.cjs +999 -83
- package/dist/index.d.cts +180 -2
- package/dist/index.d.ts +180 -2
- package/dist/index.js +980 -82
- package/package.json +92 -84
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
type RegistryType =
|
|
1
|
+
type RegistryType = "npm" | "jsr" | "crates" | string;
|
|
2
2
|
/**
|
|
3
3
|
* Options for configuring the {@linkcode pubm} function.
|
|
4
4
|
*/
|
|
@@ -88,6 +88,184 @@ interface Options {
|
|
|
88
88
|
registries?: RegistryType[];
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
+
type BumpType = "patch" | "minor" | "major";
|
|
92
|
+
interface Release {
|
|
93
|
+
name: string;
|
|
94
|
+
type: BumpType;
|
|
95
|
+
}
|
|
96
|
+
interface Changeset {
|
|
97
|
+
id: string;
|
|
98
|
+
summary: string;
|
|
99
|
+
releases: Release[];
|
|
100
|
+
}
|
|
101
|
+
declare function parseChangeset(content: string, fileName: string): Changeset;
|
|
102
|
+
|
|
103
|
+
interface ChangelogEntry {
|
|
104
|
+
summary: string;
|
|
105
|
+
type: BumpType;
|
|
106
|
+
id: string;
|
|
107
|
+
}
|
|
108
|
+
interface DependencyUpdate {
|
|
109
|
+
name: string;
|
|
110
|
+
version: string;
|
|
111
|
+
}
|
|
112
|
+
declare function generateChangelog(version: string, entries: ChangelogEntry[], depUpdates?: DependencyUpdate[]): string;
|
|
113
|
+
|
|
114
|
+
interface MigrationResult {
|
|
115
|
+
success: boolean;
|
|
116
|
+
error?: string;
|
|
117
|
+
migratedFiles: string[];
|
|
118
|
+
configMigrated: boolean;
|
|
119
|
+
}
|
|
120
|
+
declare function migrateFromChangesets(cwd?: string): MigrationResult;
|
|
121
|
+
|
|
122
|
+
declare function readChangesets(cwd?: string): Changeset[];
|
|
123
|
+
|
|
124
|
+
interface PackageStatus {
|
|
125
|
+
bumpType: BumpType;
|
|
126
|
+
changesetCount: number;
|
|
127
|
+
summaries: string[];
|
|
128
|
+
}
|
|
129
|
+
interface Status {
|
|
130
|
+
packages: Map<string, PackageStatus>;
|
|
131
|
+
changesets: Changeset[];
|
|
132
|
+
hasChangesets: boolean;
|
|
133
|
+
}
|
|
134
|
+
declare function getStatus(cwd?: string): Status;
|
|
135
|
+
|
|
136
|
+
interface VersionBump {
|
|
137
|
+
currentVersion: string;
|
|
138
|
+
newVersion: string;
|
|
139
|
+
bumpType: BumpType;
|
|
140
|
+
}
|
|
141
|
+
declare function calculateVersionBumps(currentVersions: Map<string, string>, cwd?: string): Map<string, VersionBump>;
|
|
142
|
+
|
|
143
|
+
declare function generateChangesetId(): string;
|
|
144
|
+
declare function generateChangesetContent(releases: Release[], summary: string): string;
|
|
145
|
+
declare function writeChangeset(releases: Release[], summary: string, cwd?: string): string;
|
|
146
|
+
|
|
147
|
+
interface PackageConfig {
|
|
148
|
+
path: string;
|
|
149
|
+
registries: RegistryType[];
|
|
150
|
+
buildCommand?: string;
|
|
151
|
+
testCommand?: string;
|
|
152
|
+
}
|
|
153
|
+
interface ValidateConfig {
|
|
154
|
+
cleanInstall?: boolean;
|
|
155
|
+
entryPoints?: boolean;
|
|
156
|
+
extraneousFiles?: boolean;
|
|
157
|
+
}
|
|
158
|
+
interface SnapshotConfig {
|
|
159
|
+
useCalculatedVersion?: boolean;
|
|
160
|
+
prereleaseTemplate?: string;
|
|
161
|
+
}
|
|
162
|
+
interface PubmConfig {
|
|
163
|
+
versioning?: "independent" | "fixed";
|
|
164
|
+
branch?: string;
|
|
165
|
+
registries?: RegistryType[];
|
|
166
|
+
packages?: PackageConfig[];
|
|
167
|
+
changelog?: boolean | string;
|
|
168
|
+
changelogFormat?: "default" | "github" | string;
|
|
169
|
+
commit?: boolean;
|
|
170
|
+
access?: "public" | "restricted";
|
|
171
|
+
fixed?: string[][];
|
|
172
|
+
linked?: string[][];
|
|
173
|
+
updateInternalDependencies?: "patch" | "minor";
|
|
174
|
+
ignore?: string[];
|
|
175
|
+
validate?: ValidateConfig;
|
|
176
|
+
snapshot?: SnapshotConfig;
|
|
177
|
+
tag?: string;
|
|
178
|
+
contents?: string;
|
|
179
|
+
saveToken?: boolean;
|
|
180
|
+
releaseDraft?: boolean;
|
|
181
|
+
releaseNotes?: boolean;
|
|
182
|
+
rollbackStrategy?: "individual" | "all";
|
|
183
|
+
}
|
|
184
|
+
interface ResolvedPubmConfig extends Required<Omit<PubmConfig, "packages" | "validate" | "snapshot">> {
|
|
185
|
+
packages: PackageConfig[];
|
|
186
|
+
validate: Required<ValidateConfig>;
|
|
187
|
+
snapshot: Required<SnapshotConfig>;
|
|
188
|
+
}
|
|
189
|
+
declare function defineConfig(config: PubmConfig): PubmConfig;
|
|
190
|
+
|
|
191
|
+
declare function resolveConfig(config: PubmConfig): ResolvedPubmConfig;
|
|
192
|
+
|
|
193
|
+
declare function loadConfig(cwd?: string): Promise<PubmConfig | null>;
|
|
194
|
+
|
|
195
|
+
interface PackageNode {
|
|
196
|
+
name: string;
|
|
197
|
+
version: string;
|
|
198
|
+
path: string;
|
|
199
|
+
dependencies: Record<string, string>;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Builds an adjacency list of internal dependencies only.
|
|
203
|
+
* Each key is a package name, and the value is an array of internal package names it depends on.
|
|
204
|
+
*/
|
|
205
|
+
declare function buildDependencyGraph(packages: PackageNode[]): Map<string, string[]>;
|
|
206
|
+
/**
|
|
207
|
+
* Topological sort using Kahn's algorithm.
|
|
208
|
+
* Returns packages in dependency order (dependencies first).
|
|
209
|
+
* Throws an error if circular dependencies are detected.
|
|
210
|
+
*/
|
|
211
|
+
declare function topologicalSort(graph: Map<string, string[]>): string[];
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* Resolves glob patterns in groups to actual package names.
|
|
215
|
+
* Exact names are passed through; glob patterns are matched against allPackages.
|
|
216
|
+
*/
|
|
217
|
+
declare function resolveGroups(groups: string[][], allPackages: string[]): string[][];
|
|
218
|
+
/**
|
|
219
|
+
* Fixed group: all packages in the group get the maximum bump type,
|
|
220
|
+
* even those without changesets. If no packages in the group have bumps,
|
|
221
|
+
* nothing is changed.
|
|
222
|
+
*/
|
|
223
|
+
declare function applyFixedGroup(bumps: Map<string, BumpType>, group: string[]): void;
|
|
224
|
+
/**
|
|
225
|
+
* Linked group: only packages that already have bumps get aligned
|
|
226
|
+
* to the maximum bump type. Packages without bumps are not added.
|
|
227
|
+
*/
|
|
228
|
+
declare function applyLinkedGroup(bumps: Map<string, BumpType>, group: string[]): void;
|
|
229
|
+
|
|
230
|
+
interface WorkspaceInfo {
|
|
231
|
+
type: "pnpm" | "npm" | "yarn";
|
|
232
|
+
patterns: string[];
|
|
233
|
+
}
|
|
234
|
+
declare function detectWorkspace(cwd?: string): WorkspaceInfo | null;
|
|
235
|
+
|
|
236
|
+
interface PreState {
|
|
237
|
+
mode: "pre";
|
|
238
|
+
tag: string;
|
|
239
|
+
packages: Record<string, {
|
|
240
|
+
baseVersion: string;
|
|
241
|
+
iteration: number;
|
|
242
|
+
}>;
|
|
243
|
+
}
|
|
244
|
+
declare function readPreState(cwd?: string): PreState | null;
|
|
245
|
+
declare function enterPreMode(tag: string, cwd?: string): void;
|
|
246
|
+
declare function exitPreMode(cwd?: string): void;
|
|
247
|
+
|
|
248
|
+
interface SnapshotOptions {
|
|
249
|
+
tag?: string;
|
|
250
|
+
baseVersion?: string;
|
|
251
|
+
useCalculatedVersion?: boolean;
|
|
252
|
+
template?: string;
|
|
253
|
+
commit?: string;
|
|
254
|
+
}
|
|
255
|
+
declare function generateSnapshotVersion(options: SnapshotOptions): string;
|
|
256
|
+
|
|
257
|
+
interface EntryPointError {
|
|
258
|
+
field: string;
|
|
259
|
+
path: string;
|
|
260
|
+
}
|
|
261
|
+
declare function validateEntryPoints(pkg: Record<string, unknown>, cwd: string): EntryPointError[];
|
|
262
|
+
|
|
263
|
+
interface ExtraneousFile {
|
|
264
|
+
file: string;
|
|
265
|
+
reason: string;
|
|
266
|
+
}
|
|
267
|
+
declare function detectExtraneousFiles(files: string[]): ExtraneousFile[];
|
|
268
|
+
|
|
91
269
|
/**
|
|
92
270
|
* Runs the `pubm` function with the provided options.
|
|
93
271
|
*
|
|
@@ -100,4 +278,4 @@ interface Options {
|
|
|
100
278
|
*/
|
|
101
279
|
declare function pubm(options: Options): Promise<void>;
|
|
102
280
|
|
|
103
|
-
export { type Options, pubm };
|
|
281
|
+
export { type BumpType, type ChangelogEntry, type Changeset, type DependencyUpdate, type EntryPointError, type ExtraneousFile, type MigrationResult, type Options, type PackageConfig, type PackageNode, type PackageStatus, type PreState, type PubmConfig, type Release, type ResolvedPubmConfig, type SnapshotOptions, type Status, type VersionBump, type WorkspaceInfo, applyFixedGroup, applyLinkedGroup, buildDependencyGraph, calculateVersionBumps, defineConfig, detectExtraneousFiles, detectWorkspace, enterPreMode, exitPreMode, generateChangelog, generateChangesetContent, generateChangesetId, generateSnapshotVersion, getStatus, loadConfig, migrateFromChangesets, parseChangeset, pubm, readChangesets, readPreState, resolveConfig, resolveGroups, topologicalSort, validateEntryPoints, writeChangeset };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
type RegistryType =
|
|
1
|
+
type RegistryType = "npm" | "jsr" | "crates" | string;
|
|
2
2
|
/**
|
|
3
3
|
* Options for configuring the {@linkcode pubm} function.
|
|
4
4
|
*/
|
|
@@ -88,6 +88,184 @@ interface Options {
|
|
|
88
88
|
registries?: RegistryType[];
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
+
type BumpType = "patch" | "minor" | "major";
|
|
92
|
+
interface Release {
|
|
93
|
+
name: string;
|
|
94
|
+
type: BumpType;
|
|
95
|
+
}
|
|
96
|
+
interface Changeset {
|
|
97
|
+
id: string;
|
|
98
|
+
summary: string;
|
|
99
|
+
releases: Release[];
|
|
100
|
+
}
|
|
101
|
+
declare function parseChangeset(content: string, fileName: string): Changeset;
|
|
102
|
+
|
|
103
|
+
interface ChangelogEntry {
|
|
104
|
+
summary: string;
|
|
105
|
+
type: BumpType;
|
|
106
|
+
id: string;
|
|
107
|
+
}
|
|
108
|
+
interface DependencyUpdate {
|
|
109
|
+
name: string;
|
|
110
|
+
version: string;
|
|
111
|
+
}
|
|
112
|
+
declare function generateChangelog(version: string, entries: ChangelogEntry[], depUpdates?: DependencyUpdate[]): string;
|
|
113
|
+
|
|
114
|
+
interface MigrationResult {
|
|
115
|
+
success: boolean;
|
|
116
|
+
error?: string;
|
|
117
|
+
migratedFiles: string[];
|
|
118
|
+
configMigrated: boolean;
|
|
119
|
+
}
|
|
120
|
+
declare function migrateFromChangesets(cwd?: string): MigrationResult;
|
|
121
|
+
|
|
122
|
+
declare function readChangesets(cwd?: string): Changeset[];
|
|
123
|
+
|
|
124
|
+
interface PackageStatus {
|
|
125
|
+
bumpType: BumpType;
|
|
126
|
+
changesetCount: number;
|
|
127
|
+
summaries: string[];
|
|
128
|
+
}
|
|
129
|
+
interface Status {
|
|
130
|
+
packages: Map<string, PackageStatus>;
|
|
131
|
+
changesets: Changeset[];
|
|
132
|
+
hasChangesets: boolean;
|
|
133
|
+
}
|
|
134
|
+
declare function getStatus(cwd?: string): Status;
|
|
135
|
+
|
|
136
|
+
interface VersionBump {
|
|
137
|
+
currentVersion: string;
|
|
138
|
+
newVersion: string;
|
|
139
|
+
bumpType: BumpType;
|
|
140
|
+
}
|
|
141
|
+
declare function calculateVersionBumps(currentVersions: Map<string, string>, cwd?: string): Map<string, VersionBump>;
|
|
142
|
+
|
|
143
|
+
declare function generateChangesetId(): string;
|
|
144
|
+
declare function generateChangesetContent(releases: Release[], summary: string): string;
|
|
145
|
+
declare function writeChangeset(releases: Release[], summary: string, cwd?: string): string;
|
|
146
|
+
|
|
147
|
+
interface PackageConfig {
|
|
148
|
+
path: string;
|
|
149
|
+
registries: RegistryType[];
|
|
150
|
+
buildCommand?: string;
|
|
151
|
+
testCommand?: string;
|
|
152
|
+
}
|
|
153
|
+
interface ValidateConfig {
|
|
154
|
+
cleanInstall?: boolean;
|
|
155
|
+
entryPoints?: boolean;
|
|
156
|
+
extraneousFiles?: boolean;
|
|
157
|
+
}
|
|
158
|
+
interface SnapshotConfig {
|
|
159
|
+
useCalculatedVersion?: boolean;
|
|
160
|
+
prereleaseTemplate?: string;
|
|
161
|
+
}
|
|
162
|
+
interface PubmConfig {
|
|
163
|
+
versioning?: "independent" | "fixed";
|
|
164
|
+
branch?: string;
|
|
165
|
+
registries?: RegistryType[];
|
|
166
|
+
packages?: PackageConfig[];
|
|
167
|
+
changelog?: boolean | string;
|
|
168
|
+
changelogFormat?: "default" | "github" | string;
|
|
169
|
+
commit?: boolean;
|
|
170
|
+
access?: "public" | "restricted";
|
|
171
|
+
fixed?: string[][];
|
|
172
|
+
linked?: string[][];
|
|
173
|
+
updateInternalDependencies?: "patch" | "minor";
|
|
174
|
+
ignore?: string[];
|
|
175
|
+
validate?: ValidateConfig;
|
|
176
|
+
snapshot?: SnapshotConfig;
|
|
177
|
+
tag?: string;
|
|
178
|
+
contents?: string;
|
|
179
|
+
saveToken?: boolean;
|
|
180
|
+
releaseDraft?: boolean;
|
|
181
|
+
releaseNotes?: boolean;
|
|
182
|
+
rollbackStrategy?: "individual" | "all";
|
|
183
|
+
}
|
|
184
|
+
interface ResolvedPubmConfig extends Required<Omit<PubmConfig, "packages" | "validate" | "snapshot">> {
|
|
185
|
+
packages: PackageConfig[];
|
|
186
|
+
validate: Required<ValidateConfig>;
|
|
187
|
+
snapshot: Required<SnapshotConfig>;
|
|
188
|
+
}
|
|
189
|
+
declare function defineConfig(config: PubmConfig): PubmConfig;
|
|
190
|
+
|
|
191
|
+
declare function resolveConfig(config: PubmConfig): ResolvedPubmConfig;
|
|
192
|
+
|
|
193
|
+
declare function loadConfig(cwd?: string): Promise<PubmConfig | null>;
|
|
194
|
+
|
|
195
|
+
interface PackageNode {
|
|
196
|
+
name: string;
|
|
197
|
+
version: string;
|
|
198
|
+
path: string;
|
|
199
|
+
dependencies: Record<string, string>;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Builds an adjacency list of internal dependencies only.
|
|
203
|
+
* Each key is a package name, and the value is an array of internal package names it depends on.
|
|
204
|
+
*/
|
|
205
|
+
declare function buildDependencyGraph(packages: PackageNode[]): Map<string, string[]>;
|
|
206
|
+
/**
|
|
207
|
+
* Topological sort using Kahn's algorithm.
|
|
208
|
+
* Returns packages in dependency order (dependencies first).
|
|
209
|
+
* Throws an error if circular dependencies are detected.
|
|
210
|
+
*/
|
|
211
|
+
declare function topologicalSort(graph: Map<string, string[]>): string[];
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* Resolves glob patterns in groups to actual package names.
|
|
215
|
+
* Exact names are passed through; glob patterns are matched against allPackages.
|
|
216
|
+
*/
|
|
217
|
+
declare function resolveGroups(groups: string[][], allPackages: string[]): string[][];
|
|
218
|
+
/**
|
|
219
|
+
* Fixed group: all packages in the group get the maximum bump type,
|
|
220
|
+
* even those without changesets. If no packages in the group have bumps,
|
|
221
|
+
* nothing is changed.
|
|
222
|
+
*/
|
|
223
|
+
declare function applyFixedGroup(bumps: Map<string, BumpType>, group: string[]): void;
|
|
224
|
+
/**
|
|
225
|
+
* Linked group: only packages that already have bumps get aligned
|
|
226
|
+
* to the maximum bump type. Packages without bumps are not added.
|
|
227
|
+
*/
|
|
228
|
+
declare function applyLinkedGroup(bumps: Map<string, BumpType>, group: string[]): void;
|
|
229
|
+
|
|
230
|
+
interface WorkspaceInfo {
|
|
231
|
+
type: "pnpm" | "npm" | "yarn";
|
|
232
|
+
patterns: string[];
|
|
233
|
+
}
|
|
234
|
+
declare function detectWorkspace(cwd?: string): WorkspaceInfo | null;
|
|
235
|
+
|
|
236
|
+
interface PreState {
|
|
237
|
+
mode: "pre";
|
|
238
|
+
tag: string;
|
|
239
|
+
packages: Record<string, {
|
|
240
|
+
baseVersion: string;
|
|
241
|
+
iteration: number;
|
|
242
|
+
}>;
|
|
243
|
+
}
|
|
244
|
+
declare function readPreState(cwd?: string): PreState | null;
|
|
245
|
+
declare function enterPreMode(tag: string, cwd?: string): void;
|
|
246
|
+
declare function exitPreMode(cwd?: string): void;
|
|
247
|
+
|
|
248
|
+
interface SnapshotOptions {
|
|
249
|
+
tag?: string;
|
|
250
|
+
baseVersion?: string;
|
|
251
|
+
useCalculatedVersion?: boolean;
|
|
252
|
+
template?: string;
|
|
253
|
+
commit?: string;
|
|
254
|
+
}
|
|
255
|
+
declare function generateSnapshotVersion(options: SnapshotOptions): string;
|
|
256
|
+
|
|
257
|
+
interface EntryPointError {
|
|
258
|
+
field: string;
|
|
259
|
+
path: string;
|
|
260
|
+
}
|
|
261
|
+
declare function validateEntryPoints(pkg: Record<string, unknown>, cwd: string): EntryPointError[];
|
|
262
|
+
|
|
263
|
+
interface ExtraneousFile {
|
|
264
|
+
file: string;
|
|
265
|
+
reason: string;
|
|
266
|
+
}
|
|
267
|
+
declare function detectExtraneousFiles(files: string[]): ExtraneousFile[];
|
|
268
|
+
|
|
91
269
|
/**
|
|
92
270
|
* Runs the `pubm` function with the provided options.
|
|
93
271
|
*
|
|
@@ -100,4 +278,4 @@ interface Options {
|
|
|
100
278
|
*/
|
|
101
279
|
declare function pubm(options: Options): Promise<void>;
|
|
102
280
|
|
|
103
|
-
export { type Options, pubm };
|
|
281
|
+
export { type BumpType, type ChangelogEntry, type Changeset, type DependencyUpdate, type EntryPointError, type ExtraneousFile, type MigrationResult, type Options, type PackageConfig, type PackageNode, type PackageStatus, type PreState, type PubmConfig, type Release, type ResolvedPubmConfig, type SnapshotOptions, type Status, type VersionBump, type WorkspaceInfo, applyFixedGroup, applyLinkedGroup, buildDependencyGraph, calculateVersionBumps, defineConfig, detectExtraneousFiles, detectWorkspace, enterPreMode, exitPreMode, generateChangelog, generateChangesetContent, generateChangesetId, generateSnapshotVersion, getStatus, loadConfig, migrateFromChangesets, parseChangeset, pubm, readChangesets, readPreState, resolveConfig, resolveGroups, topologicalSort, validateEntryPoints, writeChangeset };
|