tegami 0.2.0 → 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 +27 -30
- package/dist/{generate-BMlrn-2e.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 +33 -31
- package/dist/npm-Q0qvAkIu.js +362 -0
- package/dist/plugins/git.d.ts +1 -1
- package/dist/plugins/git.js +4 -4
- package/dist/plugins/github.d.ts +1 -1
- package/dist/plugins/github.js +17 -23
- 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 -316
- package/dist/{semver-C4vJ4SK8.js → semver-jcIUAvbl.js} +2 -1
- package/dist/{types-CurHqnWl.d.ts → types-DnCUr2dB.d.ts} +86 -139
- package/package.json +2 -1
- package/dist/schemas-B7N6EE2k.js +0 -26
|
@@ -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,140 +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
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
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>;
|
|
295
183
|
//#endregion
|
|
296
184
|
//#region src/providers/npm.d.ts
|
|
297
185
|
declare const DEP_FIELDS$1: readonly ["dependencies", "devDependencies", "peerDependencies", "optionalDependencies"];
|
|
@@ -304,6 +192,7 @@ declare class NpmPackage extends WorkspacePackage {
|
|
|
304
192
|
get version(): string;
|
|
305
193
|
write(): Promise<void>;
|
|
306
194
|
initDraft(): PackageDraft;
|
|
195
|
+
configureDraft(draft: PackageDraft, group?: PackageGroup): void;
|
|
307
196
|
}
|
|
308
197
|
type DependencySpec = {
|
|
309
198
|
protocol: "npm";
|
|
@@ -330,6 +219,7 @@ interface NpmPluginOptions {
|
|
|
330
219
|
* Decide how to bump the dependents of a bumped package.
|
|
331
220
|
*/
|
|
332
221
|
bumpDep?: (opts: {
|
|
222
|
+
dependent: NpmPackage;
|
|
333
223
|
kind: (typeof DEP_FIELDS$1)[number];
|
|
334
224
|
name: string;
|
|
335
225
|
spec: DependencySpec;
|
|
@@ -382,7 +272,11 @@ interface CargoPluginOptions {
|
|
|
382
272
|
* @default true
|
|
383
273
|
*/
|
|
384
274
|
updateLockFile?: boolean;
|
|
275
|
+
/**
|
|
276
|
+
* Decide how to bump the dependents of a bumped package.
|
|
277
|
+
*/
|
|
385
278
|
bumpDep?: (opts: {
|
|
279
|
+
dependent: CargoPackage;
|
|
386
280
|
kind: (typeof DEP_FIELDS)[number];
|
|
387
281
|
name: string;
|
|
388
282
|
version: string;
|
|
@@ -393,6 +287,59 @@ declare function cargo({
|
|
|
393
287
|
bumpDep: getBumpDepType
|
|
394
288
|
}?: CargoPluginOptions): TegamiPlugin;
|
|
395
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
|
|
396
343
|
//#region src/types.d.ts
|
|
397
344
|
/** Generates changelog content for a package release. */
|
|
398
345
|
interface LogGenerator {
|
|
@@ -411,8 +358,8 @@ interface TegamiOptions<Groups extends string = string> {
|
|
|
411
358
|
lockPath?: string;
|
|
412
359
|
/** Changelog generator used when applying a draft. */
|
|
413
360
|
generator?: LogGenerator;
|
|
414
|
-
/** Per-package
|
|
415
|
-
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);
|
|
416
363
|
plugins?: TegamiPluginOption[];
|
|
417
364
|
groups?: Record<Groups, GroupOptions>;
|
|
418
365
|
/** Package names, ids, or regex patterns to exclude from the dependency graph. */
|
|
@@ -454,7 +401,7 @@ type TegamiPluginOption = TegamiPlugin | TegamiPluginOption[];
|
|
|
454
401
|
interface TegamiPlugin {
|
|
455
402
|
name: string;
|
|
456
403
|
enforce?: "pre" | "default" | "post";
|
|
457
|
-
/**
|
|
404
|
+
/** When Tegami initializes */
|
|
458
405
|
init?(this: TegamiContext): Awaitable<void>;
|
|
459
406
|
/** Resolve workspace packages and dependency metadata into the shared graph. */
|
|
460
407
|
resolve?(this: TegamiContext): Awaitable<void>;
|
|
@@ -494,7 +441,7 @@ interface TegamiPlugin {
|
|
|
494
441
|
willPublish?(this: TegamiContext, opts: {
|
|
495
442
|
pkg: WorkspacePackage;
|
|
496
443
|
}): Awaitable<false | void | undefined>;
|
|
497
|
-
/** Called after a package is published
|
|
444
|
+
/** Called after a package is published successfully, or failed. */
|
|
498
445
|
afterPublish?(this: TegamiContext, opts: {
|
|
499
446
|
pkg: WorkspacePackage;
|
|
500
447
|
plan: PublishPlan;
|
|
@@ -512,8 +459,8 @@ interface TegamiPlugin {
|
|
|
512
459
|
}
|
|
513
460
|
type Awaitable<T> = T | Promise<T>;
|
|
514
461
|
interface PublishPreflight {
|
|
515
|
-
/** if the package should be published
|
|
516
|
-
publish
|
|
462
|
+
/** if the package should be published. */
|
|
463
|
+
publish: boolean;
|
|
517
464
|
/**
|
|
518
465
|
* Package ids that must be published before this one, this will automatically disallow circular dependency.
|
|
519
466
|
*
|
|
@@ -522,4 +469,4 @@ interface PublishPreflight {
|
|
|
522
469
|
wait?: string[];
|
|
523
470
|
}
|
|
524
471
|
//#endregion
|
|
525
|
-
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-B7N6EE2k.js
DELETED
|
@@ -1,26 +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
|
-
workspaces: z$1.array(z$1.string()).optional(),
|
|
20
|
-
dependencies: stringRecordSchema.optional(),
|
|
21
|
-
devDependencies: stringRecordSchema.optional(),
|
|
22
|
-
peerDependencies: stringRecordSchema.optional(),
|
|
23
|
-
optionalDependencies: stringRecordSchema.optional()
|
|
24
|
-
});
|
|
25
|
-
//#endregion
|
|
26
|
-
export { packageManifestSchema as n, pnpmWorkspaceSchema as r, bumpTypeSchema as t };
|