@marktiderman/genesis-cli 1.17.0 → 1.17.1

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
@@ -957,7 +957,8 @@ if (!result.ok) throw new Error(formatReport(result));
957
957
  as CSS, and `raw-tag` only in JSX files), then delete the old script.
958
958
  ## genesis upstream
959
959
 
960
- What an app needed from Genesis and didn't find goes in `docs/genesis-upstream.md`, one table:
960
+ What an app needed from Genesis and didn't find goes in `docs/genesis-upstream.md` (or
961
+ `genesis-upstream.md` at the app's root), one table:
961
962
 
962
963
  | id | kind | status | feature | package | local | need |
963
964
  | --- | --- | --- | --- | --- | --- | --- |
@@ -965,6 +966,8 @@ What an app needed from Genesis and didn't find goes in `docs/genesis-upstream.m
965
966
 
966
967
  `kind` is `gap` (nothing in Genesis), `extension` (a part with no prop, variant or slot for it)
967
968
  or `invention` (the app built it). `status` is `candidate`, `proposed`, `promoted` or `declined`.
969
+ `local` is the app's own code for it: repo-relative paths, separated by `, ` (a comma and a space)
970
+ or `<br>`; a comma with no space after it stays part of the path.
968
971
 
969
972
  - `genesis upstream check` validates it, and warns when a promoted entry's local code is still
970
973
  there (delete your copy and use the Genesis one).
