tegami 1.1.1 → 1.1.3

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.
@@ -1,4 +1,4 @@
1
- import { k as Draft, p as Tegami, t as Awaitable, y as PublishPlan } from "../types-VvvN6oyT.js";
1
+ import { f as Tegami, j as Draft, t as Awaitable, v as PublishPlan } from "../types-DEyZ2r-2.js";
2
2
 
3
3
  //#region src/cli/index.d.ts
4
4
  interface TegamiCLIOptions {
package/dist/cli/index.js CHANGED
@@ -279,11 +279,12 @@ function createTegamiCliRegistry(tegami) {
279
279
  };
280
280
  commands.set(definition.path.join("\0"), definition);
281
281
  const api = {
282
- option(name, { short, description = "", type }) {
282
+ option(name, { short, description = "", type, multiple }) {
283
283
  definition.options.push({
284
284
  name,
285
285
  short,
286
286
  type,
287
+ multiple,
287
288
  description
288
289
  });
289
290
  return api;
@@ -295,6 +296,14 @@ function createTegamiCliRegistry(tegami) {
295
296
  });
296
297
  return api;
297
298
  },
299
+ positionals(name) {
300
+ definition.positionals.push({
301
+ name,
302
+ required: false,
303
+ multiple: true
304
+ });
305
+ return api;
306
+ },
298
307
  action(fn) {
299
308
  definition.action = fn;
300
309
  }
@@ -332,7 +341,12 @@ function createTegamiCliRegistry(tegami) {
332
341
  };
333
342
  }
334
343
  function formatUsage(command) {
335
- return [...command.path, ...command.positionals.map((positional) => positional.required ? `<${positional.name}>` : `[${positional.name}]`)].join(" ");
344
+ const s = [...command.path];
345
+ for (const positional of command.positionals) {
346
+ let c = positional.multiple ? `...${positional.name}` : positional.name;
347
+ s.push(positional.required ? `<${c}>` : `[${c}]`);
348
+ }
349
+ return s.join(" ");
336
350
  }
337
351
  function findCommand(commands, argv) {
338
352
  if (argv.length === 0) return commands.get("");
@@ -343,28 +357,34 @@ function findCommand(commands, argv) {
343
357
  }
344
358
  }
345
359
  function parseCommandArgs(command, args) {
346
- const optionConfig = { help: {
360
+ const optionsConfig = { help: {
347
361
  type: "boolean",
348
362
  short: "h"
349
363
  } };
350
- for (const option of command.options) optionConfig[option.name] = option.short ? {
351
- type: option.type,
352
- short: option.short
353
- } : { type: option.type };
364
+ for (const option of command.options) {
365
+ const config = optionsConfig[option.name] = { type: option.type };
366
+ if (option.short) config.short = option.short;
367
+ if (option.multiple) config.multiple = true;
368
+ }
354
369
  const parsed = parseArgs({
355
370
  args,
356
- options: optionConfig,
371
+ options: optionsConfig,
357
372
  strict: true,
358
373
  allowPositionals: command.positionals.length > 0
359
374
  });
360
375
  const positionals = {};
361
- if (parsed.positionals.length > command.positionals.length) throw new Error("Too many arguments");
362
376
  for (const positional of command.positionals) {
377
+ if (positional.multiple) {
378
+ const value = positionals[positional.name] = [];
379
+ while (parsed.positionals.length > 0) value.push(parsed.positionals.shift());
380
+ continue;
381
+ }
363
382
  const value = parsed.positionals.shift();
364
383
  if (value === void 0 && positional.required) throw new Error(`missing required argument: ${positional.name}`);
365
384
  if (value === void 0) continue;
366
385
  positionals[positional.name] = value;
367
386
  }
387
+ if (parsed.positionals.length > 0) throw new Error("Too many arguments");
368
388
  return {
369
389
  values: parsed.values,
370
390
  positionals
@@ -471,9 +491,10 @@ function registerCoreCommands(cli, tegami, options) {
471
491
  cli.command("publish", { description: "publish packages from the publish lock" }).option("dry-run", {
472
492
  type: "boolean",
473
493
  description: "validate the publish lock without publishing"
474
- }).action(async ({ values }) => {
494
+ }).positionals("packages").action(async ({ values, positionals }) => {
475
495
  await publishPackages(tegami, {
476
496
  dryRun: values["dry-run"],
497
+ packages: positionals.packages?.length ? positionals.packages : void 0,
477
498
  cli: options
478
499
  });
479
500
  });
@@ -538,7 +559,10 @@ async function publishPackages(tegami, options) {
538
559
  intro(dryRun ? "Publish packages (dry run)" : "Publish packages");
539
560
  const s = spinner();
540
561
  s.start(dryRun ? "Validating publish lock" : "Publishing packages");
541
- const plan = customPublish ? await customPublish() : await tegami.publish({ dryRun });
562
+ const plan = customPublish ? await customPublish() : await tegami.publish({
563
+ dryRun,
564
+ packages: options.packages
565
+ });
542
566
  if (plan === "skipped") {
543
567
  s.stop(dryRun ? "No publish lock to validate" : "Nothing to publish");
544
568
  outro(`No publishable packages were found in ${context.lockPath}.`);
@@ -1,4 +1,4 @@
1
- import { r as LogGenerator } from "../types-VvvN6oyT.js";
1
+ import { r as LogGenerator } from "../types-DEyZ2r-2.js";
2
2
 
3
3
  //#region src/generators/simple.d.ts
4
4
  declare function simpleGenerator(): LogGenerator;
package/dist/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { A as DraftPolicy, D as PackageGroup, E as PackageGraph, M as BumpType, O as WorkspacePackage, _ as PackagePublishResult, a as PublishPreflight, b as CommitChangelog, c as TegamiPluginOption, f as GenerateChangelogOptions, g as PackagePublishPlan, h as PublishLock, i as PackageOptions, j as PackageDraft, k as Draft, m as tegami, n as GroupOptions, o as TegamiOptions, p as Tegami, r as LogGenerator, s as TegamiPlugin, v as PublishOptions, x as TegamiContext, y as PublishPlan } from "./types-VvvN6oyT.js";
1
+ import { A as WorkspacePackage, M as DraftPolicy, N as PackageDraft, O as PackageGraph, P as BumpType, _ as PublishOptions, a as PublishPreflight, b as TegamiContext, c as TegamiPluginOption, d as GenerateChangelogOptions, f as Tegami, g as PackagePublishResult, h as PackagePublishPlan, i as PackageOptions, j as Draft, k as PackageGroup, m as PublishLock, n as GroupOptions, o as TegamiOptions, p as tegami, r as LogGenerator, s as TegamiPlugin, v as PublishPlan, y as CommitChangelog } from "./types-DEyZ2r-2.js";
2
2
  export { type BumpType, type CommitChangelog, type Draft, type DraftPolicy, GenerateChangelogOptions, type GroupOptions, type LogGenerator, type PackageDraft, PackageGraph, type PackageGroup, type PackageOptions, type PackagePublishPlan, type PackagePublishResult, type PublishLock, type PublishOptions, type PublishPlan, type PublishPreflight, Tegami, type TegamiContext, type TegamiOptions, type TegamiPlugin, type TegamiPluginOption, WorkspacePackage, tegami };
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { n as generateFromCommits } from "./generate-Bg86OJP4.js";
2
2
  import { r as handlePluginError } from "./error-BhMYq9iW.js";
3
- import { a as runPreflights, i as publishPlanStatus, n as npm, o as runPublishPlan, r as initPublishPlan } from "./npm-BLkgWr-D.js";
3
+ import { a as parseChangelogFile, o as readChangelogEntries, t as createDraft } from "./draft-CzUiQasJ.js";
4
+ import { a as runPreflights, i as publishPlanStatus, o as runPublishPlan, r as initPublishPlan, t as npm } from "./npm-CaBYeOeV.js";
4
5
  import { n as WorkspacePackage, t as PackageGraph } from "./graph-BmXTJZxx.js";
5
- import { a as parseChangelogFile, o as readChangelogEntries, t as createDraft } from "./draft-DsxZOCOb.js";
6
6
  import { mkdir, rm, writeFile } from "node:fs/promises";
7
7
  import path, { join } from "node:path";
8
8
  //#region src/context.ts
@@ -98,9 +98,9 @@ function tegami(options = {}) {
98
98
  }
99
99
  return createDraft(changelogs, context);
100
100
  },
101
- async publishStatus() {
101
+ async publishStatus(publishOptions = {}) {
102
102
  const context = await getContextResolved();
103
- const plan = await initPublishPlan(context, {});
103
+ const plan = await initPublishPlan(context, publishOptions);
104
104
  if (!plan) return "idle";
105
105
  await runPreflights(context, plan);
106
106
  return publishPlanStatus(plan, context);
@@ -115,9 +115,9 @@ function tegami(options = {}) {
115
115
  if (Array.from(plan.packages.values()).every((pkg) => pkg.publishResult.type === "skipped")) return "skipped";
116
116
  return plan;
117
117
  },
118
- async cleanup() {
118
+ async cleanup(publishOptions = {}) {
119
119
  const context = await getContextResolved();
120
- const plan = await initPublishPlan(context, {});
120
+ const plan = await initPublishPlan(context, publishOptions);
121
121
  if (!plan) return {
122
122
  state: "skipped",
123
123
  reason: "no-plan"