@dogsbay/adapter-tigera 0.2.0-beta.140 → 0.2.0-beta.141

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.
@@ -20,6 +20,13 @@
20
20
  * - `<InstallOpenShiftManifests />` (Calico 3.30 on): the download with its `--exclude` flags,
21
21
  * then Tigera's own `<ConfigDataplaneOpenShiftManifests />`, included as converted.
22
22
  * - `<FossaReport />` (Calico Enterprise): a link to the attribution report.
23
+ * - `<TechPreviewTable />` and `<DeprecatedFeaturesTable />` (release notes; Calico Cloud's
24
+ * feature lifecycle reference) over `data/feature-status.yaml`, as
25
+ * `src/components/FeatureStatusTable/featureStatus.ts` builds them. The release window is the
26
+ * page's: worked out here from the docs folder's version (Calico Cloud: from `cloudversion`,
27
+ * its columns relabelled), so a versioned snapshot keeps its window; the unversioned docs
28
+ * have none and show nothing, as on the site. The template does the rest over the YAML:
29
+ * carry-forward, `confirmed: false`, row order, cell labels and the fixed legend.
23
30
  * - `<CalicoProducts />` (every product's "about" pages): a card per product, title and
24
31
  * description, from the `products` list in the component's own source, read as data (it is
25
32
  * not exported) and written as `calico-products.json` for `::data-cards`.
@@ -71,6 +78,8 @@ declare function alternateRegistry(ctx: PreprocessContext): TemplateComponent |
71
78
  declare function openshiftManifests(ctx: PreprocessContext): TemplateComponent | undefined;
72
79
  declare function calicoProducts(ctx: PreprocessContext): TemplateComponent | undefined;
73
80
  export declare const TIGERA_DATA_COMPONENTS: {
81
+ TechPreviewTable: (ctx: PreprocessContext) => TemplateComponent | undefined;
82
+ DeprecatedFeaturesTable: (ctx: PreprocessContext) => TemplateComponent | undefined;
74
83
  CalicoProducts: typeof calicoProducts;
75
84
  MaintenanceImageOptionsAlternateRegistry: typeof alternateRegistry;
76
85
  InstallOpenShiftManifests: typeof openshiftManifests;
@@ -20,6 +20,13 @@
20
20
  * - `<InstallOpenShiftManifests />` (Calico 3.30 on): the download with its `--exclude` flags,
21
21
  * then Tigera's own `<ConfigDataplaneOpenShiftManifests />`, included as converted.
22
22
  * - `<FossaReport />` (Calico Enterprise): a link to the attribution report.
23
+ * - `<TechPreviewTable />` and `<DeprecatedFeaturesTable />` (release notes; Calico Cloud's
24
+ * feature lifecycle reference) over `data/feature-status.yaml`, as
25
+ * `src/components/FeatureStatusTable/featureStatus.ts` builds them. The release window is the
26
+ * page's: worked out here from the docs folder's version (Calico Cloud: from `cloudversion`,
27
+ * its columns relabelled), so a versioned snapshot keeps its window; the unversioned docs
28
+ * have none and show nothing, as on the site. The template does the rest over the YAML:
29
+ * carry-forward, `confirmed: false`, row order, cell labels and the fixed legend.
23
30
  * - `<CalicoProducts />` (every product's "about" pages): a card per product, title and
24
31
  * description, from the `products` list in the component's own source, read as data (it is
25
32
  * not exported) and written as `calico-products.json` for `::data-cards`.
@@ -524,7 +531,115 @@ function calicoProducts(ctx) {
524
531
  data: { "calico-products.json": { module: `${up}/${CALICO_PRODUCTS}`, binding: "products" } },
525
532
  };
526
533
  }