package/dist/cli.js CHANGED
@@ -7623,11 +7623,13 @@ var init_features = __esm({
7623
7623
  var upstream_exports = {};
7624
7624
  __export(upstream_exports, {
7625
7625
  REGISTER_PATH: () => REGISTER_PATH,
7626
+ REGISTER_PATHS: () => REGISTER_PATHS,
7626
7627
  UPSTREAM_KINDS: () => UPSTREAM_KINDS,
7627
7628
  UPSTREAM_STATUSES: () => UPSTREAM_STATUSES,
7628
7629
  cells: () => cells,
7629
7630
  checkUpstream: () => checkUpstream,
7630
7631
  exportIssueUrl: () => exportIssueUrl,
7632
+ localPaths: () => localPaths,
7631
7633
  readRegister: () => readRegister
7632
7634
  });
7633
7635
  function cells(line) {
@@ -7680,27 +7682,32 @@ function readRegister(markdown) {
7680
7682
  const need = at(row, "need");
7681
7683
  if (!need || need === "-") problems.push(`${where2}: say the need in one line`);
7682
7684
  const local = at(row, "local");
7683
- if (local && local !== "-" && (path28.isAbsolute(local) || /^[A-Za-z]:[\\/]/.test(local) || local.split(/[\\/]/).includes(".."))) {
7684
- problems.push(`${where2}: local must be a path inside the app, relative to its root`);
7685
+ if (local && local !== "-" && localPaths(local).some((p) => path28.isAbsolute(p) || /^[A-Za-z]:[\\/]/.test(p) || p.split(/[\\/]/).includes(".."))) {
7686
+ problems.push(`${where2}: local must be paths inside the app, relative to its root`);
7685
7687
  }
7686
7688
  const opt = (c) => at(row, c) && at(row, c) !== "-" ? at(row, c) : void 0;
7687
7689
  entries.push({ id, kind, status, need, ...opt("feature") ? { feature: opt("feature") } : {}, ...opt("package") ? { package: opt("package") } : {}, ...opt("local") ? { local: opt("local") } : {} });
7688
7690
  }
7689
7691
  return { entries, problems };
7690
7692
  }
7693
+ function localPaths(local) {
7694
+ return (local ?? "").split(/,\s+|<br\s*\/?>/i).map((p) => p.trim()).filter((p) => p && p !== "-");
7695
+ }
7691
7696
  function checkUpstream(root) {
7692
- const file = path28.join(root, REGISTER_PATH);
7693
- if (!existsSync(file)) return { entries: [], problems: [], warnings: [`no ${REGISTER_PATH}: nothing to check (add it when the app first needs something Genesis lacks)`], missing: true };
7694
- const { entries, problems } = readRegister(readFileSync(file, "utf8"));
7697
+ const found = REGISTER_PATHS.find((p) => existsSync(path28.join(root, p)));
7698
+ if (!found) return { entries: [], problems: [], warnings: [`no ${REGISTER_PATHS.join(" or ")}: nothing to check (add one when the app first needs something Genesis lacks)`], missing: true };
7699
+ const { entries, problems } = readRegister(readFileSync(path28.join(root, found), "utf8"));
7695
7700
  const warnings = [];
7696
7701
  for (const e of entries) {
7697
- if (e.local && !existsSync(path28.join(root, e.local))) {
7698
- if (e.status !== "promoted" && e.status !== "declined") problems.push(`${e.id}: local ${e.local} doesn't exist`);
7699
- } else if (e.local && e.status === "promoted") {
7700
- warnings.push(`${e.id}: Genesis ships it now; delete ${e.local} and use ${e.package ?? e.feature ?? "the Genesis version"}`);
7702
+ const paths = localPaths(e.local);
7703
+ const absent = paths.filter((p) => !existsSync(path28.join(root, p)));
7704
+ const present = paths.filter((p) => !absent.includes(p));
7705
+ if (absent.length && e.status !== "promoted" && e.status !== "declined") problems.push(`${e.id}: local ${absent.join(", ")} doesn't exist`);
7706
+ if (present.length && e.status === "promoted") {
7707
+ warnings.push(`${e.id}: Genesis ships it now; delete ${present.join(", ")} and use ${e.package ?? e.feature ?? "the Genesis version"}`);
7701
7708
  }
7702
7709
  }
7703
- return { entries, problems, warnings };
7710
+ return { entries, problems, warnings, file: found };
7704
7711
  }
7705
7712
  function exportIssueUrl(entry) {
7706
7713
  const kindOption = { gap: "gap (Genesis has nothing for it)", extension: "extension (a Genesis part is close but has no prop, variant or slot for it)", invention: "invention (the app built it; it may belong in Genesis)" }[entry.kind];
@@ -7710,12 +7717,13 @@ function exportIssueUrl(entry) {
7710
7717
  if (entry.package) params.set("package", entry.package);
7711
7718
  return `${ISSUE_FORM}?${params.toString()}`;
7712
7719
  }
7713
- var UPSTREAM_KINDS, UPSTREAM_STATUSES, REGISTER_PATH, COLUMNS, ISSUE_FORM;
7720
+ var UPSTREAM_KINDS, UPSTREAM_STATUSES, REGISTER_PATH, REGISTER_PATHS, COLUMNS, ISSUE_FORM;
7714
7721
  var init_upstream = __esm({
7715
7722
  "src/upstream.ts"() {
7716
7723
  UPSTREAM_KINDS = ["gap", "extension", "invention"];
7717
7724
  UPSTREAM_STATUSES = ["candidate", "proposed", "promoted", "declined"];
7718
7725
  REGISTER_PATH = "docs/genesis-upstream.md";
7726
+ REGISTER_PATHS = [REGISTER_PATH, "genesis-upstream.md"];
7719
7727
  COLUMNS = ["id", "kind", "status", "feature", "package", "local", "need"];
7720
7728
  ISSUE_FORM = "https://github.com/marktiderman/genesis/issues/new";
7721
7729
  }
@@ -9719,9 +9727,9 @@ upstream.command("check").description("Check docs/genesis-upstream.md: kinds, st
9719
9727
  upstream.command("export").description("Print the link that files a register entry with Genesis through the gap form (sends nothing)").argument("<id>", "The entry's id").option("-d, --dir <dir>", "The app's folder", process.cwd()).action(async (id, opts) => {
9720
9728
  const { checkUpstream: checkUpstream2, exportIssueUrl: exportIssueUrl2 } = await Promise.resolve().then(() => (init_upstream(), upstream_exports));
9721
9729
  const register = checkUpstream2(path28.resolve(opts.dir));
9722
- if (register.missing) return program.error("There is no docs/genesis-upstream.md here; add the register first (see genesis upstream check).");
9730
+ if (register.missing) return program.error("There is no docs/genesis-upstream.md or genesis-upstream.md here; add the register first (see genesis upstream check).");
9723
9731
  const entry = register.entries.find((e) => e.id === id);
9724
- if (!entry) return program.error(`No register entry "${id}" in docs/genesis-upstream.md.`);
9732
+ if (!entry) return program.error(`No register entry "${id}" in ${register.file}.`);
9725
9733
  const own = register.problems.filter((p) => p.startsWith(`${id}:`) || p.startsWith(`${id} `));
9726
9734
  if (own.length) return program.error(`Fix the entry first:
9727
9735
  ${own.map((p) => ` ${p}`).join("\n")}`);