@astryxdesign/cli 0.7.2-canary.ba80461 → 0.7.2-canary.bd72a5f
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 +74 -73
- package/api/build/help/help.mjs +1 -1
- package/api/component/_adapter.d.mts +72 -1
- package/api/component/_adapter.mjs +209 -7
- package/api/component/component.mjs +82 -15
- package/api/component/doc-links.test.mjs +386 -0
- package/api/component/integration-export-name.test.mjs +644 -0
- package/api/discover/_adapter.d.mts +119 -12
- package/api/discover/_adapter.mjs +449 -10
- package/api/discover/_adapter.test.mjs +599 -17
- package/api/discover/_catalog-view.d.mts +16 -5
- package/api/discover/_catalog-view.mjs +32 -8
- package/api/discover/detail/doc/doc.mjs +9 -1
- package/api/discover/discover.d.mts +11 -0
- package/api/discover/discover.doc.mjs +7 -6
- package/api/discover/discover.mjs +107 -19
- package/api/discover/discover.type.d.mts +18 -7
- package/api/discover/discover.type.mjs +15 -7
- package/api/discover/list/list.d.mts +4 -3
- package/api/discover/list/list.mjs +17 -10
- package/api/docs/_adapter.d.mts +74 -0
- package/api/docs/_adapter.mjs +550 -14
- package/api/docs/integration-tree.test.mjs +22 -0
- package/api/docs/integrationDocs.test.mjs +124 -0
- package/api/docs/list/list.mjs +12 -2
- package/api/doctor/doctor.mjs +27 -3
- package/api/doctor/doctor.test.mjs +43 -0
- package/api/doctor/theme-checks.mjs +1 -1
- package/api/doctor/theme-checks.test.mjs +136 -0
- package/api/gap-report/gap-report.d.mts +3 -0
- package/api/gap-report/gap-report.doc.mjs +11 -3
- package/api/gap-report/gap-report.mjs +219 -52
- package/api/gap-report/gap-report.test.mjs +233 -0
- package/api/gap-report/gap-report.type.d.mts +41 -0
- package/api/gap-report/gap-report.type.mjs +18 -0
- package/api/index.d.mts +2 -0
- package/api/index.mjs +2 -0
- package/api/init/run/run.mjs +2 -2
- package/api/integration/_adapter.d.mts +45 -0
- package/api/integration/_adapter.mjs +112 -0
- package/api/integration/add-contribution.component-names.test.mjs +66 -0
- package/api/integration/add-contribution.mjs +8 -4
- package/api/integration/add-contribution.test.mjs +4 -2
- package/api/integration/authoring-checks.mjs +108 -4
- package/api/integration/authoring-checks.test.mjs +808 -0
- package/api/integration/authoring-checks.type.d.mts +143 -0
- package/api/integration/authoring-checks.type.mjs +74 -2
- package/api/integration/check/check.d.mts +96 -0
- package/api/integration/check/check.mjs +357 -0
- package/api/integration/check/check.test.mjs +489 -0
- package/api/integration/integration-check.type.d.mts +118 -0
- package/api/integration/integration-check.type.mjs +84 -0
- package/api/integration/integrationCheck.doc.d.mts +10 -0
- package/api/integration/integrationCheck.doc.mjs +73 -0
- package/api/integration/integrationComponentConflicts.doc.mjs +45 -6
- package/api/integration/integrationDocConflicts.doc.mjs +22 -5
- package/api/integration/pack-check.mjs +347 -104
- package/api/integration/pack-check.test.mjs +726 -0
- package/api/integration/validate-integration-fixes.test.mjs +67 -0
- package/api/integration/validate-integration.mjs +36 -3
- package/api/integration/validate-integration.test.mjs +88 -8
- package/api/integration/validate-integration.type.d.mts +8 -0
- package/api/integration/validate-integration.type.mjs +12 -1
- package/api/integration/validateIntegration.doc.mjs +19 -3
- package/api/search/search.d.mts +81 -12
- package/api/search/search.domain-priority.test.mjs +108 -18
- package/api/search/search.integration-check.test.mjs +24 -0
- package/api/search/search.mjs +603 -51
- package/api/search/search.test.mjs +139 -0
- package/api/swizzle/copy/copy.mjs +28 -14
- package/api/theme/build/build.family.test.mjs +54 -6
- package/api/theme/build/build.mjs +114 -17
- package/api/theme/themeBuild.doc.mjs +4 -4
- package/api/upgrade/_adapter.d.mts +40 -2
- package/api/upgrade/_adapter.mjs +117 -4
- package/api/upgrade/run/cli-behind-core.test.mjs +438 -0
- package/api/upgrade/run/run.mjs +30 -1
- package/api/upgrade/status/status.d.mts +21 -5
- package/api/upgrade/status/status.mjs +45 -8
- package/api/upgrade/upgrade.doc.mjs +5 -3
- package/api/upgrade/upgrade.type.d.mts +23 -0
- package/api/upgrade/upgrade.type.mjs +16 -1
- package/assets/codemods/runner.mjs +7 -1
- package/assets/discover/official-packages.json +367 -0
- package/assets/docs/README.md +10 -0
- package/assets/docs/author-a-theme.doc.mjs +3 -3
- package/assets/docs/browser-support.doc.mjs +1 -1
- package/assets/docs/getting-started.doc.mjs +3 -3
- package/assets/docs/styling-overview.doc.mjs +1 -1
- package/assets/docs/theme.doc.dense.mjs +1 -1
- package/assets/docs/theme.doc.mjs +2 -2
- package/assets/docs/theme.doc.zh.mjs +1 -1
- package/assets/docs/tree/add-a-component.doc.mjs +11 -1
- package/assets/docs/tree/add-a-theme.doc.mjs +1 -1
- package/assets/docs/tree/add-a-topic.doc.mjs +11 -8
- package/assets/docs/tree/agent-guidance.doc.mjs +2 -2
- package/assets/docs/tree/block-template.doc.mjs +8 -20
- package/assets/docs/tree/build-the-template.doc.mjs +1 -1
- package/assets/docs/tree/check-the-props.doc.mjs +201 -0
- package/assets/docs/tree/check-your-docs.doc.mjs +65 -7
- package/assets/docs/tree/checks.doc.mjs +26 -18
- package/assets/docs/tree/codemods.doc.mjs +4 -4
- package/assets/docs/tree/component-family.doc.mjs +8 -6
- package/assets/docs/tree/component-imports.doc.mjs +10 -2
- package/assets/docs/tree/components.doc.mjs +1 -1
- package/assets/docs/tree/debug-and-gap-reports.doc.mjs +30 -21
- package/assets/docs/tree/define-the-theme.doc.mjs +6 -5
- package/assets/docs/tree/describe-the-component.doc.mjs +2 -2
- package/assets/docs/tree/docs.doc.mjs +3 -3
- package/assets/docs/tree/document-the-template.doc.mjs +1 -1
- package/assets/docs/tree/document-the-theme.doc.mjs +3 -3
- package/assets/docs/tree/export-template-assets.doc.mjs +1 -1
- package/assets/docs/tree/extend-or-replace.doc.mjs +6 -6
- package/assets/docs/tree/fonts-and-assets.doc.mjs +2 -2
- package/assets/docs/tree/generate-a-palette.doc.mjs +5 -3
- package/assets/docs/tree/grade-template-with-agent.doc.mjs +1 -1
- package/assets/docs/tree/integrations.doc.mjs +8 -0
- package/assets/docs/tree/layout-spacing.doc.mjs +2 -3
- package/assets/docs/tree/layout.doc.mjs +6 -6
- package/assets/docs/tree/links.doc.mjs +6 -5
- package/assets/docs/tree/migration-setup.doc.mjs +3 -2
- package/assets/docs/tree/migration-verification.doc.mjs +0 -1
- package/assets/docs/tree/migration.doc.mjs +0 -1
- package/assets/docs/tree/package-and-test.doc.mjs +1 -1
- package/assets/docs/tree/page-template.doc.mjs +4 -8
- package/assets/docs/tree/publishing.doc.mjs +4 -4
- package/assets/docs/tree/quick-start.doc.mjs +38 -22
- package/assets/docs/tree/replace-a-core-component.doc.mjs +4 -6
- package/assets/docs/tree/replace-a-core-template.doc.mjs +6 -8
- package/assets/docs/tree/sections-and-placement.doc.mjs +6 -8
- package/assets/docs/tree/see-it-in-an-app.doc.mjs +4 -2
- package/assets/docs/tree/short-and-findable.doc.mjs +6 -5
- package/assets/docs/tree/single-component.doc.mjs +15 -6
- package/assets/docs/tree/start-a-template.doc.mjs +3 -3
- package/assets/docs/tree/subcomponent.doc.mjs +6 -6
- package/assets/docs/tree/template-assets.doc.mjs +2 -2
- package/assets/docs/tree/template-doc-overview.doc.mjs +5 -16
- package/assets/docs/tree/template-fonts.doc.mjs +1 -1
- package/assets/docs/tree/template-icons.doc.mjs +1 -1
- package/assets/docs/tree/template-images-media.doc.mjs +1 -1
- package/assets/docs/tree/template-styles.doc.mjs +2 -2
- package/assets/docs/tree/templates.doc.mjs +1 -1
- package/assets/docs/tree/test-in-an-app.doc.mjs +3 -3
- package/assets/docs/tree/test-template-in-app.doc.mjs +1 -1
- package/assets/docs/tree/tokens-and-setup.doc.mjs +19 -15
- package/assets/docs/tree/troubleshooting.doc.mjs +16 -8
- package/assets/docs/tree/type-scale.doc.mjs +3 -3
- package/assets/docs/tree/upgrading.doc.mjs +4 -4
- package/assets/docs/tree/use-a-theme-in-an-app.doc.mjs +3 -1
- package/assets/docs/tree/verify-packed-template.doc.mjs +1 -1
- package/assets/docs/tree/versioning.doc.mjs +7 -6
- package/assets/docs/tree/write-the-template-file.doc.mjs +4 -3
- package/assets/docs/use-a-theme.doc.mjs +2 -2
- package/assets/theme.template.ts +1 -1
- package/authoring/codemod/codemod.doc.mjs +7 -3
- package/authoring/config/config.doc.mjs +9 -6
- package/authoring/config/type.ts +4 -2
- package/authoring/discover/discover.doc.mjs +1 -1
- package/authoring/doctypes/base/graph-fields.doc.mjs +6 -4
- package/authoring/doctypes/command/command.doc.mjs +14 -12
- package/authoring/doctypes/component/component.doc.mjs +30 -27
- package/authoring/doctypes/component/type.ts +21 -8
- package/authoring/doctypes/enum/enum.doc.mjs +7 -4
- package/authoring/doctypes/function/function.doc.mjs +9 -8
- package/authoring/doctypes/hook/hook.doc.mjs +5 -4
- package/authoring/doctypes/hook/type.ts +4 -0
- package/authoring/doctypes/namespace/namespace.doc.mjs +7 -6
- package/authoring/doctypes/reference/reference.doc.mjs +11 -10
- package/authoring/doctypes/schema/schema.doc.mjs +9 -9
- package/authoring/doctypes/template/integration-template.doc.d.mts +11 -0
- package/authoring/doctypes/template/integration-template.doc.mjs +49 -0
- package/authoring/doctypes/template/parse.d.mts +6 -2
- package/authoring/doctypes/template/parse.mjs +3 -1
- package/authoring/doctypes/template/template.doc.mjs +3 -3
- package/authoring/doctypes/template/type.ts +22 -0
- package/authoring/doctypes/theme/theme.doc.mjs +2 -2
- package/authoring/gap-report/gap-report.doc.mjs +2 -2
- package/authoring/identity/identity.doc.mjs +3 -3
- package/authoring/index.d.ts +1 -0
- package/authoring/integration/integration.doc.mjs +12 -4
- package/authoring/integration/parse.test.mjs +10 -0
- package/authoring/integration/schema.d.mts +2 -0
- package/authoring/integration/schema.mjs +1 -0
- package/authoring/integration/type.ts +4 -0
- package/clients/cli/commands/build-theme.batch-report.test.mjs +3 -1
- package/clients/cli/commands/build-theme.mjs +1 -1
- package/clients/cli/commands/build-theme.path-safety.test.mjs +155 -21
- package/clients/cli/commands/cli-postinstall.test.mjs +49 -1
- package/clients/cli/commands/discover.broken-integration.test.mjs +4 -1
- package/clients/cli/commands/discover.doc.mjs +1 -1
- package/clients/cli/commands/discover.mjs +144 -93
- package/clients/cli/commands/discover.no-source.test.mjs +447 -33
- package/clients/cli/commands/discover.sources.test.mjs +20 -1
- package/clients/cli/commands/doctor-integration-components.doc.mjs +18 -4
- package/clients/cli/commands/doctor-integration-docs.doc.mjs +19 -5
- package/clients/cli/commands/doctor-integration-validate.doc.mjs +13 -2
- package/clients/cli/commands/doctor-integration.test.mjs +884 -0
- package/clients/cli/commands/doctor.mjs +281 -5
- package/clients/cli/commands/gap-report.doc.mjs +14 -2
- package/clients/cli/commands/gap-report.mjs +24 -2
- package/clients/cli/commands/gap-report.test.mjs +79 -0
- package/clients/cli/commands/integration-authoring.test.mjs +46 -0
- package/clients/cli/commands/integration-check.doc.mjs +85 -0
- package/clients/cli/commands/integration-check.test.mjs +411 -0
- package/clients/cli/commands/integration.doc.mjs +6 -2
- package/clients/cli/commands/integration.mjs +116 -5
- package/clients/cli/commands/json-contract.test.mjs +5 -1
- package/clients/cli/commands/setup-nudge.test.mjs +79 -1
- package/clients/cli/commands/swizzle.mjs +5 -3
- package/clients/cli/commands/swizzle.routing.test.mjs +18 -1
- package/clients/cli/commands/text-json-parity.test.mjs +5 -0
- package/clients/cli/commands/theme-build.doc.mjs +2 -2
- package/clients/cli/commands/upgrade.doc.mjs +14 -0
- package/clients/cli/commands/upgrade.older-cli.test.mjs +160 -0
- package/clients/cli/index.mjs +30 -5
- package/foundation/agent-docs/agent-doc-state.d.mts +14 -0
- package/foundation/agent-docs/agent-doc-state.mjs +38 -0
- package/foundation/agent-docs/agent-docs.d.mts +2 -1
- package/foundation/agent-docs/agent-docs.mjs +8 -6
- package/foundation/config/project.mjs +82 -0
- package/foundation/discovery/authoring-self-docs.mjs +2 -1
- package/foundation/discovery/component-discovery.d.mts +178 -10
- package/foundation/discovery/component-discovery.export-names.test.mjs +760 -0
- package/foundation/discovery/component-discovery.mjs +659 -62
- package/foundation/discovery/component-replacement.mjs +18 -0
- package/foundation/discovery/component-replacement.test.mjs +40 -0
- package/foundation/discovery/copied-passages.d.mts +216 -0
- package/foundation/discovery/copied-passages.mjs +720 -0
- package/foundation/discovery/copied-passages.test.mjs +124 -0
- package/foundation/discovery/doc-consistency.d.mts +34 -0
- package/foundation/discovery/doc-consistency.mjs +513 -0
- package/foundation/discovery/doc-consistency.test.mjs +347 -0
- package/foundation/discovery/doc-fluff.d.mts +112 -0
- package/foundation/discovery/doc-fluff.mjs +328 -0
- package/foundation/discovery/doc-fluff.test.mjs +142 -0
- package/foundation/discovery/doc-types.d.mts +157 -0
- package/foundation/discovery/doc-types.mjs +1231 -0
- package/foundation/discovery/doc-types.test.mjs +744 -0
- package/foundation/discovery/docs-discovery.d.mts +88 -0
- package/foundation/discovery/docs-discovery.mjs +83 -2
- package/foundation/discovery/integration-doc-files.d.mts +22 -0
- package/foundation/discovery/integration-doc-files.mjs +231 -0
- package/foundation/discovery/integration-doc-files.test.mjs +246 -0
- package/foundation/discovery/module-exports.d.mts +27 -0
- package/foundation/discovery/module-exports.mjs +356 -31
- package/foundation/discovery/module-exports.test.mjs +172 -0
- package/foundation/discovery/package-tsconfig.d.mts +14 -0
- package/foundation/discovery/package-tsconfig.mjs +228 -0
- package/foundation/discovery/package-tsconfig.test.mjs +210 -0
- package/foundation/discovery/project-typescript.d.mts +32 -0
- package/foundation/discovery/project-typescript.mjs +89 -0
- package/foundation/discovery/prop-drift.d.mts +297 -0
- package/foundation/discovery/prop-drift.mjs +2428 -0
- package/foundation/discovery/prop-drift.test.mjs +2337 -0
- package/foundation/discovery/stray-pointers.d.mts +52 -0
- package/foundation/discovery/stray-pointers.mjs +293 -0
- package/foundation/discovery/stray-pointers.test.mjs +86 -0
- package/foundation/discovery/type-match.d.mts +53 -0
- package/foundation/discovery/type-match.mjs +660 -0
- package/foundation/discovery/type-match.test.mjs +169 -0
- package/foundation/discovery/type-text.d.mts +68 -0
- package/foundation/discovery/type-text.mjs +658 -0
- package/foundation/discovery/type-text.test.mjs +196 -0
- package/foundation/discovery/unresolved-references.d.mts +62 -0
- package/foundation/discovery/unresolved-references.mjs +790 -0
- package/foundation/discovery/unresolved-references.test.mjs +567 -0
- package/foundation/doc-compiler/doc-loads.test.mjs +26 -0
- package/foundation/doc-compiler/links.d.mts +41 -5
- package/foundation/doc-compiler/links.mjs +167 -28
- package/foundation/doc-compiler/links.test.mjs +97 -4
- package/foundation/doc-compiler/tree.mjs +30 -1
- package/foundation/doc-compiler/tree.test.mjs +7 -0
- package/foundation/env/package-manager.d.mts +32 -0
- package/foundation/env/package-manager.mjs +47 -0
- package/foundation/env/package-manager.test.mjs +194 -7
- package/foundation/fs/module-loader.d.mts +2 -1
- package/foundation/fs/module-loader.mjs +60 -4
- package/foundation/fs/module-loader.test.mjs +194 -0
- package/foundation/integrations/contribution-inventory.d.mts +11 -0
- package/foundation/integrations/contribution-inventory.mjs +56 -3
- package/foundation/integrations/issue.ts +6 -0
- package/foundation/integrations/validate-contributions.mjs +30 -1
- package/foundation/response/response-types.doc.mjs +15 -9
- package/package.json +11 -11
- package/scripts/postinstall.mjs +3 -3
|
@@ -569,4 +569,26 @@ describe('integration docs in the docs tree', () => {
|
|
|
569
569
|
expect(check.status).toBe('warn');
|
|
570
570
|
expect(check.message).toContain('both have the route "cli"');
|
|
571
571
|
}, SLOW);
|
|
572
|
+
|
|
573
|
+
it('says what to write for a link that names a doc by its bare name, and when no doc has that name', async () => {
|
|
574
|
+
scaffold({
|
|
575
|
+
...kit(),
|
|
576
|
+
'bare.doc.mjs': guide('bare', {
|
|
577
|
+
sections: [
|
|
578
|
+
{
|
|
579
|
+
title: 'Overview',
|
|
580
|
+
content: [{type: 'prose', text: 'Read {@link deploy}, then {@link nosuchtopic}.'}],
|
|
581
|
+
},
|
|
582
|
+
],
|
|
583
|
+
}),
|
|
584
|
+
});
|
|
585
|
+
const result = await integrationDocConflicts('@acme/kit', {cwd: tmpDir});
|
|
586
|
+
const graph = result.data.issues.filter(issue => issue.code === 'invalid_doc_graph').map(issue => issue.message);
|
|
587
|
+
expect(graph).toEqual(
|
|
588
|
+
expect.arrayContaining([
|
|
589
|
+
expect.stringContaining('"deploy" is a topic: write `{@link generic:deploy}`.'),
|
|
590
|
+
expect.stringContaining('no topic is named "nosuchtopic"'),
|
|
591
|
+
]),
|
|
592
|
+
);
|
|
593
|
+
}, SLOW);
|
|
572
594
|
});
|
|
@@ -22,6 +22,7 @@ import {docs} from './docs.mjs';
|
|
|
22
22
|
import {search} from '../search/search.mjs';
|
|
23
23
|
import {loadDocsCatalog} from './_adapter.mjs';
|
|
24
24
|
import {AstryxError} from '../error.mjs';
|
|
25
|
+
import {discoverCoreTemplates} from '../../foundation/discovery/template-adapter.mjs';
|
|
25
26
|
|
|
26
27
|
const SLOW = 30_000;
|
|
27
28
|
|
|
@@ -110,6 +111,129 @@ describe('integration-contributed topics', () => {
|
|
|
110
111
|
expect(section.data.title).toBe('Overview');
|
|
111
112
|
}, SLOW);
|
|
112
113
|
|
|
114
|
+
it('reads a link to a component or a template as the command that opens it', async () => {
|
|
115
|
+
scaffold({
|
|
116
|
+
'using-widgets.doc.mjs': topic({
|
|
117
|
+
name: 'using-widgets',
|
|
118
|
+
title: 'Using widgets',
|
|
119
|
+
sections: [
|
|
120
|
+
{
|
|
121
|
+
title: 'Overview',
|
|
122
|
+
content: [
|
|
123
|
+
{
|
|
124
|
+
type: 'prose',
|
|
125
|
+
text: 'Start with {@link component:AcmeButton} or {@link block:acme-card}, built on {@link @astryxdesign/core:component:Button}.',
|
|
126
|
+
},
|
|
127
|
+
],
|
|
128
|
+
},
|
|
129
|
+
],
|
|
130
|
+
}),
|
|
131
|
+
});
|
|
132
|
+
const pkgDir = path.join(tmpDir, 'node_modules', '@acme', 'widgets');
|
|
133
|
+
fs.writeFileSync(
|
|
134
|
+
path.join(pkgDir, 'astryx.integration.mjs'),
|
|
135
|
+
"export default {components: './components', templates: './templates', docs: './docs'};\n",
|
|
136
|
+
);
|
|
137
|
+
fs.mkdirSync(path.join(pkgDir, 'components'));
|
|
138
|
+
fs.writeFileSync(
|
|
139
|
+
path.join(pkgDir, 'components', 'AcmeButton.doc.mjs'),
|
|
140
|
+
"export default {type: 'component', name: 'AcmeButton', displayName: 'Acme Button', description: 'A button.', props: []};\n",
|
|
141
|
+
);
|
|
142
|
+
fs.writeFileSync(
|
|
143
|
+
path.join(pkgDir, 'components', 'AcmeButton.tsx'),
|
|
144
|
+
'export function AcmeButton() { return null; }\n',
|
|
145
|
+
);
|
|
146
|
+
fs.mkdirSync(path.join(pkgDir, 'templates'));
|
|
147
|
+
fs.writeFileSync(
|
|
148
|
+
path.join(pkgDir, 'templates', 'acme-card.doc.mjs'),
|
|
149
|
+
"export default {type: 'block', name: 'Acme card', description: 'A card.'};\n",
|
|
150
|
+
);
|
|
151
|
+
fs.writeFileSync(
|
|
152
|
+
path.join(pkgDir, 'templates', 'acme-card.tsx'),
|
|
153
|
+
'export default function Fixture() { return null; }\n',
|
|
154
|
+
);
|
|
155
|
+
|
|
156
|
+
const detail = await docs('using-widgets', undefined, {cwd: tmpDir, full: true});
|
|
157
|
+
|
|
158
|
+
const prose = JSON.stringify(detail.data.sections);
|
|
159
|
+
expect(prose).toContain('`astryx component AcmeButton --package @acme/widgets`');
|
|
160
|
+
expect(prose).toContain(
|
|
161
|
+
'`astryx template acme-card --type block --package @acme/widgets`',
|
|
162
|
+
);
|
|
163
|
+
expect(prose).toContain('`astryx component Button`');
|
|
164
|
+
expect(prose).not.toContain('{@link');
|
|
165
|
+
}, SLOW);
|
|
166
|
+
|
|
167
|
+
it('selects Core in a link only where the bare name would open something else', async () => {
|
|
168
|
+
const core = await discoverCoreTemplates();
|
|
169
|
+
const page = core.find(template => template.type === 'page')?.dirName;
|
|
170
|
+
const block = core.find(template => template.type === 'block')?.dirName;
|
|
171
|
+
scaffold({
|
|
172
|
+
'using-widgets.doc.mjs': topic({
|
|
173
|
+
name: 'using-widgets',
|
|
174
|
+
title: 'Using widgets',
|
|
175
|
+
sections: [
|
|
176
|
+
{
|
|
177
|
+
title: 'Overview',
|
|
178
|
+
content: [
|
|
179
|
+
{
|
|
180
|
+
type: 'prose',
|
|
181
|
+
text:
|
|
182
|
+
'Core: {@link @astryxdesign/core:component:Button}, {@link @astryxdesign/core:component:Badge}, ' +
|
|
183
|
+
`{@link @astryxdesign/core:page:${page}}, {@link @astryxdesign/core:block:${block}}.`,
|
|
184
|
+
},
|
|
185
|
+
],
|
|
186
|
+
},
|
|
187
|
+
],
|
|
188
|
+
}),
|
|
189
|
+
});
|
|
190
|
+
const pkgDir = path.join(tmpDir, 'node_modules', '@acme', 'widgets');
|
|
191
|
+
// The CLI range that turns component replacement on.
|
|
192
|
+
fs.writeFileSync(
|
|
193
|
+
path.join(pkgDir, 'package.json'),
|
|
194
|
+
JSON.stringify({
|
|
195
|
+
name: '@acme/widgets',
|
|
196
|
+
version: '1.0.0',
|
|
197
|
+
peerDependencies: {'@astryxdesign/cli': '>=0.6.7'},
|
|
198
|
+
peerDependenciesMeta: {'@astryxdesign/cli': {optional: true}},
|
|
199
|
+
}),
|
|
200
|
+
);
|
|
201
|
+
fs.writeFileSync(
|
|
202
|
+
path.join(pkgDir, 'astryx.integration.mjs'),
|
|
203
|
+
"export default {components: './components', templates: './templates', docs: './docs'};\n",
|
|
204
|
+
);
|
|
205
|
+
fs.mkdirSync(path.join(pkgDir, 'components'));
|
|
206
|
+
// AcmeButton replaces Core's Button, so bare `Button` opens AcmeButton.
|
|
207
|
+
fs.writeFileSync(
|
|
208
|
+
path.join(pkgDir, 'components', 'AcmeButton.doc.mjs'),
|
|
209
|
+
"export default {type: 'component', name: 'AcmeButton', displayName: 'Acme Button', description: 'A button.', replaces: 'Button', props: []};\n",
|
|
210
|
+
);
|
|
211
|
+
fs.writeFileSync(
|
|
212
|
+
path.join(pkgDir, 'components', 'AcmeButton.tsx'),
|
|
213
|
+
'export function AcmeButton() { return null; }\n',
|
|
214
|
+
);
|
|
215
|
+
// A page template with a Core page's id makes the bare id ambiguous.
|
|
216
|
+
fs.mkdirSync(path.join(pkgDir, 'templates'));
|
|
217
|
+
fs.writeFileSync(
|
|
218
|
+
path.join(pkgDir, 'templates', `${page}.doc.mjs`),
|
|
219
|
+
"export default {type: 'page', name: 'Acme page', displayName: 'Acme page', description: 'A page.'};\n",
|
|
220
|
+
);
|
|
221
|
+
fs.writeFileSync(
|
|
222
|
+
path.join(pkgDir, 'templates', `${page}.tsx`),
|
|
223
|
+
'export default function Fixture() { return null; }\n',
|
|
224
|
+
);
|
|
225
|
+
|
|
226
|
+
const detail = await docs('using-widgets', undefined, {cwd: tmpDir, full: true});
|
|
227
|
+
|
|
228
|
+
const prose = JSON.stringify(detail.data.sections);
|
|
229
|
+
expect(prose).toContain('`astryx component Button --package @astryxdesign/core`');
|
|
230
|
+
expect(prose).toContain('`astryx component Badge`');
|
|
231
|
+
expect(prose).toContain(
|
|
232
|
+
`\`astryx template ${page} --type page --package @astryxdesign/core\``,
|
|
233
|
+
);
|
|
234
|
+
expect(prose).toContain(`\`astryx template ${block} --type block\``);
|
|
235
|
+
}, SLOW);
|
|
236
|
+
|
|
113
237
|
it('is invisible to a project that does not configure the integration', async () => {
|
|
114
238
|
scaffold({'deploying.doc.mjs': topic()}, {config: 'export default {};\n'});
|
|
115
239
|
const listed = await docs(undefined, undefined, {cwd: tmpDir});
|
package/api/docs/list/list.mjs
CHANGED
|
@@ -15,7 +15,12 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import {loadTopicFile} from '../../../foundation/doc-compiler/read.mjs';
|
|
18
|
-
import {
|
|
18
|
+
import {
|
|
19
|
+
holdsOwnName,
|
|
20
|
+
linkDocText,
|
|
21
|
+
loadDocsCatalog,
|
|
22
|
+
projectTree,
|
|
23
|
+
} from '../_adapter.mjs';
|
|
19
24
|
|
|
20
25
|
/**
|
|
21
26
|
* @param {object} [options]
|
|
@@ -39,7 +44,12 @@ export async function list({cwd} = {}) {
|
|
|
39
44
|
/** @type {import('../docs.type.mjs').DocsListEntry} */
|
|
40
45
|
const listed = {
|
|
41
46
|
topic: entry.name,
|
|
42
|
-
description
|
|
47
|
+
// A link in the description reads as the command that opens its doc.
|
|
48
|
+
description: await linkDocText(
|
|
49
|
+
catalog,
|
|
50
|
+
entry.providerId ?? entry.package,
|
|
51
|
+
description,
|
|
52
|
+
),
|
|
43
53
|
package: entry.package,
|
|
44
54
|
};
|
|
45
55
|
if (entry.replaces != null) listed.replaces = entry.replaces;
|
package/api/doctor/doctor.mjs
CHANGED
|
@@ -351,6 +351,26 @@ export async function checkConfig(ctx) {
|
|
|
351
351
|
}
|
|
352
352
|
}
|
|
353
353
|
|
|
354
|
+
/**
|
|
355
|
+
* Why no integration is implicitly linked, from what actually loaded. A
|
|
356
|
+
* configured integration is named in astryx.config; the package's own manifest
|
|
357
|
+
* loads as itself (`__local`). Only the first may be described as named in
|
|
358
|
+
* astryx.config: a package with no config that loads its own manifest has no
|
|
359
|
+
* config file to name it.
|
|
360
|
+
*
|
|
361
|
+
* @param {Array<{name?: string, __local?: boolean}>} integrations loaded, none
|
|
362
|
+
* autolinked and none that failed to load
|
|
363
|
+
* @returns {string}
|
|
364
|
+
*/
|
|
365
|
+
function describeNoImplicit(integrations) {
|
|
366
|
+
const own = integrations.filter(integration => integration.__local);
|
|
367
|
+
const configured = integrations.length - own.length;
|
|
368
|
+
const ownNames = own.map(integration => integration.name ?? 'this package').join(', ');
|
|
369
|
+
if (own.length === 0) return 'None — every loaded integration is named in astryx.config.';
|
|
370
|
+
if (configured === 0) return `None — the only loaded integration is this package's own manifest (${ownNames}).`;
|
|
371
|
+
return `None — every loaded integration is named in astryx.config or is this package's own manifest (${ownNames}).`;
|
|
372
|
+
}
|
|
373
|
+
|
|
354
374
|
/**
|
|
355
375
|
* Check 6 — integrations that are loaded without an astryx.config entry.
|
|
356
376
|
*
|
|
@@ -395,14 +415,18 @@ export function checkImplicitIntegrations(ctx) {
|
|
|
395
415
|
const unreadable = describeUnreadableManifests(ctx.autolinkFailures ?? []);
|
|
396
416
|
|
|
397
417
|
if (implicit.length === 0) {
|
|
418
|
+
// A record that carries `__loadError` (the package's own manifest, or a
|
|
419
|
+
// configured one, that failed to load) loaded nothing, so it is not named
|
|
420
|
+
// as loaded beside the line reporting that it could not be loaded.
|
|
421
|
+
const loaded = ctx.integrations.filter(integration => !integration.__loadError);
|
|
398
422
|
return {
|
|
399
423
|
id,
|
|
400
424
|
label,
|
|
401
425
|
status: 'info',
|
|
402
426
|
message:
|
|
403
|
-
(
|
|
404
|
-
?
|
|
405
|
-
: unreadable
|
|
427
|
+
(loaded.length > 0
|
|
428
|
+
? describeNoImplicit(loaded)
|
|
429
|
+
: ctx.integrations.length > 0 || unreadable
|
|
406
430
|
? 'None loaded.'
|
|
407
431
|
: 'None — no installed dependency ships an astryx.integration.* manifest.') +
|
|
408
432
|
unreadable,
|
|
@@ -353,6 +353,49 @@ describe('checkImplicitIntegrations', () => {
|
|
|
353
353
|
expect(c.message).toContain('named in astryx.config');
|
|
354
354
|
});
|
|
355
355
|
|
|
356
|
+
// A package with no astryx.config that loads its own manifest: there is no
|
|
357
|
+
// config file, so the message must not say anything is named in one.
|
|
358
|
+
it("names the package's own manifest instead of a config that does not exist", () => {
|
|
359
|
+
const c = checkImplicitIntegrations({
|
|
360
|
+
integrations: [autolinked({__autolinked: false, __local: true, name: '@acme/kit'})],
|
|
361
|
+
});
|
|
362
|
+
expect(c.status).toBe('info');
|
|
363
|
+
expect(c.message).toBe(
|
|
364
|
+
"None — the only loaded integration is this package's own manifest (@acme/kit).",
|
|
365
|
+
);
|
|
366
|
+
expect(c.message).not.toContain('astryx.config');
|
|
367
|
+
});
|
|
368
|
+
|
|
369
|
+
// An own manifest that failed to load keeps a `__local` record carrying
|
|
370
|
+
// `__loadError`; it loaded nothing, so it is never named as loaded.
|
|
371
|
+
it("does not name the package's own manifest as loaded when it failed to load", () => {
|
|
372
|
+
const failed = autolinked({
|
|
373
|
+
__autolinked: false,
|
|
374
|
+
__local: true,
|
|
375
|
+
name: '@acme/kit',
|
|
376
|
+
__loadError: 'astryx.integration.mjs threw: boom',
|
|
377
|
+
});
|
|
378
|
+
const alone = checkImplicitIntegrations({integrations: [failed]});
|
|
379
|
+
expect(alone.status).toBe('info');
|
|
380
|
+
expect(alone.message).toBe('None loaded.');
|
|
381
|
+
const beside = checkImplicitIntegrations({
|
|
382
|
+
integrations: [autolinked({__autolinked: false}), failed],
|
|
383
|
+
});
|
|
384
|
+
expect(beside.message).toBe('None — every loaded integration is named in astryx.config.');
|
|
385
|
+
});
|
|
386
|
+
|
|
387
|
+
it('names both when configured integrations load beside the own manifest', () => {
|
|
388
|
+
const c = checkImplicitIntegrations({
|
|
389
|
+
integrations: [
|
|
390
|
+
autolinked({__autolinked: false}),
|
|
391
|
+
autolinked({__autolinked: false, __local: true, name: '@acme/kit'}),
|
|
392
|
+
],
|
|
393
|
+
});
|
|
394
|
+
expect(c.message).toBe(
|
|
395
|
+
"None — every loaded integration is named in astryx.config or is this package's own manifest (@acme/kit).",
|
|
396
|
+
);
|
|
397
|
+
});
|
|
398
|
+
|
|
356
399
|
it('names the package, the field, and what it contributes', () => {
|
|
357
400
|
// Roots count only when they exist, so this one gives them real folders.
|
|
358
401
|
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'astryx-implicit-'));
|
|
@@ -736,7 +736,7 @@ export async function checkAppThemes(cwd) {
|
|
|
736
736
|
label: 'App imports the theme module',
|
|
737
737
|
status: 'warn',
|
|
738
738
|
message: `Could not prove that project source imports ${state.module.path}${importEvidence.parseFailures ? `; ${importEvidence.parseFailures} source file(s) could not be parsed` : ''}.`,
|
|
739
|
-
fix: `Import {themes, defaultThemeSlug} from the generated module and {Theme} from '@astryxdesign/core', then render <Theme theme={themes[defaultThemeSlug]}>.`,
|
|
739
|
+
fix: `Import {themes, defaultThemeSlug} from the generated module and {Theme} from '@astryxdesign/core/theme', then render <Theme theme={themes[defaultThemeSlug]}>.`,
|
|
740
740
|
});
|
|
741
741
|
}
|
|
742
742
|
|
|
@@ -340,6 +340,142 @@ describe('app-theme doctor checks', () => {
|
|
|
340
340
|
expect(result.message).not.toMatch(/\n\s+at /u);
|
|
341
341
|
});
|
|
342
342
|
|
|
343
|
+
it('passes theme-owners when a built module imports its stylesheet', async () => {
|
|
344
|
+
const {dir, packageDir} = await fixture();
|
|
345
|
+
write(
|
|
346
|
+
path.join(packageDir, 'dist/ocean.js'),
|
|
347
|
+
"import './ocean.css';\nimport '@acme/themes/themes/ocean.css';\nexport const oceanTheme = {name: 'ocean', tokens: {}};\n",
|
|
348
|
+
);
|
|
349
|
+
|
|
350
|
+
const checks = await checkAppThemes(dir);
|
|
351
|
+
|
|
352
|
+
expect(checks.map(item => item.status)).toEqual(Array(10).fill('pass'));
|
|
353
|
+
expect(check(checks, 'theme-owners').message).toContain(
|
|
354
|
+
'every built module loads',
|
|
355
|
+
);
|
|
356
|
+
const cli = runDoctor(dir);
|
|
357
|
+
expect(cli.status).toBe(0);
|
|
358
|
+
expect(cli.stdout).not.toContain('could not load its built module');
|
|
359
|
+
}, 30_000);
|
|
360
|
+
|
|
361
|
+
it('passes every check for an entry that loads its fonts and stylesheet and re-exports the built module', async () => {
|
|
362
|
+
const {dir, packageDir} = await fixture([
|
|
363
|
+
{
|
|
364
|
+
slug: 'ocean',
|
|
365
|
+
fontFamily: 'Ocean Sans',
|
|
366
|
+
fontCss:
|
|
367
|
+
"@font-face { font-family: 'Ocean Sans'; src: local('Ocean Sans'); }\n",
|
|
368
|
+
},
|
|
369
|
+
]);
|
|
370
|
+
write(
|
|
371
|
+
path.join(packageDir, 'dist/ocean.built.js'),
|
|
372
|
+
"export const oceanTheme = {name: 'ocean', tokens: {}, fontFamily: 'Ocean Sans'};\n",
|
|
373
|
+
);
|
|
374
|
+
write(
|
|
375
|
+
path.join(packageDir, 'dist/ocean.js'),
|
|
376
|
+
"import './ocean.fonts.css';\nimport '@acme/themes/themes/ocean.css';\nexport {oceanTheme} from './ocean.built.js';\n",
|
|
377
|
+
);
|
|
378
|
+
|
|
379
|
+
const checks = await checkAppThemes(dir);
|
|
380
|
+
|
|
381
|
+
expect(checks.map(item => [item.id, item.status])).toEqual(
|
|
382
|
+
checks.map(item => [item.id, 'pass']),
|
|
383
|
+
);
|
|
384
|
+
expect(checks).toHaveLength(10);
|
|
385
|
+
const cli = runDoctor(dir);
|
|
386
|
+
expect(cli.status).toBe(0);
|
|
387
|
+
expect(cli.stdout).not.toContain('could not load its built module');
|
|
388
|
+
}, 30_000);
|
|
389
|
+
|
|
390
|
+
it('passes every check for an entry that re-exports a theme whose own name differs from its slug', async () => {
|
|
391
|
+
const {dir, packageDir} = await fixture([
|
|
392
|
+
{
|
|
393
|
+
slug: 'ocean',
|
|
394
|
+
css: '[data-astryx-theme="deep-sea"] { --color-text: black; }\n',
|
|
395
|
+
fontFamily: 'Ocean Sans',
|
|
396
|
+
fontCss:
|
|
397
|
+
"@font-face { font-family: 'Ocean Sans'; src: local('Ocean Sans'); }\n",
|
|
398
|
+
},
|
|
399
|
+
]);
|
|
400
|
+
write(
|
|
401
|
+
path.join(packageDir, 'dist/deep-sea.js'),
|
|
402
|
+
"export const deepSeaTheme = {name: 'deep-sea', tokens: {}, fontFamily: 'Ocean Sans'};\n",
|
|
403
|
+
);
|
|
404
|
+
write(
|
|
405
|
+
path.join(packageDir, 'dist/ocean.js'),
|
|
406
|
+
"import './ocean.fonts.css';\nimport './ocean.css';\nexport {deepSeaTheme as oceanTheme} from './deep-sea.js';\n",
|
|
407
|
+
);
|
|
408
|
+
|
|
409
|
+
const checks = await checkAppThemes(dir);
|
|
410
|
+
|
|
411
|
+
expect(checks.map(item => [item.id, item.status])).toEqual(
|
|
412
|
+
checks.map(item => [item.id, 'pass']),
|
|
413
|
+
);
|
|
414
|
+
expect(checks).toHaveLength(10);
|
|
415
|
+
}, 30_000);
|
|
416
|
+
|
|
417
|
+
it.each([
|
|
418
|
+
[
|
|
419
|
+
'a missing dependency',
|
|
420
|
+
"import '@acme/definitely-missing-dep';\nexport const oceanTheme = {name: 'ocean', tokens: {}};\n",
|
|
421
|
+
'@acme/definitely-missing-dep',
|
|
422
|
+
],
|
|
423
|
+
[
|
|
424
|
+
'a throwing module',
|
|
425
|
+
"throw new Error('broken theme module');\nexport const oceanTheme = {name: 'ocean', tokens: {}};\n",
|
|
426
|
+
'broken theme module',
|
|
427
|
+
],
|
|
428
|
+
])(
|
|
429
|
+
'still fails theme-owners when a built module imports its stylesheet and has %s',
|
|
430
|
+
async (_label, rest, detail) => {
|
|
431
|
+
const {dir, packageDir} = await fixture();
|
|
432
|
+
write(
|
|
433
|
+
path.join(packageDir, 'dist/ocean.js'),
|
|
434
|
+
`import './ocean.css';\n${rest}`,
|
|
435
|
+
);
|
|
436
|
+
|
|
437
|
+
const result = check(await checkAppThemes(dir), 'theme-owners');
|
|
438
|
+
|
|
439
|
+
expect(result).toMatchObject({id: 'theme-owners', status: 'fail'});
|
|
440
|
+
expect(result.message).toContain(
|
|
441
|
+
'Theme "ocean" from @acme/themes could not load its built module',
|
|
442
|
+
);
|
|
443
|
+
expect(result.message).toContain(detail);
|
|
444
|
+
},
|
|
445
|
+
);
|
|
446
|
+
|
|
447
|
+
it("still fails theme-owners when the theme's stylesheet export is missing", async () => {
|
|
448
|
+
const {dir, packageDir} = await fixture();
|
|
449
|
+
write(
|
|
450
|
+
path.join(packageDir, 'dist/ocean.js'),
|
|
451
|
+
"import './ocean.css';\nexport const oceanTheme = {name: 'ocean', tokens: {}};\n",
|
|
452
|
+
);
|
|
453
|
+
fs.rmSync(path.join(packageDir, 'dist/ocean.css'));
|
|
454
|
+
|
|
455
|
+
const result = check(await checkAppThemes(dir), 'theme-owners');
|
|
456
|
+
|
|
457
|
+
expect(result).toMatchObject({id: 'theme-owners', status: 'fail'});
|
|
458
|
+
expect(result.message).toContain(
|
|
459
|
+
'Missing stylesheet export @acme/themes/themes/ocean.css',
|
|
460
|
+
);
|
|
461
|
+
});
|
|
462
|
+
|
|
463
|
+
it('still fails theme-owners when another stylesheet the built module imports is missing', async () => {
|
|
464
|
+
const {dir, packageDir} = await fixture();
|
|
465
|
+
write(
|
|
466
|
+
path.join(packageDir, 'dist/ocean.js'),
|
|
467
|
+
"import './ocean.css';\nimport './fonts.css';\nexport const oceanTheme = {name: 'ocean', tokens: {}};\n",
|
|
468
|
+
);
|
|
469
|
+
|
|
470
|
+
const result = check(await checkAppThemes(dir), 'theme-owners');
|
|
471
|
+
|
|
472
|
+
expect(result).toMatchObject({id: 'theme-owners', status: 'fail'});
|
|
473
|
+
expect(result.message).toContain(
|
|
474
|
+
'Theme "ocean" from @acme/themes could not load its built module',
|
|
475
|
+
);
|
|
476
|
+
expect(result.message).toContain('fonts.css');
|
|
477
|
+
});
|
|
478
|
+
|
|
343
479
|
it('fails theme-owners for an ambiguous multi-theme record', async () => {
|
|
344
480
|
const {dir, packageDir} = await fixture([{slug: 'ocean'}, {slug: 'reef'}]);
|
|
345
481
|
const packageFile = path.join(packageDir, 'package.json');
|
|
@@ -60,6 +60,9 @@ export const GAP_REPORT_CATEGORIES: readonly (Readonly<{
|
|
|
60
60
|
label: "Other";
|
|
61
61
|
}>)[];
|
|
62
62
|
export const PUBLIC_CONFIRMATION_MESSAGE: "Rerun with --confirm-public to file this report.";
|
|
63
|
+
/** What an agent does when more than one destination exists. */
|
|
64
|
+
export const ASK_DESTINATION_MESSAGE: "Ask the person where to file this report, then pass their choice with --to <package>. Never pick a package destination yourself; leave --to out to use the default.";
|
|
65
|
+
export type GapReportDestination = import("./gap-report.type.mjs").GapReportDestination;
|
|
63
66
|
export type ReportTarget = {
|
|
64
67
|
package: string;
|
|
65
68
|
version: string | null;
|
|
@@ -19,6 +19,8 @@ export const doc = {
|
|
|
19
19
|
'Sends a gap report to every configured handler: the project config handler first, then each integration handler in config order. ' +
|
|
20
20
|
'Each handler has 30 s to finish, and its output goes to stderr. Public handlers run only with confirmPublic; internal handlers always run. ' +
|
|
21
21
|
"With no handler, it files a GitHub issue for the owning package only with confirmPublic (without it nothing is sent), or returns the package's issues URL when that is not on GitHub. " +
|
|
22
|
+
"With options.to, the report goes only to that integration's issues URL instead, under the same confirmPublic rule. " +
|
|
23
|
+
'When loaded integrations name their own issues URLs, the response lists every destination with a line telling an agent to ask the person where to file; pass their choice as options.to, never a package the agent picked itself. ' +
|
|
22
24
|
'The report records whether an agent or a person ran it, and the response lists each handler outcome in order.',
|
|
23
25
|
importPath: '@astryxdesign/cli/api',
|
|
24
26
|
signature:
|
|
@@ -67,14 +69,20 @@ export const doc = {
|
|
|
67
69
|
name: 'options.confirmPublic',
|
|
68
70
|
type: 'boolean',
|
|
69
71
|
description:
|
|
70
|
-
'Allow public delivery: public handlers run, and
|
|
72
|
+
'Allow public delivery: public handlers run, and a GitHub issues URL gets an issue filed through the gh CLI.',
|
|
71
73
|
default: 'false',
|
|
72
74
|
},
|
|
75
|
+
{
|
|
76
|
+
name: 'options.to',
|
|
77
|
+
type: 'string',
|
|
78
|
+
description:
|
|
79
|
+
'A destination the person chose: a loaded integration whose manifest names an issues URL. The report goes only to that issues URL; handlers do not run.',
|
|
80
|
+
},
|
|
73
81
|
{
|
|
74
82
|
name: 'options.listCategories',
|
|
75
83
|
type: 'boolean',
|
|
76
84
|
description:
|
|
77
|
-
'Return categories without resolving a route or writing; the component and every other option are refused with ERR_INVALID_ARGUMENT.',
|
|
85
|
+
'Return categories, and the destinations in meta when there is more than one, without resolving a route or writing; the component and every other option are refused with ERR_INVALID_ARGUMENT.',
|
|
78
86
|
default: 'false',
|
|
79
87
|
},
|
|
80
88
|
{
|
|
@@ -115,7 +123,7 @@ export const doc = {
|
|
|
115
123
|
},
|
|
116
124
|
{
|
|
117
125
|
code: 'ERR_UNKNOWN_PACKAGE',
|
|
118
|
-
when: 'the explicitly selected package is not loaded',
|
|
126
|
+
when: 'the explicitly selected package is not loaded, or options.to names no destination (the error lists the destinations)',
|
|
119
127
|
},
|
|
120
128
|
{
|
|
121
129
|
code: 'ERR_NOT_FOUND',
|