An open source design system that's fully customizable and agent ready
TypeScript
fix(cli): links to a topic an integration replaces under the same name open the replacement (#10342)
Joey8f479887d17c
diff --git a/.changeset/replaced-topic-links.md b/.changeset/replaced-topic-links.mdnew file mode 100644index 0000000000..5d4dfa8b9b--- /dev/null+++ b/.changeset/replaced-topic-links.md@@ -0,0 +1,7 @@+---+'@astryxdesign/cli': patch+---++[fix] A link to a topic that an integration replaces under the same name opens the replacement. In an app whose integration replaced `theme` or `getting-started`, `doctor` reported Core's links to them as naming no doc.++@josephfarinadiff --git a/packages/cli/api/docs/_adapter.mjs b/packages/cli/api/docs/_adapter.mjsindex c4512093bd..1515fa38ff 100644--- a/packages/cli/api/docs/_adapter.mjs+++ b/packages/cli/api/docs/_adapter.mjs@@ -700,7 +700,8 @@ function docFinderOver(catalog, tree, fromProvider, summaries = true) {entry &&!entry.tree &&(providerOf(entry) === provider ||- catalog.aliasesOf(entry).includes(parsed.name.toLowerCase()))+ catalog.aliasesOf(entry).includes(parsed.name.toLowerCase()) ||+ entry.replaces?.toLowerCase() === parsed.name.toLowerCase())) {let title = entry.title ?? entry.name;let summary = entry.description ?? '';diff --git a/packages/cli/api/docs/integration-tree.test.mjs b/packages/cli/api/docs/integration-tree.test.mjsindex dcd76df116..f7dbce4875 100644--- a/packages/cli/api/docs/integration-tree.test.mjs+++ b/packages/cli/api/docs/integration-tree.test.mjs@@ -427,6 +427,39 @@ describe('integration docs in the docs tree', () => {expect(check.message).not.toContain('names no doc');}, SLOW);+ it("opens the CLI's links to a topic an integration replaces under the same name", async () => {+ scaffold({+ ...kit(),+ 'theme.doc.mjs': {+ type: 'generic',+ name: 'theme',+ title: 'Acme theme',+ description: 'Theming the Acme kit.',+ replaces: 'theme',+ sections: [{title: 'One', content: [{type: 'prose', text: 'One.'}]}],+ },+ 'getting-started.doc.mjs': {+ type: 'generic',+ name: 'getting-started',+ title: 'Acme getting started',+ description: 'Starting with the Acme kit.',+ replaces: 'getting-started',+ sections: [{title: 'One', content: [{type: 'prose', text: 'One.'}]}],+ },+ });+ const check = await checkDocsTree({+ docsCatalog: await loadDocsCatalog(tmpDir),+ });+ expect(check.message).not.toContain('"generic:theme" names no doc');+ expect(check.message).not.toContain(+ '"generic:getting-started" names no doc',+ );+ expect(check).toMatchObject({id: 'docs-tree', status: 'pass'});+ expect((await docs('theme', undefined, {cwd: tmpDir})).data.title).toBe(+ 'Acme theme',+ );+ }, SLOW);+it("keeps the CLI's routes from a replacement that answers to one, in one package or across a chain", async () => {const flat = (/** @type {string} */ name, /** @type {object} */ extra = {}) => ({type: 'generic',