tegami 0.1.0-beta.0 → 0.1.0-beta.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/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.js +21 -11
- package/dist/generators/simple.d.ts +1 -1
- package/dist/{index-Bhh2dJZp.d.ts → index-Da6P6gSc.d.ts} +10 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.js +7 -4
- package/dist/plugins/git.d.ts +1 -1
- package/dist/plugins/github.d.ts +1 -1
- package/dist/providers/cargo.d.ts +1 -1
- package/dist/providers/npm.d.ts +1 -1
- package/dist/providers/npm.js +15 -5
- package/package.json +1 -1
package/dist/cli/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as PublishResult, a as Awaitable, t as Tegami, w as DraftPlan } from "../index-
|
|
1
|
+
import { C as PublishResult, a as Awaitable, t as Tegami, w as DraftPlan } from "../index-Da6P6gSc.js";
|
|
2
2
|
import { Command } from "commander";
|
|
3
3
|
|
|
4
4
|
//#region src/cli/index.d.ts
|
package/dist/cli/index.js
CHANGED
|
@@ -17,14 +17,22 @@ function createCli(tegami, options = {}) {
|
|
|
17
17
|
...commandOptions,
|
|
18
18
|
cli: options
|
|
19
19
|
})));
|
|
20
|
-
program.command("version").description("draft and apply a publish plan").action((commandOptions) => runAction(tegami, () =>
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
20
|
+
program.command("version").description("draft and apply a publish plan").action((commandOptions) => runAction(tegami, async () => {
|
|
21
|
+
await versionPackages(tegami, {
|
|
22
|
+
...commandOptions,
|
|
23
|
+
cli: options
|
|
24
|
+
});
|
|
25
|
+
}));
|
|
26
|
+
program.command("ci").description("version and publish packages").action(() => runAction(tegami, async () => {
|
|
27
|
+
if (await versionPackages(tegami, { cli: options })) return;
|
|
28
|
+
await publishPackages(tegami, { cli: options });
|
|
29
|
+
}));
|
|
30
|
+
program.command("publish").description("publish packages from the applied publish plan").option("--dry-run", "validate the publish plan without publishing packages").action((commandOptions) => runAction(tegami, async () => {
|
|
31
|
+
await publishPackages(tegami, {
|
|
32
|
+
...commandOptions,
|
|
33
|
+
cli: options
|
|
34
|
+
});
|
|
35
|
+
}));
|
|
28
36
|
program.command("cleanup").description("remove the publish plan after all packages have been published").action(() => runAction(tegami, () => runCleanup(tegami)));
|
|
29
37
|
return program;
|
|
30
38
|
}
|
|
@@ -114,7 +122,7 @@ async function versionPackages(tegami, options) {
|
|
|
114
122
|
if (!draft.hasPending()) {
|
|
115
123
|
note("No pending changelog entries matched workspace packages.", "Nothing to version");
|
|
116
124
|
outro("No versions changed.");
|
|
117
|
-
return;
|
|
125
|
+
return false;
|
|
118
126
|
}
|
|
119
127
|
const planEntries = [];
|
|
120
128
|
for (const pkg of context.graph.getPackages()) {
|
|
@@ -135,6 +143,7 @@ async function versionPackages(tegami, options) {
|
|
|
135
143
|
s.stop("Package versions updated");
|
|
136
144
|
for (const plugin of context.plugins) await handlePluginError(plugin, "cli.publishPlanApplied", () => plugin.cli?.publishPlanApplied?.call(context, draft));
|
|
137
145
|
outro("Publish plan applied.");
|
|
146
|
+
return true;
|
|
138
147
|
}
|
|
139
148
|
async function publishPackages(tegami, options) {
|
|
140
149
|
const dryRun = options.dryRun ?? false;
|
|
@@ -147,7 +156,7 @@ async function publishPackages(tegami, options) {
|
|
|
147
156
|
const { planPath } = await tegami._internal.context();
|
|
148
157
|
s.stop(dryRun ? "No publish plan to validate" : "Nothing to publish");
|
|
149
158
|
outro(`No publishable packages were found in ${planPath}.`);
|
|
150
|
-
return;
|
|
159
|
+
return false;
|
|
151
160
|
}
|
|
152
161
|
s.stop(dryRun ? "Publish plan validated" : "Publish complete");
|
|
153
162
|
note(result.packages.map((pkg) => {
|
|
@@ -158,9 +167,10 @@ async function publishPackages(tegami, options) {
|
|
|
158
167
|
if (result.state === "failed") {
|
|
159
168
|
process.exitCode = 1;
|
|
160
169
|
outro("Some packages failed to publish.");
|
|
161
|
-
return;
|
|
170
|
+
return false;
|
|
162
171
|
}
|
|
163
172
|
outro(dryRun ? "Publish plan is valid." : "Packages published.");
|
|
173
|
+
return true;
|
|
164
174
|
}
|
|
165
175
|
async function runCleanup(tegami) {
|
|
166
176
|
intro("Cleanup publish plan");
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { TomlTable } from "smol-toml";
|
|
2
2
|
import z$1, { z } from "zod";
|
|
3
|
+
import { AgentName } from "package-manager-detector";
|
|
3
4
|
|
|
4
5
|
//#region src/utils/semver.d.ts
|
|
5
6
|
type BumpType = "major" | "minor" | "patch";
|
|
@@ -230,13 +231,12 @@ declare class NpmPackage extends WorkspacePackage {
|
|
|
230
231
|
write(): Promise<void>;
|
|
231
232
|
onPlan(context: TegamiContext): PackagePlan;
|
|
232
233
|
}
|
|
233
|
-
type NpmClient = "npm" | "pnpm";
|
|
234
234
|
declare class NpmRegistryClient implements RegistryClient {
|
|
235
235
|
#private;
|
|
236
236
|
private readonly cwd;
|
|
237
237
|
private readonly client;
|
|
238
238
|
readonly id = "npm";
|
|
239
|
-
constructor(cwd: string, client:
|
|
239
|
+
constructor(cwd: string, client: AgentName, _graph: PackageGraph);
|
|
240
240
|
supports(pkg: WorkspacePackage): boolean;
|
|
241
241
|
isPackagePublished(pkg: NpmPackage): Promise<boolean>;
|
|
242
242
|
publish(pkg: NpmPackage, {
|
|
@@ -258,7 +258,7 @@ type DependencySpec = {
|
|
|
258
258
|
};
|
|
259
259
|
interface NpmPluginOptions {
|
|
260
260
|
/** Package manager command used for npm registry operations. */
|
|
261
|
-
client?:
|
|
261
|
+
client?: AgentName;
|
|
262
262
|
/**
|
|
263
263
|
* Decide how to bump the dependents of a bumped package.
|
|
264
264
|
*/
|
|
@@ -277,10 +277,13 @@ interface NpmPluginOptions {
|
|
|
277
277
|
* Note: `workspace:` protocols are not included.
|
|
278
278
|
*/
|
|
279
279
|
onBreakPeerDep?: "set" | "error" | "ignore";
|
|
280
|
+
/** update lockfile after appling publish plan */
|
|
281
|
+
updateLockFile?: boolean;
|
|
280
282
|
}
|
|
281
283
|
declare function npm({
|
|
282
284
|
client: defaultClient,
|
|
283
285
|
onBreakPeerDep,
|
|
286
|
+
updateLockFile,
|
|
284
287
|
bumpDep: getBumpDepType
|
|
285
288
|
}?: NpmPluginOptions): TegamiPlugin;
|
|
286
289
|
//#endregion
|
|
@@ -386,6 +389,10 @@ interface TegamiPlugin {
|
|
|
386
389
|
resolvePlanStatus?(this: TegamiContext, status: PublishPlanStatus, env: {
|
|
387
390
|
plan: PlanStore;
|
|
388
391
|
}): Awaitable<PublishPlanStatus>;
|
|
392
|
+
/** Called before a package will be published. */
|
|
393
|
+
willPublish?(this: TegamiContext, opts: {
|
|
394
|
+
pkg: WorkspacePackage;
|
|
395
|
+
}): Awaitable<PublishResult | void | undefined>;
|
|
389
396
|
/** Called after publishing finishes. */
|
|
390
397
|
afterPublish?(this: TegamiContext & {
|
|
391
398
|
publishOptions: PublishOptions;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as PublishResult, D as PackageGroup, E as PackageGraph, O as WorkspacePackage, S as PublishOptions, T as PackagePlan, c as PackageOptions, d as TegamiPlugin, f as TegamiPluginOption, i as CreatedChangelog, l as RegistryClient, n as tegami, o as GroupOptions, r as CreateChangelogOptions, s as LogGenerator, t as Tegami, u as TegamiOptions, w as DraftPlan, x as PackagePublishResult } from "./index-
|
|
1
|
+
import { C as PublishResult, D as PackageGroup, E as PackageGraph, O as WorkspacePackage, S as PublishOptions, T as PackagePlan, c as PackageOptions, d as TegamiPlugin, f as TegamiPluginOption, i as CreatedChangelog, l as RegistryClient, n as tegami, o as GroupOptions, r as CreateChangelogOptions, s as LogGenerator, t as Tegami, u as TegamiOptions, w as DraftPlan, x as PackagePublishResult } from "./index-Da6P6gSc.js";
|
|
2
2
|
export { type CreateChangelogOptions, type CreatedChangelog, type DraftPlan, type GroupOptions, type LogGenerator, type PackageGraph, type PackageGroup, type PackageOptions, type PackagePlan, type PackagePublishResult, type PublishOptions, type PublishResult, type RegistryClient, Tegami, type TegamiOptions, type TegamiPlugin, type TegamiPluginOption, type WorkspacePackage, tegami };
|
package/dist/index.js
CHANGED
|
@@ -486,10 +486,13 @@ async function publishFromPlan(context, store, options) {
|
|
|
486
486
|
}
|
|
487
487
|
}
|
|
488
488
|
try {
|
|
489
|
-
if (!dryRun)
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
489
|
+
if (!dryRun) {
|
|
490
|
+
for (const plugin of context.plugins) await handlePluginError(plugin, "willPublish", () => plugin.willPublish?.call(context, { pkg }));
|
|
491
|
+
await context.getRegistryClient(pkg).publish(pkg, {
|
|
492
|
+
packageStore: plan,
|
|
493
|
+
store
|
|
494
|
+
});
|
|
495
|
+
}
|
|
493
496
|
packages.push({
|
|
494
497
|
id: pkg.id,
|
|
495
498
|
name: pkg.name,
|
package/dist/plugins/git.d.ts
CHANGED
package/dist/plugins/github.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as Awaitable, d as TegamiPlugin, w as DraftPlan, x as PackagePublishResult } from "../index-
|
|
1
|
+
import { a as Awaitable, d as TegamiPlugin, w as DraftPlan, x as PackagePublishResult } from "../index-Da6P6gSc.js";
|
|
2
2
|
import { GitPluginOptions } from "./git.js";
|
|
3
3
|
|
|
4
4
|
//#region src/plugins/github.d.ts
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { g as cargo, h as CargoRegistryClient, m as CargoPluginOptions, p as CargoPackage } from "../index-
|
|
1
|
+
import { g as cargo, h as CargoRegistryClient, m as CargoPluginOptions, p as CargoPackage } from "../index-Da6P6gSc.js";
|
|
2
2
|
export { CargoPackage, CargoPluginOptions, CargoRegistryClient, cargo };
|
package/dist/providers/npm.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as NpmPackage, b as npm, v as NpmPluginOptions, y as NpmRegistryClient } from "../index-
|
|
1
|
+
import { _ as NpmPackage, b as npm, v as NpmPluginOptions, y as NpmRegistryClient } from "../index-Da6P6gSc.js";
|
|
2
2
|
export { NpmPackage, NpmPluginOptions, NpmRegistryClient, npm };
|
package/dist/providers/npm.js
CHANGED
|
@@ -68,7 +68,7 @@ var NpmRegistryClient = class {
|
|
|
68
68
|
"--json"
|
|
69
69
|
];
|
|
70
70
|
if (registry) args.push("--registry", registry);
|
|
71
|
-
const result = await x(this.client, args, { nodeOptions: { cwd: this.cwd } });
|
|
71
|
+
const result = await x(this.client === "pnpm" ? "pnpm" : "npm", args, { nodeOptions: { cwd: this.cwd } });
|
|
72
72
|
if (result.exitCode === 0) return true;
|
|
73
73
|
const output = commandOutput(result);
|
|
74
74
|
if (isMissingRegistryEntry(output)) return false;
|
|
@@ -83,8 +83,9 @@ var NpmRegistryClient = class {
|
|
|
83
83
|
const args = ["publish"];
|
|
84
84
|
const distTag = packageStore.npm?.distTag;
|
|
85
85
|
if (distTag) args.push("--tag", distTag);
|
|
86
|
-
|
|
87
|
-
|
|
86
|
+
const client = this.client === "pnpm" ? "pnpm" : "npm";
|
|
87
|
+
if (client === "pnpm") args.push("--no-git-checks");
|
|
88
|
+
const result = await x(client, args, { nodeOptions: { cwd: pkg.path } });
|
|
88
89
|
if (result.exitCode !== 0) throw execFailure(`Failed to publish ${pkg.name}@${pkg.version}${distTag ? ` with dist-tag "${distTag}"` : ""}.`, result);
|
|
89
90
|
}
|
|
90
91
|
};
|
|
@@ -124,7 +125,7 @@ function formatDependencySpec(spec) {
|
|
|
124
125
|
if (spec.protocol === "npm") return `npm:${spec.alias}@${spec.range}`;
|
|
125
126
|
return spec.range;
|
|
126
127
|
}
|
|
127
|
-
function npm({ client: defaultClient, onBreakPeerDep = "set", bumpDep: getBumpDepType = ({ kind }) => {
|
|
128
|
+
function npm({ client: defaultClient, onBreakPeerDep = "set", updateLockFile = false, bumpDep: getBumpDepType = ({ kind }) => {
|
|
128
129
|
switch (kind) {
|
|
129
130
|
case "dependencies":
|
|
130
131
|
case "optionalDependencies": return "patch";
|
|
@@ -235,7 +236,16 @@ function npm({ client: defaultClient, onBreakPeerDep = "set", bumpDep: getBumpDe
|
|
|
235
236
|
writes.push(pkg.write());
|
|
236
237
|
}
|
|
237
238
|
await Promise.all(writes);
|
|
238
|
-
}
|
|
239
|
+
},
|
|
240
|
+
cli: { async publishPlanApplied() {
|
|
241
|
+
if (!updateLockFile) return;
|
|
242
|
+
let args;
|
|
243
|
+
if (client === "npm") args = ["ci"];
|
|
244
|
+
else if (client === "yarn") args = ["install", "--immutable"];
|
|
245
|
+
else args = ["install", "--frozen-lockfile"];
|
|
246
|
+
const result = await x(client, args, { nodeOptions: { cwd: this.cwd } });
|
|
247
|
+
if (result.exitCode !== 0) throw execFailure("Failed to update lockfile.", result);
|
|
248
|
+
} }
|
|
239
249
|
};
|
|
240
250
|
}
|
|
241
251
|
async function discoverNpmPackages(cwd, add) {
|