@plexus-ms/cli 0.6.0 → 0.7.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.
Files changed (2) hide show
  1. package/dist/plx.js +20 -6
  2. package/package.json +2 -2
package/dist/plx.js CHANGED
@@ -8126,6 +8126,8 @@ function indent(text) {
8126
8126
  var import_yaml3 = __toESM(require_dist(), 1);
8127
8127
  var ANSWERS_FILE = ".copier-answers.yml";
8128
8128
  var TEMPLATE_FILES = ["copier.yml", "copier.yaml"];
8129
+ var COPIER_VERSION = "9.19.1";
8130
+ var copierVia = (args) => ["exec", `copier@${COPIER_VERSION}`, "--", "copier", ...args];
8129
8131
  function parseAnswers(text) {
8130
8132
  const data = (0, import_yaml3.parse)(text);
8131
8133
  if (data === null || typeof data !== "object" || Array.isArray(data))
@@ -8682,13 +8684,11 @@ async function updateSite(ctx, consumer, site, localPreset, summary, cloneOf, pr
8682
8684
  const answers = await ctx.readFile(join8(site.path, ANSWERS_FILE));
8683
8685
  await ctx.stage(write(join8(target, ANSWERS_FILE), answers.replace(/^_src_path: .*$/m, `_src_path: ${localPreset}`)));
8684
8686
  await previewCommit(repo, `plx preview: ${site.rel} reads ${localPreset} from the local checkout`);
8685
- await ctx.stage(run("copier", ["update", "--skip-answered", "--trust", "--defaults", "--skip-tasks", "--vcs-ref", "main"], {
8686
- cwd: target
8687
- }));
8687
+ await ctx.stage(run("mise", copierVia(["update", "--skip-answered", "--trust", "--defaults", "--skip-tasks", "--vcs-ref", "main"]), { cwd: target }));
8688
8688
  } else {
8689
8689
  ctx.say(`\u2192 ${site.rel}: copier update`);
8690
8690
  const args = ["update", "--skip-answered", "--trust", ...ctx.yes ? ["--defaults"] : []];
8691
- await ctx.apply([run("copier", args, { cwd: target, interactive: true })]);
8691
+ await ctx.apply([run("mise", copierVia(args), { cwd: target, interactive: true })]);
8692
8692
  }
8693
8693
  } catch (error) {
8694
8694
  ctx.say(` \u2717 FAILED \u2014 copier update exited nonzero${detail(error)}`);
@@ -8935,11 +8935,25 @@ async function checkCompendium(ctx, compendium) {
8935
8935
  };
8936
8936
  }
8937
8937
 
8938
+ // ../lib/dist/self.js
8939
+ var SELF_PACKAGE = "@plexus-ms/cli";
8940
+ async function preflightSelf(ctx, running) {
8941
+ const latest = (await ctx.read("npm", ["view", SELF_PACKAGE, "version"]).catch(() => "")).trim();
8942
+ if (!latest) {
8943
+ ctx.say(`\u26A0 could not ask the registry for the newest ${SELF_PACKAGE}; going on with plx ${running}`);
8944
+ return;
8945
+ }
8946
+ if (compareTrains(running, latest) < 0)
8947
+ throw new Error(`plx ${running} is behind ${latest}, the newest release; update it first: mise cache clear && mise up npm:${SELF_PACKAGE}`);
8948
+ }
8949
+
8938
8950
  // ../lib/dist/ship.js
8939
8951
  import { join as join10 } from "node:path";
8940
8952
  async function ship(ctx, options) {
8941
8953
  const upstream = join10(options.workspace, UPSTREAM);
8942
8954
  const propagateOnly = options.propagateOnly ?? false;
8955
+ if (options.plx)
8956
+ await preflightSelf(ctx, options.plx);
8943
8957
  const train = await readTrain(ctx, upstream);
8944
8958
  if (!propagateOnly)
8945
8959
  await preflightRelease(ctx, train);
@@ -14057,7 +14071,7 @@ import { resolve as resolve7 } from "node:path";
14057
14071
  function register7(program2) {
14058
14072
  program2.command("ship").description("release the train: tag every train repo identically, then copier-update every consumer").argument("[dir]", "the workspace: plexus-ms/ and the consumers sit under it", ".").option("--train <version>", "the train version, plain semver (default: minor+1 over the latest train)").action(async (dir, opts, command) => {
14059
14073
  const ctx = contextOf2(command);
14060
- const result = await ship(ctx, { workspace: resolve7(dir), train: opts.train });
14074
+ const result = await ship(ctx, { workspace: resolve7(dir), train: opts.train, plx: version });
14061
14075
  ctx.result(result, (r) => renderSummary(r, `plx -y ship --train ${r.train} ${dir}`));
14062
14076
  if (!isClean(result)) process.exitCode = 1;
14063
14077
  });
@@ -14083,7 +14097,7 @@ function renderSummary(s, realCommand) {
14083
14097
  function register8(program2) {
14084
14098
  program2.command("propagate").description("copier-update every consumer of the presets to the current train, and pin their ci-cd workflow refs").argument("[dir]", "the workspace: plexus-ms/ and the consumers sit under it", ".").option("--train <version>", "the train to propagate (default: the current one)").action(async (dir, opts, command) => {
14085
14099
  const ctx = contextOf2(command);
14086
- const result = await ship(ctx, { workspace: resolve8(dir), train: opts.train, propagateOnly: true });
14100
+ const result = await ship(ctx, { workspace: resolve8(dir), train: opts.train, propagateOnly: true, plx: version });
14087
14101
  ctx.result(result, (r) => renderSummary(r, `plx -y propagate --train ${r.train} ${dir}`));
14088
14102
  if (!isClean(result)) process.exitCode = 1;
14089
14103
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plexus-ms/cli",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "plx, the Plexus command-line tool: a single-script adapter over @plexus-ms/lib",
5
5
  "license": "GPL-3.0-or-later",
6
6
  "type": "module",
@@ -24,7 +24,7 @@
24
24
  },
25
25
  "dependencies": {
26
26
  "@inquirer/prompts": "^8.7.4",
27
- "@plexus-ms/lib": "0.6.0",
27
+ "@plexus-ms/lib": "0.7.0",
28
28
  "commander": "^15.0.0"
29
29
  },
30
30
  "devDependencies": {