@theholocron/cli 5.5.1 → 5.6.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/README.md CHANGED
@@ -871,10 +871,11 @@ See the [command pages](https://theholocron.dev/holocron/commands/setup-notifica
871
871
  - **`holocron sync templates [--dry-run] [--yes]`** — publishes each `templates/<type>/` folder to
872
872
  `<org>/<type>-template` (spec `tech-template-repos`, #2926): compares the folder with the repo's default branch,
873
873
  writes only the difference through the `source` provider (files made, replaced, and removed when the folder no longer
874
- has them), then tags the repo `templates-v<version>` with the version in `templates/package.json`. A rerun writes
874
+ has them), then tags the repo `templates-v<version>` with the version in `templates/package.json` and moves its major tag
875
+ (`templates-v1`) to the same commit. The `templates` release runs it after tagging (#2934). A rerun writes
875
876
  nothing; a tag already at the same content is a success and one at other content is a failing row. It never creates
876
877
  or deletes a repository (a missing one fails its row), and one failing template does not stop the others. Needs a
877
- `source` provider with the optional `listFiles`, `deleteFile` and `ensureTag` beside `readFile` and `writeFile`
878
+ `source` provider with the optional `listFiles`, `deleteFile`, `ensureTag` and `moveTag` beside `readFile` and `writeFile`
878
879
  (GitHub). See the [command page](../../docs/src/content/docs/commands/sync-templates.mdx).
879
880
 
880
881
  ## Syncing issues
package/dist/cli.mjs CHANGED
@@ -44429,8 +44429,9 @@ function templatesVersion(templatesDir) {
44429
44429
  *
44430
44430
  * Each folder is compared with its repo's default branch; only the difference is written through the `source`
44431
44431
  * capability (files made, replaced, and removed when the repo has them and the folder no longer does), then the repo is
44432
- * tagged with the `templates` group's version from `templates/package.json`. A rerun writes nothing and a tag already at
44433
- * the same content is left alone. It never creates or deletes a repository: a missing template repo is a failing row.
44432
+ * tagged with the `templates` group's version from `templates/package.json`, and the major tag (`templates-v1`) is moved
44433
+ * to the same commit, so a caller that follows it gets the newest minor. A rerun writes nothing, a version tag already
44434
+ * at the same content is left alone and a major tag already there stays. It never creates or deletes a repository: a missing template repo is a failing row.
44434
44435
  * One template failing does not stop the others. It writes, so it asks first; `--yes` skips the question and, without a
44435
44436
  * terminal, a run with neither `--yes` nor `--dry-run` refuses.
44436
44437
  */
@@ -44465,13 +44466,14 @@ async function runSyncTemplates(input) {
44465
44466
  const org = input.context.org;
44466
44467
  if (!org) return stop("fail", "no organization to publish to: set `org` in the config or pass --org");
44467
44468
  const tag = `templates-v${version}`;
44469
+ const majorTag = `templates-v${version.split(".")[0]}`;
44468
44470
  /* v8 ignore next -- the real loader is only built outside tests, which always inject one */
44469
44471
  const loader = input.loader ?? new PluginLoader(input.loaded.resolved, input.context);
44470
44472
  await loader.load();
44471
44473
  assertPluginsResolvable(loader, "sync templates");
44472
44474
  const source = loader.has("source") ? loader.get("source") : void 0;
44473
- if (!source?.readFile || !source.writeFile || !source.listFiles || !source.deleteFile || !source.ensureTag) return stop("fail", whyMissing(loader, "source", "no `source` provider that can read, write, list and delete files and tag is available"));
44474
- const { readFile, writeFile, listFiles, deleteFile, ensureTag } = source;
44475
+ if (!source?.readFile || !source.writeFile || !source.listFiles || !source.deleteFile || !source.ensureTag || !source.moveTag) return stop("fail", whyMissing(loader, "source", "no `source` provider that can read, write, list and delete files and tag is available"));
44476
+ const { readFile, writeFile, listFiles, deleteFile, ensureTag, moveTag } = source;
44475
44477
  const results = [];
44476
44478
  const planned = [];
44477
44479
  for (const name of names) {
@@ -44504,7 +44506,7 @@ async function runSyncTemplates(input) {
44504
44506
  }
44505
44507
  if (dryRun) {
44506
44508
  for (const p of planned) {
44507
- row("skip", p.name, p.repo, `dry run, nothing written: ${counts(p.plan)}; would tag ${tag}`);
44509
+ row("skip", p.name, p.repo, `dry run, nothing written: ${counts(p.plan)}; would tag ${tag} and move ${majorTag}`);
44508
44510
  results.push({
44509
44511
  name: p.name,
44510
44512
  repo: p.repo,
@@ -44526,7 +44528,7 @@ async function runSyncTemplates(input) {
44526
44528
  if (!await (input.confirm ?? ((q) => confirm({
44527
44529
  message: q,
44528
44530
  default: false
44529
- })))(`Publish ${planned.length} template(s) as ${tag}?`)) {
44531
+ })))(`Publish ${planned.length} template(s) as ${tag} (and ${majorTag})?`)) {
44530
44532
  for (const p of planned) {
44531
44533
  row("skip", p.name, p.repo, "cancelled; nothing was changed");
44532
44534
  results.push({
@@ -44580,7 +44582,8 @@ async function runSyncTemplates(input) {
44580
44582
  result.removed++;
44581
44583
  }
44582
44584
  result.tagged = await ensureTag.call(source, tag, repo);
44583
- row("ok", name, repo, `${result.created} created, ${result.updated} replaced, ${result.removed} removed; ${result.tagged ? `tagged ${tag}` : `${tag} already there`}`);
44585
+ result.majorMoved = await moveTag.call(source, majorTag, repo);
44586
+ row("ok", name, repo, `${result.created} created, ${result.updated} replaced, ${result.removed} removed; ${result.tagged ? `tagged ${tag}` : `${tag} already there`}; ${result.majorMoved ? `${majorTag} moved here` : `${majorTag} already here`}`);
44584
44587
  } catch (err) {
44585
44588
  result.status = "fail";
44586
44589
  result.reason = errorMessage(err);