tegami 0.1.6 → 0.2.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/api-D-jf_8xY.js +116 -0
- package/dist/cli/index.d.ts +4 -4
- package/dist/cli/index.js +94 -126
- package/dist/{generate-B3bcuKLY.js → generate-BMlrn-2e.js} +36 -18
- package/dist/generators/simple.d.ts +1 -1
- package/dist/generators/simple.js +3 -3
- package/dist/{graph-DLKPUXSD.js → graph-DrzluXw8.js} +17 -10
- package/dist/index.d.ts +2 -2
- package/dist/index.js +478 -105
- package/dist/plugins/git.d.ts +1 -1
- package/dist/plugins/git.js +39 -35
- package/dist/plugins/github.d.ts +28 -15
- package/dist/plugins/github.js +158 -158
- package/dist/providers/cargo.d.ts +2 -2
- package/dist/providers/cargo.js +86 -100
- package/dist/providers/npm.d.ts +2 -2
- package/dist/providers/npm.js +132 -129
- package/dist/schemas-B7N6EE2k.js +26 -0
- package/dist/{types-DexeJdl7.d.ts → types-CurHqnWl.d.ts} +199 -229
- package/package.json +6 -7
- package/dist/checks-azjuIFt7.js +0 -109
- package/dist/publish-DkRT0yh6.js +0 -282
- package/dist/schemas-CurBAaW5.js +0 -42
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import z
|
|
1
|
+
import z, { z as z$1 } from "zod";
|
|
2
2
|
import { AgentName } from "package-manager-detector";
|
|
3
3
|
|
|
4
4
|
//#region src/utils/semver.d.ts
|
|
5
5
|
type BumpType = "major" | "minor" | "patch";
|
|
6
6
|
//#endregion
|
|
7
7
|
//#region src/changelog/shared.d.ts
|
|
8
|
-
declare const changelogPackageConfigSchema: z
|
|
9
|
-
type: z
|
|
8
|
+
declare const changelogPackageConfigSchema: z.ZodObject<{
|
|
9
|
+
type: z.ZodOptional<z.ZodEnum<{
|
|
10
10
|
major: "major";
|
|
11
11
|
minor: "minor";
|
|
12
12
|
patch: "patch";
|
|
13
13
|
}>>;
|
|
14
|
-
replay: z
|
|
15
|
-
}, z
|
|
16
|
-
type ChangelogPackageConfig = z
|
|
14
|
+
replay: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
15
|
+
}, z.core.$strip>;
|
|
16
|
+
type ChangelogPackageConfig = z.output<typeof changelogPackageConfigSchema>;
|
|
17
17
|
//#endregion
|
|
18
18
|
//#region src/changelog/parse.d.ts
|
|
19
19
|
interface ChangelogEntry {
|
|
@@ -28,69 +28,69 @@ interface ChangelogEntry {
|
|
|
28
28
|
title: string;
|
|
29
29
|
content: string;
|
|
30
30
|
}[];
|
|
31
|
+
/** Generated in memory and not yet written to `changelogDir`. */
|
|
32
|
+
virtual?: boolean;
|
|
31
33
|
getRawContent: () => string;
|
|
32
34
|
}
|
|
33
35
|
//#endregion
|
|
34
36
|
//#region src/plans/draft.d.ts
|
|
35
|
-
interface
|
|
37
|
+
interface PackageDraft {
|
|
36
38
|
type?: BumpType;
|
|
39
|
+
prerelease?: string;
|
|
37
40
|
bumpReasons?: Set<string>;
|
|
38
41
|
changelogs?: ChangelogEntry[];
|
|
39
|
-
prerelease?: string;
|
|
40
|
-
publish?: boolean;
|
|
41
42
|
npm?: {
|
|
42
43
|
/** npm dist-tag used when publishing. */distTag?: string;
|
|
43
44
|
};
|
|
44
45
|
/** get the bumped version of a package */
|
|
45
46
|
bumpVersion: (pkg: WorkspacePackage) => string;
|
|
46
47
|
}
|
|
47
|
-
|
|
48
|
+
/** a draft describes all operations to perform before the actual publishing, such as version bumps. */
|
|
49
|
+
declare class Draft {
|
|
48
50
|
#private;
|
|
49
51
|
private readonly context;
|
|
52
|
+
/** package id -> draft */
|
|
50
53
|
private readonly packages;
|
|
54
|
+
/** id -> changelog */
|
|
51
55
|
private readonly changelogs;
|
|
52
56
|
private readonly policies;
|
|
53
57
|
constructor(context: TegamiContext);
|
|
54
|
-
|
|
55
|
-
|
|
58
|
+
getPackageDrafts(): Map<string, PackageDraft>;
|
|
59
|
+
getPackageDraft(id: string): PackageDraft | undefined;
|
|
56
60
|
bumpPackage(pkg: WorkspacePackage, {
|
|
57
61
|
type,
|
|
58
62
|
reason
|
|
59
63
|
}: {
|
|
60
64
|
type: BumpType;
|
|
61
65
|
reason?: string;
|
|
62
|
-
}):
|
|
63
|
-
dispatchPackage(pkg: WorkspacePackage, dispatch: (
|
|
64
|
-
getOrInitPackage(pkg: WorkspacePackage):
|
|
66
|
+
}): PackageDraft;
|
|
67
|
+
dispatchPackage(pkg: WorkspacePackage, dispatch: (draft: PackageDraft) => void, onUpdate?: (draft: PackageDraft) => void): PackageDraft;
|
|
68
|
+
getOrInitPackage(pkg: WorkspacePackage): PackageDraft;
|
|
65
69
|
hasPending(): boolean;
|
|
66
70
|
getChangelogs(): ChangelogEntry[];
|
|
67
71
|
getChangelog(id: string): ChangelogEntry | undefined;
|
|
68
72
|
addChangelog(entry: ChangelogEntry): void;
|
|
69
73
|
deleteChangelog(id: string): boolean;
|
|
70
|
-
/** Apply
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
+
/** Apply version bumps, lock file, and changelog files. */
|
|
75
|
+
apply(): Promise<void>;
|
|
76
|
+
/** write persistent data to publish lock */
|
|
77
|
+
private writeLockFile;
|
|
78
|
+
addPolicy(policy: DraftPolicy): void;
|
|
79
|
+
removePolicy(policy: DraftPolicy): void;
|
|
74
80
|
canApply(): boolean;
|
|
75
81
|
/** Attach replaying changelog entries to packages (already bumped), and return the updated changelog entries. */
|
|
76
82
|
private applyReplays;
|
|
77
83
|
private appendChangelog;
|
|
78
|
-
/** {@link
|
|
84
|
+
/** {@link apply} but for `await using` syntax */
|
|
79
85
|
[Symbol.asyncDispose](): Promise<void>;
|
|
80
86
|
}
|
|
81
|
-
interface
|
|
87
|
+
interface DraftPolicy {
|
|
82
88
|
id: string;
|
|
83
|
-
onUpdate?: (this:
|
|
84
|
-
|
|
89
|
+
onUpdate?: (this: Draft, opts: {
|
|
90
|
+
packageDraft: PackageDraft;
|
|
85
91
|
pkg: WorkspacePackage;
|
|
86
92
|
}) => void;
|
|
87
93
|
}
|
|
88
|
-
type CleanupResult = {
|
|
89
|
-
state: "removed";
|
|
90
|
-
} | {
|
|
91
|
-
state: "skipped";
|
|
92
|
-
reason: "missing" | "pending";
|
|
93
|
-
};
|
|
94
94
|
//#endregion
|
|
95
95
|
//#region src/graph.d.ts
|
|
96
96
|
/** Package discovered in the workspace. */
|
|
@@ -104,10 +104,10 @@ declare abstract class WorkspacePackage {
|
|
|
104
104
|
/** note: this will only be available after package graph is resolved */
|
|
105
105
|
getPackageOptions(): PackageOptions;
|
|
106
106
|
setPackageOptions(options: PackageOptions): void;
|
|
107
|
-
/** create the initial draft
|
|
108
|
-
|
|
109
|
-
/** configure an initial draft
|
|
110
|
-
|
|
107
|
+
/** create the initial draft. */
|
|
108
|
+
initDraft(): PackageDraft;
|
|
109
|
+
/** configure an initial draft to match script-level configs. */
|
|
110
|
+
configureDraft(draft: PackageDraft, group?: PackageGroup): void;
|
|
111
111
|
}
|
|
112
112
|
interface PackageGroup {
|
|
113
113
|
name: string;
|
|
@@ -143,12 +143,10 @@ interface TegamiContext {
|
|
|
143
143
|
/** absolute path */
|
|
144
144
|
changelogDir: string;
|
|
145
145
|
/** absolute path */
|
|
146
|
-
|
|
146
|
+
lockPath: string;
|
|
147
147
|
options: TegamiOptions;
|
|
148
148
|
plugins: TegamiPlugin[];
|
|
149
149
|
graph: PackageGraph;
|
|
150
|
-
/** error if doesn't exist */
|
|
151
|
-
getRegistryClient(pkgOrId: WorkspacePackage | string): RegistryClient;
|
|
152
150
|
/** additional context when GitHub plugin is configured */
|
|
153
151
|
github?: {
|
|
154
152
|
repo?: string;
|
|
@@ -160,96 +158,14 @@ interface TegamiContext {
|
|
|
160
158
|
};
|
|
161
159
|
}
|
|
162
160
|
//#endregion
|
|
163
|
-
//#region src/plans/store.d.ts
|
|
164
|
-
declare const packagePlanStoreSchema: z$1.ZodObject<{
|
|
165
|
-
type: z$1.ZodOptional<z$1.ZodEnum<{
|
|
166
|
-
major: "major";
|
|
167
|
-
minor: "minor";
|
|
168
|
-
patch: "patch";
|
|
169
|
-
}>>;
|
|
170
|
-
changelogIds: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
|
|
171
|
-
bumpReasons: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
|
|
172
|
-
npm: z$1.ZodOptional<z$1.ZodObject<{
|
|
173
|
-
distTag: z$1.ZodOptional<z$1.ZodString>;
|
|
174
|
-
}, z$1.core.$strip>>;
|
|
175
|
-
publish: z$1.ZodBoolean;
|
|
176
|
-
}, z$1.core.$strip>;
|
|
177
|
-
/** the persisted plan data for actual publishing */
|
|
178
|
-
declare const planStoreSchema: z$1.ZodCodec<z$1.ZodString, z$1.ZodObject<{
|
|
179
|
-
id: z$1.ZodString;
|
|
180
|
-
createdAt: z$1.ZodISODateTime;
|
|
181
|
-
version: z$1.ZodDefault<z$1.ZodLiteral<"0.0.0">>;
|
|
182
|
-
changelogs: z$1.ZodRecord<z$1.ZodString, z$1.ZodObject<{
|
|
183
|
-
filename: z$1.ZodString;
|
|
184
|
-
content: z$1.ZodString;
|
|
185
|
-
}, z$1.core.$strip>>;
|
|
186
|
-
packages: z$1.ZodRecord<z$1.ZodString, z$1.ZodObject<{
|
|
187
|
-
type: z$1.ZodOptional<z$1.ZodEnum<{
|
|
188
|
-
major: "major";
|
|
189
|
-
minor: "minor";
|
|
190
|
-
patch: "patch";
|
|
191
|
-
}>>;
|
|
192
|
-
changelogIds: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
|
|
193
|
-
bumpReasons: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
|
|
194
|
-
npm: z$1.ZodOptional<z$1.ZodObject<{
|
|
195
|
-
distTag: z$1.ZodOptional<z$1.ZodString>;
|
|
196
|
-
}, z$1.core.$strip>>;
|
|
197
|
-
publish: z$1.ZodBoolean;
|
|
198
|
-
}, z$1.core.$strip>>;
|
|
199
|
-
}, z$1.core.$strip>>;
|
|
200
|
-
type PlanStore = z$1.output<typeof planStoreSchema>;
|
|
201
|
-
type PackagePlanStore = z$1.output<typeof packagePlanStoreSchema>;
|
|
202
|
-
//#endregion
|
|
203
|
-
//#region src/publish.d.ts
|
|
204
|
-
interface PublishOptions {
|
|
205
|
-
/** Validate the publish plan without publishing packages, creating tags, or running release plugins. */
|
|
206
|
-
dryRun?: boolean;
|
|
207
|
-
}
|
|
208
|
-
type PublishResult = {
|
|
209
|
-
state: "created";
|
|
210
|
-
packages: PackagePublishResult[]; /** the persisted plan object. This is not a public API, can be changed without notice */
|
|
211
|
-
_rawPlan: PlanStore;
|
|
212
|
-
} | {
|
|
213
|
-
state: "failed";
|
|
214
|
-
error?: string;
|
|
215
|
-
packages: PackagePublishResult[]; /** the persisted plan object. This is not a public API, can be changed without notice */
|
|
216
|
-
_rawPlan: PlanStore;
|
|
217
|
-
} | {
|
|
218
|
-
state: "skipped";
|
|
219
|
-
};
|
|
220
|
-
type PackagePublishResult = ({
|
|
221
|
-
state: "failed";
|
|
222
|
-
error?: string;
|
|
223
|
-
} | {
|
|
224
|
-
state: "success";
|
|
225
|
-
}) & {
|
|
226
|
-
id: string;
|
|
227
|
-
name: string;
|
|
228
|
-
version: string;
|
|
229
|
-
npm?: {
|
|
230
|
-
distTag?: string;
|
|
231
|
-
};
|
|
232
|
-
git?: {
|
|
233
|
-
/** will be defined even if publishing fails */tag: string;
|
|
234
|
-
tagState: "created" | "skipped" | "failed";
|
|
235
|
-
};
|
|
236
|
-
changelogs: ChangelogEntry[];
|
|
237
|
-
};
|
|
238
|
-
//#endregion
|
|
239
161
|
//#region src/changelog/generate.d.ts
|
|
240
|
-
interface
|
|
162
|
+
interface GenerateFromCommitsOptions {
|
|
241
163
|
/** Start revision. Defaults to the latest reachable git tag, or all history if none exists. */
|
|
242
164
|
from?: string;
|
|
243
165
|
/** End revision. Defaults to HEAD. */
|
|
244
166
|
to?: string;
|
|
245
|
-
/**
|
|
246
|
-
* Write changelog files to disk.
|
|
247
|
-
*
|
|
248
|
-
* @default true
|
|
249
|
-
*/
|
|
250
|
-
write?: boolean;
|
|
251
167
|
}
|
|
252
|
-
interface
|
|
168
|
+
interface CommitChangelog {
|
|
253
169
|
filename: string;
|
|
254
170
|
content: string;
|
|
255
171
|
packages: Record<string, BumpType | ChangelogPackageConfig>;
|
|
@@ -264,16 +180,88 @@ interface CommitChange {
|
|
|
264
180
|
title: string;
|
|
265
181
|
}
|
|
266
182
|
//#endregion
|
|
183
|
+
//#region src/plans/publish.d.ts
|
|
184
|
+
interface PublishPlan {
|
|
185
|
+
options: PublishOptions;
|
|
186
|
+
/** id -> entry */
|
|
187
|
+
changelogs: Map<string, ChangelogEntry>;
|
|
188
|
+
/** id -> package data. The package id will always exist in package graph, stale items will be pruned at init-time */
|
|
189
|
+
packages: Map<string, PackagePublishPlan>;
|
|
190
|
+
}
|
|
191
|
+
interface PackagePublishPlan {
|
|
192
|
+
changelogs: ChangelogEntry[];
|
|
193
|
+
/** whether this package was version-bumped when the lock was written */
|
|
194
|
+
updated: boolean;
|
|
195
|
+
/** generated by Git plugin */
|
|
196
|
+
git?: {
|
|
197
|
+
/** the associated Git tag of package */tag: string;
|
|
198
|
+
};
|
|
199
|
+
/** generated by npm plugin */
|
|
200
|
+
npm?: {
|
|
201
|
+
/** dist tag to use if published */distTag?: string;
|
|
202
|
+
};
|
|
203
|
+
/** publish result, generated for all packages in publish plan after publishing */
|
|
204
|
+
publishResult?: PackagePublishResult;
|
|
205
|
+
/** preflight result, generated for all packages in publish plan after preflights */
|
|
206
|
+
preflight?: PublishPreflight;
|
|
207
|
+
}
|
|
208
|
+
interface PublishOptions {
|
|
209
|
+
/** Validate the publish plan without publishing packages, creating tags, or running release plugins. */
|
|
210
|
+
dryRun?: boolean;
|
|
211
|
+
}
|
|
212
|
+
type PackagePublishResult = {
|
|
213
|
+
type: "published" | "skipped";
|
|
214
|
+
} | {
|
|
215
|
+
type: "failed";
|
|
216
|
+
error: string;
|
|
217
|
+
};
|
|
218
|
+
//#endregion
|
|
219
|
+
//#region src/plans/lock.d.ts
|
|
220
|
+
/**
|
|
221
|
+
* the data structure of `publish-lock.yaml` file.
|
|
222
|
+
*/
|
|
223
|
+
declare class PublishLock {
|
|
224
|
+
/** namespace -> data array */
|
|
225
|
+
private readonly data;
|
|
226
|
+
constructor(/** namespace -> data array */
|
|
227
|
+
|
|
228
|
+
data?: Map<string, unknown[]>);
|
|
229
|
+
/** write data to namespace, note that the `data` must be serializable in yaml */
|
|
230
|
+
write(namespace: string, data: unknown): void;
|
|
231
|
+
read(namespace: string): unknown | undefined;
|
|
232
|
+
size(namespace: string): number;
|
|
233
|
+
serialize(): string;
|
|
234
|
+
}
|
|
235
|
+
//#endregion
|
|
267
236
|
//#region src/index.d.ts
|
|
237
|
+
interface GenerateChangelogOptions extends GenerateFromCommitsOptions {
|
|
238
|
+
/**
|
|
239
|
+
* Write changelog files to disk.
|
|
240
|
+
*
|
|
241
|
+
* @default true
|
|
242
|
+
*/
|
|
243
|
+
write?: boolean;
|
|
244
|
+
}
|
|
268
245
|
interface Tegami {
|
|
269
246
|
/** Create pending changelog files from git commit history. */
|
|
270
|
-
generateChangelog(options?: GenerateChangelogOptions): Promise<
|
|
247
|
+
generateChangelog(options?: GenerateChangelogOptions): Promise<CommitChangelog[]>;
|
|
271
248
|
/** Build a draft from pending changelog files. */
|
|
272
|
-
draft(): Promise<
|
|
273
|
-
/** Publish the
|
|
274
|
-
publish(options?: PublishOptions): Promise<
|
|
275
|
-
/**
|
|
276
|
-
|
|
249
|
+
draft(): Promise<Draft>;
|
|
250
|
+
/** Publish packages from the publish lock. */
|
|
251
|
+
publish(options?: PublishOptions): Promise<PublishPlan | "skipped">;
|
|
252
|
+
/**
|
|
253
|
+
* Check publish status.
|
|
254
|
+
*
|
|
255
|
+
* Prefer `publish()` over this if you are publishing packages, it will also check the publish status.
|
|
256
|
+
*/
|
|
257
|
+
publishStatus(): Promise<"pending" | "success" | "idle">;
|
|
258
|
+
/** Remove the publish lock file after publishing has finished successfully. */
|
|
259
|
+
cleanup(): Promise<{
|
|
260
|
+
state: "removed";
|
|
261
|
+
} | {
|
|
262
|
+
state: "skipped";
|
|
263
|
+
reason: "no-plan" | "pending";
|
|
264
|
+
}>;
|
|
277
265
|
/** Internal APIs, do not use it unless you know what you are doing */
|
|
278
266
|
_internal: {
|
|
279
267
|
context(): Promise<TegamiContext>;
|
|
@@ -285,25 +273,25 @@ interface Tegami {
|
|
|
285
273
|
declare function tegami<const Groups extends string = string>(options?: TegamiOptions<Groups>): Tegami;
|
|
286
274
|
//#endregion
|
|
287
275
|
//#region src/schemas.d.ts
|
|
288
|
-
declare const packageManifestSchema: z.ZodObject<{
|
|
289
|
-
name: z.ZodString;
|
|
290
|
-
version: z.ZodOptional<z.ZodString>;
|
|
291
|
-
private: z.ZodOptional<z.ZodBoolean>;
|
|
292
|
-
publishConfig: z.ZodOptional<z.ZodObject<{
|
|
293
|
-
access: z.ZodOptional<z.ZodEnum<{
|
|
276
|
+
declare const packageManifestSchema: z$1.ZodObject<{
|
|
277
|
+
name: z$1.ZodString;
|
|
278
|
+
version: z$1.ZodOptional<z$1.ZodString>;
|
|
279
|
+
private: z$1.ZodOptional<z$1.ZodBoolean>;
|
|
280
|
+
publishConfig: z$1.ZodOptional<z$1.ZodObject<{
|
|
281
|
+
access: z$1.ZodOptional<z$1.ZodEnum<{
|
|
294
282
|
public: "public";
|
|
295
283
|
restricted: "restricted";
|
|
296
284
|
}>>;
|
|
297
|
-
registry: z.ZodOptional<z.ZodString>;
|
|
298
|
-
tag: z.ZodOptional<z.ZodString>;
|
|
299
|
-
}, z.core.$loose>>;
|
|
300
|
-
workspaces: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
301
|
-
dependencies: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
302
|
-
devDependencies: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
303
|
-
peerDependencies: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
304
|
-
optionalDependencies: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
305
|
-
}, z.core.$loose>;
|
|
306
|
-
type PackageManifest = z.infer<typeof packageManifestSchema>;
|
|
285
|
+
registry: z$1.ZodOptional<z$1.ZodString>;
|
|
286
|
+
tag: z$1.ZodOptional<z$1.ZodString>;
|
|
287
|
+
}, z$1.core.$loose>>;
|
|
288
|
+
workspaces: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
|
|
289
|
+
dependencies: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodString>>;
|
|
290
|
+
devDependencies: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodString>>;
|
|
291
|
+
peerDependencies: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodString>>;
|
|
292
|
+
optionalDependencies: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodString>>;
|
|
293
|
+
}, z$1.core.$loose>;
|
|
294
|
+
type PackageManifest = z$1.infer<typeof packageManifestSchema>;
|
|
307
295
|
//#endregion
|
|
308
296
|
//#region src/providers/npm.d.ts
|
|
309
297
|
declare const DEP_FIELDS$1: readonly ["dependencies", "devDependencies", "peerDependencies", "optionalDependencies"];
|
|
@@ -315,22 +303,7 @@ declare class NpmPackage extends WorkspacePackage {
|
|
|
315
303
|
get name(): string;
|
|
316
304
|
get version(): string;
|
|
317
305
|
write(): Promise<void>;
|
|
318
|
-
|
|
319
|
-
}
|
|
320
|
-
declare class NpmRegistryClient implements RegistryClient {
|
|
321
|
-
#private;
|
|
322
|
-
private readonly cwd;
|
|
323
|
-
private readonly client;
|
|
324
|
-
readonly id = "npm";
|
|
325
|
-
constructor(cwd: string, client: AgentName, _graph: PackageGraph);
|
|
326
|
-
supports(pkg: WorkspacePackage): boolean;
|
|
327
|
-
isPackagePublished(pkg: NpmPackage): Promise<boolean>;
|
|
328
|
-
publish(pkg: NpmPackage, {
|
|
329
|
-
packageStore
|
|
330
|
-
}: {
|
|
331
|
-
store: PlanStore;
|
|
332
|
-
packageStore: PackagePlanStore;
|
|
333
|
-
}): Promise<void>;
|
|
306
|
+
initDraft(): PackageDraft;
|
|
334
307
|
}
|
|
335
308
|
type DependencySpec = {
|
|
336
309
|
protocol: "npm";
|
|
@@ -371,7 +344,7 @@ interface NpmPluginOptions {
|
|
|
371
344
|
* Note: `workspace:` protocols are not included.
|
|
372
345
|
*/
|
|
373
346
|
onBreakPeerDep?: "set" | "error" | "ignore";
|
|
374
|
-
/** update lockfile after
|
|
347
|
+
/** update lockfile after applying a draft @default true */
|
|
375
348
|
updateLockFile?: boolean;
|
|
376
349
|
}
|
|
377
350
|
declare function npm({
|
|
@@ -396,35 +369,17 @@ declare class CargoPackage extends WorkspacePackage {
|
|
|
396
369
|
constructor(path: string, manifest: TomlTable, content: string, workspaceManifest?: TomlTable | undefined);
|
|
397
370
|
get name(): string;
|
|
398
371
|
get version(): string;
|
|
399
|
-
initPlan(): PackagePlan;
|
|
400
372
|
setVersion(version: string): void;
|
|
401
373
|
write(): Promise<void>;
|
|
402
374
|
patch(path: string, value: unknown): void;
|
|
403
375
|
get packageInfo(): TomlTable;
|
|
404
376
|
private get workspaceVersion();
|
|
405
377
|
}
|
|
406
|
-
declare class CargoRegistryClient implements RegistryClient {
|
|
407
|
-
#private;
|
|
408
|
-
private readonly graph;
|
|
409
|
-
readonly id = "cargo";
|
|
410
|
-
constructor(graph: PackageGraph);
|
|
411
|
-
supports(pkg: WorkspacePackage): boolean;
|
|
412
|
-
isPackagePublished(pkg: CargoPackage): Promise<boolean>;
|
|
413
|
-
publishPreflight(pkg: CargoPackage, {
|
|
414
|
-
store
|
|
415
|
-
}: {
|
|
416
|
-
store: PlanStore;
|
|
417
|
-
}): PublishPreflight;
|
|
418
|
-
publish(pkg: CargoPackage, _env: {
|
|
419
|
-
store: PlanStore;
|
|
420
|
-
packageStore: PackagePlanStore;
|
|
421
|
-
}): Promise<void>;
|
|
422
|
-
}
|
|
423
378
|
interface CargoPluginOptions {
|
|
424
379
|
/**
|
|
425
380
|
* Update lock file after versioning.
|
|
426
381
|
*
|
|
427
|
-
* @default
|
|
382
|
+
* @default true
|
|
428
383
|
*/
|
|
429
384
|
updateLockFile?: boolean;
|
|
430
385
|
bumpDep?: (opts: {
|
|
@@ -442,12 +397,9 @@ declare function cargo({
|
|
|
442
397
|
/** Generates changelog content for a package release. */
|
|
443
398
|
interface LogGenerator {
|
|
444
399
|
generate(this: TegamiContext, opts: {
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
changelogs: ChangelogEntry[];
|
|
449
|
-
plan: PackagePlan;
|
|
450
|
-
unstable_draft: DraftPlan;
|
|
400
|
+
pkg: WorkspacePackage;
|
|
401
|
+
packageDraft: PackageDraft;
|
|
402
|
+
draft: Draft;
|
|
451
403
|
}): string | Promise<string>;
|
|
452
404
|
}
|
|
453
405
|
interface TegamiOptions<Groups extends string = string> {
|
|
@@ -455,9 +407,9 @@ interface TegamiOptions<Groups extends string = string> {
|
|
|
455
407
|
cwd?: string;
|
|
456
408
|
/** Directory containing pending changelog markdown files. */
|
|
457
409
|
changelogDir?: string;
|
|
458
|
-
/** Path to the publish
|
|
459
|
-
|
|
460
|
-
/** Changelog generator used when applying a
|
|
410
|
+
/** Path to the publish lock file. Defaults to `.tegami/publish-lock.yaml`. */
|
|
411
|
+
lockPath?: string;
|
|
412
|
+
/** Changelog generator used when applying a draft. */
|
|
461
413
|
generator?: LogGenerator;
|
|
462
414
|
/** Per-package release and publish options keyed by package name. */
|
|
463
415
|
packages?: Record<string, PackageOptions<NoInfer<Groups>>>;
|
|
@@ -465,6 +417,14 @@ interface TegamiOptions<Groups extends string = string> {
|
|
|
465
417
|
groups?: Record<Groups, GroupOptions>;
|
|
466
418
|
/** Package names, ids, or regex patterns to exclude from the dependency graph. */
|
|
467
419
|
ignore?: (string | RegExp)[];
|
|
420
|
+
/**
|
|
421
|
+
* When creating draft, automatically generate changelogs from conventional commits.
|
|
422
|
+
*
|
|
423
|
+
* When disabled (default), it requires you to run `generateChangelog()` to pre-generate changelogs before draft.
|
|
424
|
+
*
|
|
425
|
+
* @default false
|
|
426
|
+
*/
|
|
427
|
+
conventionalCommits?: boolean;
|
|
468
428
|
npm?: NpmPluginOptions;
|
|
469
429
|
cargo?: CargoPluginOptions;
|
|
470
430
|
}
|
|
@@ -483,8 +443,6 @@ interface GroupOptions {
|
|
|
483
443
|
interface PackageOptions<Group extends string = string> {
|
|
484
444
|
/** Prerelease identifier appended to bumped versions (e.g. `alpha` → `1.1.0-alpha.0`). */
|
|
485
445
|
prerelease?: string;
|
|
486
|
-
/** Set to false to keep this package out of npm publishing. */
|
|
487
|
-
publish?: boolean;
|
|
488
446
|
/** the group of this package, ignored if the group doesn't exist */
|
|
489
447
|
group?: Group;
|
|
490
448
|
/** npm-specific options. */
|
|
@@ -500,56 +458,68 @@ interface TegamiPlugin {
|
|
|
500
458
|
init?(this: TegamiContext): Awaitable<void>;
|
|
501
459
|
/** Resolve workspace packages and dependency metadata into the shared graph. */
|
|
502
460
|
resolve?(this: TegamiContext): Awaitable<void>;
|
|
503
|
-
/**
|
|
504
|
-
|
|
505
|
-
/** Called when Tegami
|
|
506
|
-
|
|
507
|
-
/** Called when Tegami
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
461
|
+
/** Called when Tegami creates an empty draft. */
|
|
462
|
+
initDraft?(this: TegamiContext, draft: Draft): Awaitable<Draft | void | undefined>;
|
|
463
|
+
/** Called when Tegami applies the draft. */
|
|
464
|
+
applyDraft?(this: TegamiContext, draft: Draft): Awaitable<void>;
|
|
465
|
+
/** Called when Tegami creates publish lock. */
|
|
466
|
+
initPublishLock?(this: TegamiContext, opts: {
|
|
467
|
+
lock: PublishLock;
|
|
468
|
+
draft: Draft;
|
|
469
|
+
}): Awaitable<void>;
|
|
470
|
+
/** Called when Tegami creates publish plan. */
|
|
471
|
+
initPublishPlan?(this: TegamiContext, opts: {
|
|
472
|
+
lock: PublishLock;
|
|
473
|
+
plan: PublishPlan;
|
|
474
|
+
}): Awaitable<void>;
|
|
475
|
+
/** Collect data before publishing a package, will be merged if multiple plugins return preflight data for this package. */
|
|
476
|
+
publishPreflight?(this: TegamiContext, opts: {
|
|
477
|
+
pkg: WorkspacePackage;
|
|
478
|
+
plan: PublishPlan;
|
|
479
|
+
}): Awaitable<PublishPreflight | void | undefined>;
|
|
480
|
+
/** Publish package, return a result object indicating if the package is published, skipped, or failed. Return `undefined` if the package is not handled by this plugin. */
|
|
481
|
+
publish?(this: TegamiContext, opts: {
|
|
482
|
+
pkg: WorkspacePackage;
|
|
483
|
+
plan: PublishPlan;
|
|
484
|
+
}): Promise<PackagePublishResult | undefined | void>;
|
|
485
|
+
/**
|
|
486
|
+
* Resolve publish plan status, used to check if the plan is finished successfully, or needs retries.
|
|
487
|
+
*
|
|
488
|
+
* Each plugin should only report the status of its own tasks, Tegami will summarize the results from all plugins.
|
|
489
|
+
*/
|
|
490
|
+
resolvePlanStatus?(this: TegamiContext, opts: {
|
|
491
|
+
plan: PublishPlan;
|
|
492
|
+
}): Awaitable<"success" | "pending" | undefined | void>;
|
|
513
493
|
/** Called before a package will be published, return `false` to prevent from publishing. */
|
|
514
494
|
willPublish?(this: TegamiContext, opts: {
|
|
515
495
|
pkg: WorkspacePackage;
|
|
516
|
-
}): Awaitable<
|
|
517
|
-
/** Called after a package is published. */
|
|
496
|
+
}): Awaitable<false | void | undefined>;
|
|
497
|
+
/** Called after a package is published, skipped, or failed. */
|
|
518
498
|
afterPublish?(this: TegamiContext, opts: {
|
|
519
499
|
pkg: WorkspacePackage;
|
|
520
|
-
|
|
521
|
-
}): Awaitable<
|
|
522
|
-
/** Called after publishing finishes. */
|
|
523
|
-
afterPublishAll?(this: TegamiContext
|
|
524
|
-
|
|
525
|
-
}
|
|
500
|
+
plan: PublishPlan;
|
|
501
|
+
}): Awaitable<void>;
|
|
502
|
+
/** Called after all publishing finishes. */
|
|
503
|
+
afterPublishAll?(this: TegamiContext, opts: {
|
|
504
|
+
plan: PublishPlan;
|
|
505
|
+
}): Awaitable<void>;
|
|
526
506
|
/** CLI lifecycle hooks. */
|
|
527
507
|
cli?: {
|
|
528
|
-
/** Called once before a CLI command runs. */init?(this: TegamiContext): Awaitable<void>; /** Called after `tegami version` returns a draft
|
|
529
|
-
|
|
530
|
-
|
|
508
|
+
/** Called once before a CLI command runs. */init?(this: TegamiContext): Awaitable<void>; /** Called after `tegami version` returns a draft. */
|
|
509
|
+
draftCreated?(this: TegamiContext, draft: Draft): Awaitable<void>; /** Called after `tegami version` applies a draft. */
|
|
510
|
+
draftApplied?(this: TegamiContext, draft: Draft): Awaitable<void>;
|
|
531
511
|
};
|
|
532
512
|
}
|
|
533
513
|
type Awaitable<T> = T | Promise<T>;
|
|
534
|
-
interface PublishPlanStatus {
|
|
535
|
-
state: "pending" | "success" | "missing";
|
|
536
|
-
}
|
|
537
514
|
interface PublishPreflight {
|
|
538
|
-
/**
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
store: PlanStore;
|
|
547
|
-
packageStore: PackagePlanStore;
|
|
548
|
-
}): Awaitable<PublishPreflight | void | undefined>;
|
|
549
|
-
publish(pkg: WorkspacePackage, env: {
|
|
550
|
-
store: PlanStore;
|
|
551
|
-
packageStore: PackagePlanStore;
|
|
552
|
-
}): Promise<void>;
|
|
515
|
+
/** if the package should be published, default to `true`. */
|
|
516
|
+
publish?: boolean;
|
|
517
|
+
/**
|
|
518
|
+
* Package ids that must be published before this one, this will automatically disallow circular dependency.
|
|
519
|
+
*
|
|
520
|
+
* It is okay to add unpublished packages to `wait`, they will be ignored.
|
|
521
|
+
*/
|
|
522
|
+
wait?: string[];
|
|
553
523
|
}
|
|
554
524
|
//#endregion
|
|
555
|
-
export {
|
|
525
|
+
export { PackageDraft as A, CommitChangelog as C, WorkspacePackage as D, PackageGroup as E, Draft as O, PublishPlan as S, PackageGraph as T, tegami as _, PublishPreflight as a, PackagePublishResult as b, TegamiPluginOption as c, cargo as d, NpmPackage as f, Tegami as g, GenerateChangelogOptions as h, PackageOptions as i, DraftPolicy as k, CargoPackage as l, npm as m, GroupOptions as n, TegamiOptions as o, NpmPluginOptions as p, LogGenerator as r, TegamiPlugin as s, Awaitable as t, CargoPluginOptions as u, PublishLock as v, TegamiContext as w, PublishOptions as x, PackagePublishPlan as y };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tegami",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Utility for package versioning & publish",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Fuma Nama",
|
|
@@ -26,24 +26,23 @@
|
|
|
26
26
|
"access": "public"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@clack/prompts": "^1.
|
|
29
|
+
"@clack/prompts": "^1.6.0",
|
|
30
30
|
"@rainbowatcher/toml-edit-js": "^0.6.5",
|
|
31
31
|
"commander": "^15.0.0",
|
|
32
|
-
"js-yaml": "^
|
|
32
|
+
"js-yaml": "^5.1.0",
|
|
33
33
|
"mdast-util-from-markdown": "^2.0.3",
|
|
34
34
|
"mdast-util-to-markdown": "^2.1.2",
|
|
35
35
|
"package-manager-detector": "^1.6.0",
|
|
36
|
-
"semver": "^7.8.
|
|
36
|
+
"semver": "^7.8.5",
|
|
37
37
|
"tinyexec": "^1.2.4",
|
|
38
38
|
"tinyglobby": "^0.2.17",
|
|
39
39
|
"zod": "^4.4.3"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@types/js-yaml": "^4.0.9",
|
|
43
42
|
"@types/mdast": "^4.0.4",
|
|
44
|
-
"@types/node": "^
|
|
43
|
+
"@types/node": "^26.0.0",
|
|
45
44
|
"@types/semver": "^7.7.1",
|
|
46
|
-
"tsdown": "^0.22.
|
|
45
|
+
"tsdown": "^0.22.3",
|
|
47
46
|
"typescript": "6.0.3",
|
|
48
47
|
"@repo/typescript-config": "0.0.0"
|
|
49
48
|
},
|