tegami 0.2.1 → 1.0.0-beta.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/index.d.ts +2 -1
- package/dist/cli/index.js +22 -29
- package/dist/{generate-L7ucD7ic.js → generate-OZFKzXnu.js} +9 -24
- package/dist/generators/simple.d.ts +1 -1
- package/dist/generators/simple.js +1 -1
- package/dist/{graph-DrzluXw8.js → graph-OnX9ncdQ.js} +2 -7
- package/dist/index-B4ehnvrS.d.ts +64 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +27 -26
- package/dist/npm-Q0qvAkIu.js +362 -0
- package/dist/plugins/git.d.ts +1 -1
- package/dist/plugins/github.d.ts +1 -1
- package/dist/plugins/github.js +4 -6
- package/dist/plugins/go.d.ts +51 -0
- package/dist/plugins/go.js +291 -0
- package/dist/providers/cargo.d.ts +1 -1
- package/dist/providers/cargo.js +3 -5
- package/dist/providers/npm.d.ts +1 -1
- package/dist/providers/npm.js +1 -333
- package/dist/{semver-C4vJ4SK8.js → semver-jcIUAvbl.js} +2 -1
- package/dist/{types-DEaKjB3O.d.ts → types-DnCUr2dB.d.ts} +84 -138
- package/package.json +2 -1
- package/dist/schemas-BdUlXfSu.js +0 -27
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import z
|
|
1
|
+
import z from "zod";
|
|
2
2
|
import { AgentName } from "package-manager-detector";
|
|
3
3
|
|
|
4
4
|
//#region src/utils/semver.d.ts
|
|
@@ -96,6 +96,7 @@ interface DraftPolicy {
|
|
|
96
96
|
/** Package discovered in the workspace. */
|
|
97
97
|
declare abstract class WorkspacePackage {
|
|
98
98
|
abstract readonly name: string;
|
|
99
|
+
/** absolute path */
|
|
99
100
|
abstract readonly path: string;
|
|
100
101
|
abstract readonly manager: string;
|
|
101
102
|
abstract readonly version: string;
|
|
@@ -158,141 +159,27 @@ interface TegamiContext {
|
|
|
158
159
|
};
|
|
159
160
|
}
|
|
160
161
|
//#endregion
|
|
161
|
-
//#region src/
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
interface CommitChangelog {
|
|
169
|
-
filename: string;
|
|
170
|
-
content: string;
|
|
171
|
-
packages: Record<string, BumpType | ChangelogPackageConfig>;
|
|
172
|
-
changes: CommitChange[];
|
|
173
|
-
}
|
|
174
|
-
interface CommitChange {
|
|
175
|
-
hash: string;
|
|
176
|
-
subject: string;
|
|
177
|
-
body: string;
|
|
178
|
-
packages: string[];
|
|
179
|
-
type: BumpType;
|
|
180
|
-
title: string;
|
|
181
|
-
}
|
|
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
|
|
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
|
-
}
|
|
245
|
-
interface Tegami {
|
|
246
|
-
/** Create pending changelog files from git commit history. */
|
|
247
|
-
generateChangelog(options?: GenerateChangelogOptions): Promise<CommitChangelog[]>;
|
|
248
|
-
/** Build a draft from pending changelog files. */
|
|
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
|
-
}>;
|
|
265
|
-
/** Internal APIs, do not use it unless you know what you are doing */
|
|
266
|
-
_internal: {
|
|
267
|
-
context(): Promise<TegamiContext>;
|
|
268
|
-
graph(): Promise<PackageGraph>;
|
|
269
|
-
options: TegamiOptions;
|
|
270
|
-
};
|
|
271
|
-
}
|
|
272
|
-
/** Create a Tegami project handle. */
|
|
273
|
-
declare function tegami<const Groups extends string = string>(options?: TegamiOptions<Groups>): Tegami;
|
|
274
|
-
//#endregion
|
|
275
|
-
//#region src/schemas.d.ts
|
|
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<{
|
|
162
|
+
//#region src/providers/npm/schema.d.ts
|
|
163
|
+
declare const packageManifestSchema: z.ZodObject<{
|
|
164
|
+
name: z.ZodString;
|
|
165
|
+
version: z.ZodOptional<z.ZodString>;
|
|
166
|
+
private: z.ZodOptional<z.ZodBoolean>;
|
|
167
|
+
publishConfig: z.ZodOptional<z.ZodObject<{
|
|
168
|
+
access: z.ZodOptional<z.ZodEnum<{
|
|
282
169
|
public: "public";
|
|
283
170
|
restricted: "restricted";
|
|
284
171
|
}>>;
|
|
285
|
-
registry: z
|
|
286
|
-
tag: z
|
|
287
|
-
}, z
|
|
288
|
-
scripts: z
|
|
289
|
-
workspaces: z
|
|
290
|
-
dependencies: z
|
|
291
|
-
devDependencies: z
|
|
292
|
-
peerDependencies: z
|
|
293
|
-
optionalDependencies: z
|
|
294
|
-
}, z
|
|
295
|
-
type PackageManifest = z
|
|
172
|
+
registry: z.ZodOptional<z.ZodString>;
|
|
173
|
+
tag: z.ZodOptional<z.ZodString>;
|
|
174
|
+
}, z.core.$loose>>;
|
|
175
|
+
scripts: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
176
|
+
workspaces: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
177
|
+
dependencies: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
178
|
+
devDependencies: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
179
|
+
peerDependencies: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
180
|
+
optionalDependencies: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
181
|
+
}, z.core.$loose>;
|
|
182
|
+
type PackageManifest = z.infer<typeof packageManifestSchema>;
|
|
296
183
|
//#endregion
|
|
297
184
|
//#region src/providers/npm.d.ts
|
|
298
185
|
declare const DEP_FIELDS$1: readonly ["dependencies", "devDependencies", "peerDependencies", "optionalDependencies"];
|
|
@@ -305,6 +192,7 @@ declare class NpmPackage extends WorkspacePackage {
|
|
|
305
192
|
get version(): string;
|
|
306
193
|
write(): Promise<void>;
|
|
307
194
|
initDraft(): PackageDraft;
|
|
195
|
+
configureDraft(draft: PackageDraft, group?: PackageGroup): void;
|
|
308
196
|
}
|
|
309
197
|
type DependencySpec = {
|
|
310
198
|
protocol: "npm";
|
|
@@ -331,6 +219,7 @@ interface NpmPluginOptions {
|
|
|
331
219
|
* Decide how to bump the dependents of a bumped package.
|
|
332
220
|
*/
|
|
333
221
|
bumpDep?: (opts: {
|
|
222
|
+
dependent: NpmPackage;
|
|
334
223
|
kind: (typeof DEP_FIELDS$1)[number];
|
|
335
224
|
name: string;
|
|
336
225
|
spec: DependencySpec;
|
|
@@ -383,7 +272,11 @@ interface CargoPluginOptions {
|
|
|
383
272
|
* @default true
|
|
384
273
|
*/
|
|
385
274
|
updateLockFile?: boolean;
|
|
275
|
+
/**
|
|
276
|
+
* Decide how to bump the dependents of a bumped package.
|
|
277
|
+
*/
|
|
386
278
|
bumpDep?: (opts: {
|
|
279
|
+
dependent: CargoPackage;
|
|
387
280
|
kind: (typeof DEP_FIELDS)[number];
|
|
388
281
|
name: string;
|
|
389
282
|
version: string;
|
|
@@ -394,6 +287,59 @@ declare function cargo({
|
|
|
394
287
|
bumpDep: getBumpDepType
|
|
395
288
|
}?: CargoPluginOptions): TegamiPlugin;
|
|
396
289
|
//#endregion
|
|
290
|
+
//#region src/plans/publish.d.ts
|
|
291
|
+
interface PublishPlan {
|
|
292
|
+
options: PublishOptions;
|
|
293
|
+
/** id -> entry */
|
|
294
|
+
changelogs: Map<string, ChangelogEntry>;
|
|
295
|
+
/** id -> package data. The package id will always exist in package graph, stale items will be pruned at init-time */
|
|
296
|
+
packages: Map<string, PackagePublishPlan>;
|
|
297
|
+
}
|
|
298
|
+
interface PackagePublishPlan {
|
|
299
|
+
changelogs: ChangelogEntry[];
|
|
300
|
+
/** whether this package was version-bumped when the lock was written */
|
|
301
|
+
updated: boolean;
|
|
302
|
+
/** generated by Git plugin */
|
|
303
|
+
git?: {
|
|
304
|
+
/** the associated Git tag of package */tag: string;
|
|
305
|
+
};
|
|
306
|
+
/** generated by npm plugin */
|
|
307
|
+
npm?: {
|
|
308
|
+
/** dist tag to use if published */distTag?: string;
|
|
309
|
+
};
|
|
310
|
+
/** publish result, generated for all packages in publish plan after publishing */
|
|
311
|
+
publishResult?: PackagePublishResult;
|
|
312
|
+
/** preflight result, generated for all packages in publish plan after preflights */
|
|
313
|
+
preflight?: PublishPreflight;
|
|
314
|
+
}
|
|
315
|
+
interface PublishOptions {
|
|
316
|
+
/** Validate the publish plan without publishing packages, creating tags, or running release plugins. */
|
|
317
|
+
dryRun?: boolean;
|
|
318
|
+
}
|
|
319
|
+
type PackagePublishResult = {
|
|
320
|
+
type: "published" | "skipped";
|
|
321
|
+
} | {
|
|
322
|
+
type: "failed";
|
|
323
|
+
error: string;
|
|
324
|
+
};
|
|
325
|
+
//#endregion
|
|
326
|
+
//#region src/plans/lock.d.ts
|
|
327
|
+
/**
|
|
328
|
+
* the data structure of `publish-lock.yaml` file.
|
|
329
|
+
*/
|
|
330
|
+
declare class PublishLock {
|
|
331
|
+
/** namespace -> data array */
|
|
332
|
+
private readonly data;
|
|
333
|
+
constructor(/** namespace -> data array */
|
|
334
|
+
|
|
335
|
+
data?: Map<string, unknown[]>);
|
|
336
|
+
/** write data to namespace, note that the `data` must be serializable in yaml */
|
|
337
|
+
write(namespace: string, data: unknown): void;
|
|
338
|
+
read(namespace: string): unknown | undefined;
|
|
339
|
+
size(namespace: string): number;
|
|
340
|
+
serialize(): string;
|
|
341
|
+
}
|
|
342
|
+
//#endregion
|
|
397
343
|
//#region src/types.d.ts
|
|
398
344
|
/** Generates changelog content for a package release. */
|
|
399
345
|
interface LogGenerator {
|
|
@@ -412,8 +358,8 @@ interface TegamiOptions<Groups extends string = string> {
|
|
|
412
358
|
lockPath?: string;
|
|
413
359
|
/** Changelog generator used when applying a draft. */
|
|
414
360
|
generator?: LogGenerator;
|
|
415
|
-
/** Per-package
|
|
416
|
-
packages?: Record<string, PackageOptions<NoInfer<Groups
|
|
361
|
+
/** Per-package options keyed by package name or a function. */
|
|
362
|
+
packages?: Record<string, PackageOptions<NoInfer<Groups>>> | ((pkg: WorkspacePackage) => PackageOptions<NoInfer<Groups>> | undefined);
|
|
417
363
|
plugins?: TegamiPluginOption[];
|
|
418
364
|
groups?: Record<Groups, GroupOptions>;
|
|
419
365
|
/** Package names, ids, or regex patterns to exclude from the dependency graph. */
|
|
@@ -455,7 +401,7 @@ type TegamiPluginOption = TegamiPlugin | TegamiPluginOption[];
|
|
|
455
401
|
interface TegamiPlugin {
|
|
456
402
|
name: string;
|
|
457
403
|
enforce?: "pre" | "default" | "post";
|
|
458
|
-
/**
|
|
404
|
+
/** When Tegami initializes */
|
|
459
405
|
init?(this: TegamiContext): Awaitable<void>;
|
|
460
406
|
/** Resolve workspace packages and dependency metadata into the shared graph. */
|
|
461
407
|
resolve?(this: TegamiContext): Awaitable<void>;
|
|
@@ -495,7 +441,7 @@ interface TegamiPlugin {
|
|
|
495
441
|
willPublish?(this: TegamiContext, opts: {
|
|
496
442
|
pkg: WorkspacePackage;
|
|
497
443
|
}): Awaitable<false | void | undefined>;
|
|
498
|
-
/** Called after a package is published
|
|
444
|
+
/** Called after a package is published successfully, or failed. */
|
|
499
445
|
afterPublish?(this: TegamiContext, opts: {
|
|
500
446
|
pkg: WorkspacePackage;
|
|
501
447
|
plan: PublishPlan;
|
|
@@ -523,4 +469,4 @@ interface PublishPreflight {
|
|
|
523
469
|
wait?: string[];
|
|
524
470
|
}
|
|
525
471
|
//#endregion
|
|
526
|
-
export {
|
|
472
|
+
export { WorkspacePackage as C, ChangelogPackageConfig as D, PackageDraft as E, BumpType as O, PackageGroup as S, DraftPolicy as T, NpmPackage as _, PublishPreflight as a, TegamiContext as b, TegamiPluginOption as c, PackagePublishResult as d, PublishOptions as f, cargo as g, CargoPluginOptions as h, PackageOptions as i, PublishLock as l, CargoPackage as m, GroupOptions as n, TegamiOptions as o, PublishPlan as p, LogGenerator as r, TegamiPlugin as s, Awaitable as t, PackagePublishPlan as u, NpmPluginOptions as v, Draft as w, PackageGraph as x, npm as y };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tegami",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0-beta.0",
|
|
4
4
|
"description": "Utility for package versioning & publish",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Fuma Nama",
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
"./generators/simple": "./dist/generators/simple.js",
|
|
19
19
|
"./plugins/git": "./dist/plugins/git.js",
|
|
20
20
|
"./plugins/github": "./dist/plugins/github.js",
|
|
21
|
+
"./plugins/go": "./dist/plugins/go.js",
|
|
21
22
|
"./providers/cargo": "./dist/providers/cargo.js",
|
|
22
23
|
"./providers/npm": "./dist/providers/npm.js",
|
|
23
24
|
"./package.json": "./package.json"
|
package/dist/schemas-BdUlXfSu.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { z as z$1 } from "zod";
|
|
2
|
-
//#region src/schemas.ts
|
|
3
|
-
const stringRecordSchema = z$1.record(z$1.string(), z$1.string());
|
|
4
|
-
const bumpTypeSchema = z$1.enum([
|
|
5
|
-
"major",
|
|
6
|
-
"minor",
|
|
7
|
-
"patch"
|
|
8
|
-
]);
|
|
9
|
-
const pnpmWorkspaceSchema = z$1.looseObject({ packages: z$1.array(z$1.string()).optional() });
|
|
10
|
-
const packageManifestSchema = z$1.looseObject({
|
|
11
|
-
name: z$1.string(),
|
|
12
|
-
version: z$1.string().optional(),
|
|
13
|
-
private: z$1.boolean().optional(),
|
|
14
|
-
publishConfig: z$1.looseObject({
|
|
15
|
-
access: z$1.enum(["public", "restricted"]).optional(),
|
|
16
|
-
registry: z$1.string().optional(),
|
|
17
|
-
tag: z$1.string().optional()
|
|
18
|
-
}).optional(),
|
|
19
|
-
scripts: z$1.record(z$1.string(), z$1.string()).optional(),
|
|
20
|
-
workspaces: z$1.array(z$1.string()).optional(),
|
|
21
|
-
dependencies: stringRecordSchema.optional(),
|
|
22
|
-
devDependencies: stringRecordSchema.optional(),
|
|
23
|
-
peerDependencies: stringRecordSchema.optional(),
|
|
24
|
-
optionalDependencies: stringRecordSchema.optional()
|
|
25
|
-
});
|
|
26
|
-
//#endregion
|
|
27
|
-
export { packageManifestSchema as n, pnpmWorkspaceSchema as r, bumpTypeSchema as t };
|