@taprootio/site-authoring 0.27.1 → 0.29.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.
@@ -51,6 +51,7 @@ import {
51
51
  FRONT_MATTER_KEYS,
52
52
  PAGE_TEMPLATES,
53
53
  requireTemplateName,
54
+ RETIRED_GENERATED_PAGE_KINDS,
54
55
  sentDisplayDate,
55
56
  TEMPLATE_FREE_FORM,
56
57
  TEMPLATE_GENERATED,
@@ -486,6 +487,20 @@ function peekJsonTemplate(text) {
486
487
  }
487
488
  }
488
489
 
490
+ /**
491
+ * Whether a generated-page source names a kind Taproot retired (TR01308). The
492
+ * site deletes such a page on its next synchronization, but until then it is still listed,
493
+ * so a pulled source of that kind is judged here, before its document is read.
494
+ */
495
+ function isRetiredGeneratedSource(source) {
496
+ if (source.template !== TEMPLATE_GENERATED || typeof source.text !== "string") return false;
497
+ try {
498
+ return RETIRED_GENERATED_PAGE_KINDS.includes(JSON.parse(source.text)?.data?.kind);
499
+ } catch {
500
+ return false;
501
+ }
502
+ }
503
+
489
504
  /**
490
505
  * Reads one editable page source and resolves the metadata that says *which
491
506
  * page it is* — no Markdown conversion, no media resolution, no document
@@ -1293,7 +1308,6 @@ export async function planPages({
1293
1308
  let observedRecord;
1294
1309
  let legalRevisionGuard;
1295
1310
  requireCompletePageMetadata(source);
1296
- const document_ = await convertWorkspacePageSource({ source, mediaManifest, content });
1297
1311
 
1298
1312
  const target = manifestEntry?.pageId !== undefined
1299
1313
  ? liveById.get(manifestEntry.pageId)
@@ -1307,21 +1321,26 @@ export async function planPages({
1307
1321
  file,
1308
1322
  );
1309
1323
  }
1310
- const generated = documentTemplate(document_) === TEMPLATE_GENERATED;
1311
- if (documentTemplate(document_) === TEMPLATE_LEGAL && target === undefined && manifestEntry?.pageId !== undefined) {
1312
- throw documentError("pages.legal_missing", `'${file}' tracks a legal page that the site no longer lists. Pull and reconcile it before creating another page.`, file);
1313
- }
1314
- if (generated && target === undefined) {
1324
+ // A generated source the site no longer has, or whose kind Taproot retired
1325
+ // (TR01308; the site deletes the page on its next synchronization), is
1326
+ // judged before its document is read: it is reported stale like any
1327
+ // other and never refused as an unknown kind that blocks the push.
1328
+ const generated = source.template === TEMPLATE_GENERATED;
1329
+ const retiredKind = generated && isRetiredGeneratedSource(source);
1330
+ if (generated && (target === undefined || retiredKind)) {
1315
1331
  if (targeted) {
1316
1332
  throw documentError(
1317
1333
  "pages.generated_create",
1318
- `'${file}' is a generated-page source, but the site has no generated page for it. Taproot creates `
1319
- + "generated pages from the site's content; a push cannot create one. If the page no longer exists, "
1320
- + "delete this file and run 'taproot-site pull'.",
1334
+ retiredKind
1335
+ ? `'${file}' is the source of a generated page of a kind Taproot no longer publishes, and a push `
1336
+ + "cannot send one. Delete the file."
1337
+ : `'${file}' is a generated-page source, but the site has no generated page for it. Taproot creates `
1338
+ + "generated pages from the site's content; a push cannot create one. If the page no longer exists, "
1339
+ + "delete this file and run 'taproot-site pull'.",
1321
1340
  file,
1322
1341
  );
1323
1342
  }
1324
- // The site retired this page (its tag, month, place or folder is gone),
1343
+ // The site retired this page (its folder or its kind is gone),
1325
1344
  // which is Taproot's doing, not a mistake in the workspace: it cannot
1326
1345
  // block the pages that do exist.
1327
1346
  staleGenerated.push({ file, path: displayPagePath(pagePath) });
@@ -1331,6 +1350,10 @@ export async function planPages({
1331
1350
  );
1332
1351
  return;
1333
1352
  }
1353
+ const document_ = await convertWorkspacePageSource({ source, mediaManifest, content });
1354
+ if (documentTemplate(document_) === TEMPLATE_LEGAL && target === undefined && manifestEntry?.pageId !== undefined) {
1355
+ throw documentError("pages.legal_missing", `'${file}' tracks a legal page that the site no longer lists. Pull and reconcile it before creating another page.`, file);
1356
+ }
1334
1357
  // The file-keyed entry is gone whenever the file was renamed or replaced —
1335
1358
  // which is exactly what the pull, delete the `.pm.json`, author a `.md`
1336
1359
  // flow does. Falling back through the page's own identity keeps the
@@ -1371,7 +1394,7 @@ export async function planPages({
1371
1394
  && targetEntry.file === file
1372
1395
  && targetEntry.sourceFormat === source.sourceFormat;
1373
1396
  // An untouched generated page is not this push's to judge. Taproot
1374
- // moves its revision and its path on its own (a tag rename, a month that
1397
+ // moves its revision and its path on its own (a folder that
1375
1398
  // gained a post), and refusing the whole push for a page nothing here
1376
1399
  // sends would make one renamed page block every other edit.
1377
1400
  let untouchedGenerated = false;
@@ -83,8 +83,8 @@ export async function placesSelect(invocation) {
83
83
  *
84
84
  * A place's category is shared by every site, and Google's types do not always
85
85
  * give the one an owner wants. The override is the site's alone: its place
86
- * reviews and `/places/<category>` pages use it from the next deployment, and
87
- * the platform-wide place is never changed. The server owns the closed list, so
86
+ * reviews use it from the next deployment, and the platform-wide place is
87
+ * never changed. The server owns the closed list, so
88
88
  * the CLI sends the name as given and lets the server check it.
89
89
  */
90
90
  export async function placesCategorySet(invocation) {
package/src/verbs/pull.js CHANGED
@@ -728,7 +728,7 @@ export async function pull(invocation) {
728
728
  registeredFiles.add(record.file);
729
729
  }
730
730
  const tracked = await resolveTrackedSources(config.workspaceDir, authorable, registry, onProgress);
731
- // A generated page the site retired (its tag, month, place or folder is
731
+ // A generated page the site retired (its folder or its kind is
732
732
  // gone) leaves its pulled file behind: authored content, so pull will not
733
733
  // delete it, and settles it before naming any page's file so that a page
734
734
  // created since at the same path never writes over it. It is recorded