534
+ /** The feature status data, beside the site's config. */
535
+ const FEATURE_STATUS = "data/feature-status.yaml";
536
+ /** Statuses as featureStatus.ts's STATUSES: cell label and legend gloss, in progression order. */
537
+ const STATUSES = [
538
+ ["tech-preview", "TP", "technology preview"],
539
+ ["ga", "GA", "generally available"],
540
+ ["deprecated", "Deprecated", "scheduled for removal"],
541
+ ["removed", "Removed", "no longer present"],
542
+ ];
543
+ /** featureStatus.ts's PREVIEW_TABLE and DEPRECATION_TABLE. */
544
+ const FEATURE_TABLES = {
545
+ TechPreviewTable: { name: "tech-preview-table", include: ["tech-preview"], legend: ["tech-preview", "ga"] },
546
+ DeprecatedFeaturesTable: { name: "deprecated-features-table", include: ["deprecated", "removed"], legend: ["ga", "deprecated", "removed"] },
547
+ };
548
+ /** featureStatus.ts `buildLegend`: the table's fixed statuses, then the dash. */
549
+ const legendText = (statuses) => `${[...STATUSES.filter(([s]) => statuses.includes(s)).map(([, label, gloss]) => `${label} = ${gloss}`), "– = not available in that release"].join(", ")}.`;
550
+ /**
551
+ * One table, as the component renders it. `window` is the page's three release lines (`3.31,…`),
552
+ * `labels` its column headers, `product` the docs plugin id: all from the adapter, plain text. A
553
+ * version key or status from the YAML is compared, never printed; a feature's name prints through
554
+ * `| cell`. Nothing is shown with no window or no row, as the component returns null.
555
+ */
556
+ const featureTableText = (include, legend) => `{%- set statuses = ${JSON.stringify(STATUSES.map(([s]) => s))} -%}
557
+ {%- set labels_of = ${JSON.stringify(Object.fromEntries(STATUSES.map(([s, l]) => [s, l])))} -%}
558
+ {%- set include = ${JSON.stringify(include)} -%}
559
+ {%- set rows = namespace(list=[]) -%}
560
+ {%- if window -%}
561
+ {%- set cols = window.split(",") -%}
562
+ {%- for f in (data.feature_status.features if data.feature_status.features is defined else []) -%}
563
+ {%- set order = loop.index -%}
564
+ {%- set h = f.products[product] if f.products is defined and f.products and product in f.products else none -%}
565
+ {%- if h and not ("confirmed" in h and h.confirmed == false) -%}
566
+ {%- set changes = namespace(list=[]) -%}
567
+ {%- for k, v in h | items -%}
568
+ {%- set parts = (k ~ "").split(".") -%}
569
+ {%- if v in statuses and parts | length == 2 -%}
570
+ {%- set changes.list = changes.list + [{"at": (parts[0] | int) * 1000 + (parts[1] | int), "status": v}] -%}
571
+ {%- endif -%}
572
+ {%- endfor -%}
573
+ {%- if changes.list -%}
574
+ {%- set sorted = changes.list | sort(attribute="at") -%}
575
+ {%- set cells = namespace(list=[], hit=false) -%}
576
+ {%- for c in cols -%}
577
+ {%- set cp = c.split(".") -%}
578
+ {%- set at = (cp[0] | int) * 1000 + (cp[1] | int) -%}
579
+ {%- set now = namespace(status=none) -%}
580
+ {%- for ch in sorted -%}{%- if ch.at <= at -%}{%- set now.status = ch.status -%}{%- endif -%}{%- endfor -%}
581
+ {%- set cells.list = cells.list + [now.status] -%}
582
+ {%- if now.status in include -%}{%- set cells.hit = true -%}{%- endif -%}
583
+ {%- endfor -%}
584
+ {%- if cells.hit -%}
585
+ {%- set rows.list = rows.list + [{"name": f.name if f.name is defined else "", "cells": cells.list, "since": sorted[0].at, "order": order}] -%}
586
+ {%- endif -%}
587
+ {%- endif -%}
588
+ {%- endif -%}
589
+ {%- endfor -%}
590
+ {%- endif -%}
591
+ {%- if rows.list %}
592
+ | Feature |{% for l in labels.split(",") %} {{ l | cell }} |{% endfor %}
593
+ | --- |{% for l in labels.split(",") %} --- |{% endfor %}
594
+ {% for r in rows.list | sort(attribute="order") | sort(attribute="since") -%}
595
+ | {{ r.name | text | cell }} |{% for cell in r.cells %} {{ labels_of[cell] if cell else "–" }} |{% endfor %}
596
+ {% endfor %}
597
+ ${legendText(legend)}
598
+ {%- endif %}
599
+ `;
600
+ /**
601
+ * A feature status table on a page of `product`: its window from the docs folder's version, or
602
+ * from Calico Cloud's `cloudversion` (featureStatus.ts `releaseWindow`, `ceVersionFromCloudversion`,
603
+ * `ccVersionLabel`). The page's `version="$[cloudversion]"` is that same value, so it is left out.
604
+ */
605
+ function featureTable(kind) {
606
+ return (ctx) => {
607
+ const project = ctx.projectRoot ? `${ctx.projectRoot}/` : "";
608
+ const inside = (ctx.instanceRoot ?? "").slice(project.length);
609
+ const m = /^(calico|calico-enterprise|calico-cloud)(?:_versioned_docs\/version-([^/]+))?$/.exec(inside);
610
+ if (!m)
611
+ return undefined;
612
+ const product = m[1];
613
+ let line;
614
+ let cloud = false;
615
+ if (product === "calico-cloud") {
616
+ const cv = loadVariables(ctx).cloudversion;
617
+ line = typeof cv === "string" ? /^v?(\d+\.\d+)/.exec(cv)?.[1] : undefined;
618
+ cloud = true;
619
+ }
620
+ else if (m[2]) {
621
+ line = /^(\d+)\.(\d+)/.exec(m[2])?.[0];
622
+ }
623
+ let window = [];
624
+ if (line) {
625
+ const [major, minor] = line.split(".").map(Number);
626
+ window = [0, 1, 2].map((i) => `${major}.${minor - 2 + i}`);
627
+ }
628
+ const labels = window.map((v) => (cloud ? v.replace(/^3\./, "") : v));
629
+ const up = inside ? inside.split("/").map(() => "..").join("/") : ".";
630
+ const table = FEATURE_TABLES[kind];
631
+ return {
632
+ name: table.name,
633
+ text: featureTableText(table.include, table.legend),
634
+ values: { product, window: window.join(","), labels: labels.join(",") },
635
+ fromData: ["version"],
636
+ data: { "feature-status.yaml": `${up}/${FEATURE_STATUS}` },
637
+ };
638
+ };
639
+ }
527
640
  export const TIGERA_DATA_COMPONENTS = {
641
+ TechPreviewTable: featureTable("TechPreviewTable"),
642
+ DeprecatedFeaturesTable: featureTable("DeprecatedFeaturesTable"),
528
643
  CalicoProducts: calicoProducts,
529
644
  MaintenanceImageOptionsAlternateRegistry: alternateRegistry,
530
645
  InstallOpenShiftManifests: openshiftManifests,
package/dist/index.js CHANGED
@@ -52,6 +52,8 @@ const TIGERA_JS_COMPONENTS = [
52
52
  "AutoHostendpointsMigrate",
53
53
  "CalicoProducts",
54
54
  "CalicoWindowsInstall",
55
+ "TechPreviewTable",
56
+ "DeprecatedFeaturesTable",
55
57
  "ComponentVersions",
56
58
  "ConfigDataplaneOpenShiftManifests",
57
59
  "DownloadOpenShiftManifests",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dogsbay/adapter-tigera",
3
- "version": "0.2.0-beta.140",
3
+ "version": "0.2.0-beta.141",
4
4
  "description": "Tigera/Calico site adapter for @dogsbay/format-docusaurus — resolves $[variable] substitution and Tigera-specific MDX components.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -11,8 +11,8 @@
11
11
  "README.md"
12
12
  ],
13
13
  "dependencies": {
14
- "@dogsbay/corpus": "0.2.0-beta.140",
15
- "@dogsbay/format-docusaurus": "0.2.0-beta.140"
14
+ "@dogsbay/corpus": "0.2.0-beta.141",
15
+ "@dogsbay/format-docusaurus": "0.2.0-beta.141"
16
16
  },
17
17
  "devDependencies": {
18
18
  "@types/node": "^22.20.1",