@astryxdesign/cli 0.7.2-canary.5c75a75 → 0.7.2-canary.64e1dde
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 +21 -20
- package/api/build/help/help.mjs +1 -1
- package/api/component/_adapter.d.mts +41 -1
- package/api/component/_adapter.mjs +93 -7
- package/api/component/component.mjs +22 -5
- package/api/component/component.test.mjs +420 -167
- package/api/component/integration-export-name.test.mjs +644 -0
- package/api/component/list/list.mjs +42 -4
- 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/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 +11 -0
- package/api/docs/_adapter.mjs +244 -1
- package/api/docs/integrationDocs.test.mjs +124 -0
- 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 +22 -0
- package/api/integration/_adapter.mjs +67 -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 +24 -4
- package/api/integration/authoring-checks.test.mjs +365 -0
- package/api/integration/authoring-checks.type.d.mts +59 -0
- package/api/integration/authoring-checks.type.mjs +35 -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 +43 -6
- package/api/integration/integrationDocConflicts.doc.mjs +17 -5
- package/api/integration/pack-check.mjs +353 -114
- package/api/integration/pack-check.test.mjs +700 -0
- package/api/integration/validate-integration.mjs +8 -0
- package/api/integration/validate-integration.test.mjs +11 -0
- 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 +609 -53
- package/api/search/search.test.mjs +175 -0
- package/api/swizzle/copy/copy.mjs +28 -14
- package/api/template/template.test.mjs +120 -3
- package/api/theme/build/build.family.test.mjs +64 -0
- package/api/theme/build/build.mjs +180 -24
- 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/codemods/transforms/next/__tests__/migrate-list-edge-compensation-to-edge.test.mjs +120 -0
- package/assets/codemods/transforms/next/index.mjs +11 -1
- package/assets/codemods/transforms/next/migrate-list-edge-compensation-to-edge.mjs +198 -0
- 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/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 +196 -0
- package/assets/docs/tree/check-your-docs.doc.mjs +57 -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 +25 -16
- 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 +1 -1
- 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 +2 -2
- 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 +4 -6
- 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/docs/working-with-ai.doc.mjs +43 -4
- package/assets/templates/blocks/components/Drawer/DrawerForm.doc.mjs +24 -0
- package/assets/templates/blocks/components/Drawer/DrawerForm.tsx +62 -0
- package/assets/templates/blocks/components/Drawer/DrawerScrim.doc.mjs +22 -0
- package/assets/templates/blocks/components/Drawer/DrawerScrim.tsx +68 -0
- package/assets/templates/blocks/components/Drawer/DrawerShowcase.doc.mjs +22 -0
- package/assets/templates/blocks/components/Drawer/DrawerShowcase.tsx +41 -0
- package/assets/templates/blocks/components/Drawer/DrawerStart.doc.mjs +21 -0
- package/assets/templates/blocks/components/Drawer/DrawerStart.tsx +41 -0
- package/assets/templates/blocks/components/Drawer/DrawerWidths.doc.mjs +22 -0
- package/assets/templates/blocks/components/Drawer/DrawerWidths.tsx +54 -0
- package/assets/templates/blocks/components/DrawerHeader/DrawerHeaderShowcase.doc.mjs +15 -0
- package/assets/templates/blocks/components/DrawerHeader/DrawerHeaderShowcase.tsx +73 -0
- package/assets/templates/blocks/components/DrawerHeader/DrawerHeaderSubtitleEndContent.doc.mjs +22 -0
- package/assets/templates/blocks/components/DrawerHeader/DrawerHeaderSubtitleEndContent.tsx +49 -0
- package/assets/templates/blocks/components/DrawerHeader/DrawerHeaderWithCloseButton.doc.mjs +21 -0
- package/assets/templates/blocks/components/DrawerHeader/DrawerHeaderWithCloseButton.tsx +42 -0
- package/assets/templates/pages/detail-page/page.tsx +3 -3
- package/assets/templates/pages/table-inbox/page.tsx +10 -8
- 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/base/type.ts +6 -0
- package/authoring/doctypes/command/command.doc.mjs +14 -12
- package/authoring/doctypes/component/component.doc.mjs +31 -28
- package/authoring/doctypes/component/type.ts +13 -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/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 +224 -6
- package/clients/cli/commands/build-theme.registry.test.mjs +5 -2
- 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 +17 -4
- package/clients/cli/commands/doctor-integration-docs.doc.mjs +17 -5
- package/clients/cli/commands/doctor-integration-validate.doc.mjs +13 -2
- package/clients/cli/commands/doctor-integration.test.mjs +837 -0
- package/clients/cli/commands/doctor.mjs +224 -3
- 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-check.doc.mjs +85 -0
- package/clients/cli/commands/integration-check.test.mjs +332 -0
- package/clients/cli/commands/integration.doc.mjs +6 -2
- package/clients/cli/commands/integration.mjs +106 -1
- 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/clients/cli/lib/component-format.mjs +5 -1
- 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 +190 -10
- package/foundation/discovery/component-discovery.export-names.test.mjs +760 -0
- package/foundation/discovery/component-discovery.mjs +864 -56
- package/foundation/discovery/component-discovery.test.mjs +96 -0
- package/foundation/discovery/component-replacement.mjs +18 -0
- package/foundation/discovery/component-replacement.test.mjs +40 -0
- package/foundation/discovery/copied-passages.d.mts +208 -0
- package/foundation/discovery/copied-passages.mjs +720 -0
- package/foundation/discovery/copied-passages.test.mjs +124 -0
- package/foundation/discovery/doc-types.d.mts +157 -0
- package/foundation/discovery/doc-types.mjs +1224 -0
- package/foundation/discovery/doc-types.test.mjs +700 -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 +278 -0
- package/foundation/discovery/prop-drift.mjs +2263 -0
- package/foundation/discovery/prop-drift.test.mjs +2272 -0
- package/foundation/discovery/template-adapter.mjs +74 -5
- 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 +19 -1
- package/foundation/doc-compiler/inputs.mjs +23 -0
- package/foundation/doc-compiler/inputs.test.mjs +0 -1
- package/foundation/doc-compiler/links.d.mts +9 -5
- package/foundation/doc-compiler/links.mjs +4 -2
- 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.mjs +6 -1
- package/foundation/response/response-types.doc.mjs +14 -8
- package/foundation/xle/registry.mjs +4 -0
- package/foundation/xle/registry.test.mjs +28 -0
- package/package.json +12 -12
- package/scripts/postinstall.mjs +3 -3
|
@@ -18,6 +18,11 @@ import {discoverCoreTemplates} from '../../foundation/discovery/template-adapter
|
|
|
18
18
|
import {discoverOwnedComponents} from '../../foundation/discovery/component-discovery.mjs';
|
|
19
19
|
import {discoverBuiltinTopics} from '../../foundation/discovery/docs-discovery.mjs';
|
|
20
20
|
import {findCoreDir} from '../../foundation/fs/paths.mjs';
|
|
21
|
+
import {
|
|
22
|
+
builtinGuideFiles,
|
|
23
|
+
loadTopicModule,
|
|
24
|
+
} from '../../foundation/discovery/docs-discovery.mjs';
|
|
25
|
+
import {proseWords} from '../../foundation/discovery/copied-passages.mjs';
|
|
21
26
|
import {
|
|
22
27
|
integrationComponentConflicts,
|
|
23
28
|
integrationDocConflicts,
|
|
@@ -99,6 +104,44 @@ function writeDocIntegration({name, replaces, extendsTopic}) {
|
|
|
99
104
|
);
|
|
100
105
|
}
|
|
101
106
|
|
|
107
|
+
/**
|
|
108
|
+
* A docs-only package with one generic topic per entry: its prose, and
|
|
109
|
+
* optionally a code block and the Core topic it replaces.
|
|
110
|
+
* @param {{name: string, text: string, code?: string, replaces?: string}[]} topics
|
|
111
|
+
*/
|
|
112
|
+
function writeTopics(topics) {
|
|
113
|
+
fs.writeFileSync(
|
|
114
|
+
path.join(tmpDir, 'package.json'),
|
|
115
|
+
JSON.stringify({name: '@acme/widgets', version: '1.2.3'}),
|
|
116
|
+
);
|
|
117
|
+
fs.writeFileSync(
|
|
118
|
+
path.join(tmpDir, 'astryx.integration.mjs'),
|
|
119
|
+
`export default {docs: './docs'};\n`,
|
|
120
|
+
);
|
|
121
|
+
fs.mkdirSync(path.join(tmpDir, 'docs'), {recursive: true});
|
|
122
|
+
for (const {name, text, code, replaces, extendsTopic} of topics) {
|
|
123
|
+
const blocks = [{type: 'prose', text}];
|
|
124
|
+
if (code != null) blocks.push({type: 'code', lang: 'text', code});
|
|
125
|
+
const doc = {
|
|
126
|
+
type: 'generic',
|
|
127
|
+
name,
|
|
128
|
+
title: 'Fixture',
|
|
129
|
+
description: 'Fixture topic.',
|
|
130
|
+
...(replaces == null ? {} : {replaces}),
|
|
131
|
+
...(extendsTopic == null ? {} : {extends: extendsTopic}),
|
|
132
|
+
sections: [{title: 'Overview', content: blocks}],
|
|
133
|
+
};
|
|
134
|
+
fs.writeFileSync(
|
|
135
|
+
path.join(tmpDir, 'docs', `${name}.doc.mjs`),
|
|
136
|
+
`export default ${JSON.stringify(doc)};\n`,
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
const PASSAGE =
|
|
142
|
+
'Themes cannot style the layer that holds a menu or a popover, so a menu ' +
|
|
143
|
+
'keeps the default surface color until the next release adds a token for it.';
|
|
144
|
+
|
|
102
145
|
beforeEach(() => {
|
|
103
146
|
tmpDir = fs.mkdtempSync(
|
|
104
147
|
path.join(process.cwd(), '.astryx-template-conflicts-'),
|
|
@@ -417,6 +460,45 @@ describe('integrationComponentConflicts', () => {
|
|
|
417
460
|
expect(result.data.conflicts).toEqual([]);
|
|
418
461
|
expect(result.data.issues).toEqual([]);
|
|
419
462
|
});
|
|
463
|
+
|
|
464
|
+
it("compares each component doc's props with the component's TypeScript props, as warnings", async () => {
|
|
465
|
+
writeComponentIntegration('AcmeBadge');
|
|
466
|
+
fs.writeFileSync(
|
|
467
|
+
path.join(tmpDir, 'components', 'AcmeBadge.doc.mjs'),
|
|
468
|
+
`export default {type: 'component', name: 'AcmeBadge', displayName: 'AcmeBadge', description: 'Fixture component.', props: [{name: 'label', type: 'string', description: 'Text.', required: true}, {name: 'size', type: "'sm' | 'md'", description: 'Size.'}]};\n`,
|
|
469
|
+
);
|
|
470
|
+
fs.writeFileSync(
|
|
471
|
+
path.join(tmpDir, 'components', 'AcmeBadge.tsx'),
|
|
472
|
+
'export function AcmeBadge(props: {label: string; count?: number}) { return null; }\n',
|
|
473
|
+
);
|
|
474
|
+
|
|
475
|
+
const result = await integrationComponentConflicts(undefined, {
|
|
476
|
+
cwd: tmpDir,
|
|
477
|
+
});
|
|
478
|
+
|
|
479
|
+
expect(result.data.issues).toEqual([]);
|
|
480
|
+
expect(result.data.propDrift).toMatchObject({
|
|
481
|
+
status: 'checked',
|
|
482
|
+
components: 1,
|
|
483
|
+
unchecked: [],
|
|
484
|
+
});
|
|
485
|
+
expect(
|
|
486
|
+
result.data.propDrift?.findings.map(f => [f.prop, f.kind, f.severity]),
|
|
487
|
+
).toEqual([
|
|
488
|
+
['count', 'not_in_doc', 'warning'],
|
|
489
|
+
['size', 'not_in_code', 'warning'],
|
|
490
|
+
]);
|
|
491
|
+
});
|
|
492
|
+
|
|
493
|
+
it('leaves propDrift out when the package has no components root', async () => {
|
|
494
|
+
writeDocIntegration({name: 'acme-setup'});
|
|
495
|
+
|
|
496
|
+
const result = await integrationComponentConflicts(undefined, {
|
|
497
|
+
cwd: tmpDir,
|
|
498
|
+
});
|
|
499
|
+
|
|
500
|
+
expect(result.data).not.toHaveProperty('propDrift');
|
|
501
|
+
});
|
|
420
502
|
});
|
|
421
503
|
|
|
422
504
|
describe('integrationDocConflicts', () => {
|
|
@@ -523,3 +605,286 @@ describe('integrationDocConflicts', () => {
|
|
|
523
605
|
]);
|
|
524
606
|
});
|
|
525
607
|
});
|
|
608
|
+
|
|
609
|
+
describe('integrationDocConflicts copied passages', () => {
|
|
610
|
+
const copied = (/** @type {any} */ result) => result.data.copiedPassages;
|
|
611
|
+
|
|
612
|
+
it('lists a passage two of the package topics repeat, and warns about it', async () => {
|
|
613
|
+
writeTopics([
|
|
614
|
+
{name: 'acme-setup', text: `Read this first. ${PASSAGE}`},
|
|
615
|
+
{name: 'acme-menus', text: `${PASSAGE} See the theme guide.`},
|
|
616
|
+
]);
|
|
617
|
+
|
|
618
|
+
const result = await integrationDocConflicts(undefined, {cwd: tmpDir});
|
|
619
|
+
const [issue, ...rest] = copied(result);
|
|
620
|
+
expect(result.data.issues).toEqual([
|
|
621
|
+
{code: 'copied_passage', severity: 'warning', message: issue.message},
|
|
622
|
+
]);
|
|
623
|
+
|
|
624
|
+
expect(rest).toEqual([]);
|
|
625
|
+
// The passage is about menus, so "acme-menus" keeps it.
|
|
626
|
+
expect(issue).toMatchObject({
|
|
627
|
+
topic: 'acme-setup',
|
|
628
|
+
otherTopic: 'acme-menus',
|
|
629
|
+
otherOwner: 'package',
|
|
630
|
+
owner: 'acme-menus',
|
|
631
|
+
section: 'Overview',
|
|
632
|
+
line: 1,
|
|
633
|
+
words: PASSAGE.split(' ').length,
|
|
634
|
+
passages: 1,
|
|
635
|
+
});
|
|
636
|
+
expect(issue.message).toContain(`${PASSAGE.split(' ').length} words`);
|
|
637
|
+
expect(issue.text).toBe(PASSAGE);
|
|
638
|
+
expect(issue.message).toContain(`"${PASSAGE}"`);
|
|
639
|
+
expect(issue.message).toContain(
|
|
640
|
+
'"acme-menus" keeps it: its name, title or section fits the passage.',
|
|
641
|
+
);
|
|
642
|
+
expect(issue.message).toContain(
|
|
643
|
+
'In "acme-setup", replace that whole passage, from its first word to its last, code ticks included, with {@link generic:acme-menus}.',
|
|
644
|
+
);
|
|
645
|
+
});
|
|
646
|
+
|
|
647
|
+
it('reports a passage copied from a Core topic, except into the topic that replaces it', async () => {
|
|
648
|
+
const [file] = builtinGuideFiles();
|
|
649
|
+
const coreDoc = /** @type {any} */ (await loadTopicModule(file));
|
|
650
|
+
const coreText = proseWords(coreDoc)
|
|
651
|
+
.slice(0, 30)
|
|
652
|
+
.map(each => each.word)
|
|
653
|
+
.join(' ');
|
|
654
|
+
|
|
655
|
+
writeTopics([{name: 'acme-copy', text: coreText}]);
|
|
656
|
+
const [issue] = copied(
|
|
657
|
+
await integrationDocConflicts(undefined, {cwd: tmpDir}),
|
|
658
|
+
);
|
|
659
|
+
expect(issue.otherOwner).toBe('core');
|
|
660
|
+
expect(issue.message).toContain(`the Core topic "${coreDoc.name}"`);
|
|
661
|
+
expect(issue.owner).toBe(coreDoc.name);
|
|
662
|
+
expect(issue.message).toContain(
|
|
663
|
+
`code ticks included, with {@link @astryxdesign/cli:generic:${coreDoc.name}}.`,
|
|
664
|
+
);
|
|
665
|
+
|
|
666
|
+
fs.rmSync(path.join(tmpDir, 'docs'), {recursive: true, force: true});
|
|
667
|
+
writeTopics([{name: 'acme-own', text: coreText, replaces: coreDoc.name}]);
|
|
668
|
+
expect(
|
|
669
|
+
copied(await integrationDocConflicts(undefined, {cwd: tmpDir})).filter(
|
|
670
|
+
(/** @type {any} */ each) => each.message.includes(`"${coreDoc.name}"`),
|
|
671
|
+
),
|
|
672
|
+
).toEqual([]);
|
|
673
|
+
});
|
|
674
|
+
|
|
675
|
+
it('leaves out boilerplate that three topics share', async () => {
|
|
676
|
+
writeTopics([
|
|
677
|
+
{name: 'acme-fonts', text: PASSAGE},
|
|
678
|
+
{name: 'acme-icons', text: PASSAGE},
|
|
679
|
+
{name: 'acme-media', text: PASSAGE},
|
|
680
|
+
]);
|
|
681
|
+
|
|
682
|
+
expect(
|
|
683
|
+
copied(await integrationDocConflicts(undefined, {cwd: tmpDir})),
|
|
684
|
+
).toEqual([]);
|
|
685
|
+
});
|
|
686
|
+
|
|
687
|
+
it('leaves out a run of function words, which states no fact', async () => {
|
|
688
|
+
const glue = 'and it is in the way that you can do it for them';
|
|
689
|
+
writeTopics([
|
|
690
|
+
{name: 'acme-a', text: `Start here. ${glue} first.`},
|
|
691
|
+
{name: 'acme-b', text: `Then ${glue} again.`},
|
|
692
|
+
]);
|
|
693
|
+
|
|
694
|
+
expect(
|
|
695
|
+
copied(await integrationDocConflicts(undefined, {cwd: tmpDir})),
|
|
696
|
+
).toEqual([]);
|
|
697
|
+
});
|
|
698
|
+
|
|
699
|
+
it('leaves out a shared phrase under 10 words, and code', async () => {
|
|
700
|
+
const short = PASSAGE.split(' ').slice(0, 9).join(' ');
|
|
701
|
+
writeTopics([
|
|
702
|
+
{name: 'acme-a', text: PASSAGE},
|
|
703
|
+
{name: 'acme-b', text: short},
|
|
704
|
+
{name: 'acme-c', text: 'Run it.', code: PASSAGE},
|
|
705
|
+
]);
|
|
706
|
+
|
|
707
|
+
expect(
|
|
708
|
+
copied(await integrationDocConflicts(undefined, {cwd: tmpDir})),
|
|
709
|
+
).toEqual([]);
|
|
710
|
+
});
|
|
711
|
+
});
|
|
712
|
+
|
|
713
|
+
describe('integrationDocConflicts copied passages and extensions', () => {
|
|
714
|
+
const copied = (/** @type {any} */ result) => result.data.copiedPassages;
|
|
715
|
+
|
|
716
|
+
it('links to the page an extension shows on, not to the extension', async () => {
|
|
717
|
+
writeTopics([
|
|
718
|
+
{name: 'acme-menus', text: PASSAGE, extendsTopic: 'theme'},
|
|
719
|
+
{name: 'acme-setup', text: `${PASSAGE} Then run setup.`},
|
|
720
|
+
]);
|
|
721
|
+
|
|
722
|
+
const [issue] = copied(
|
|
723
|
+
await integrationDocConflicts(undefined, {cwd: tmpDir}),
|
|
724
|
+
);
|
|
725
|
+
|
|
726
|
+
expect(issue).toMatchObject({topic: 'acme-setup', owner: 'acme-menus'});
|
|
727
|
+
expect(issue.message).toContain(
|
|
728
|
+
'with {@link @astryxdesign/cli:generic:theme}.',
|
|
729
|
+
);
|
|
730
|
+
});
|
|
731
|
+
|
|
732
|
+
it('says to delete a copy in a topic that extends its owner', async () => {
|
|
733
|
+
writeTopics([
|
|
734
|
+
{name: 'acme-base', text: PASSAGE},
|
|
735
|
+
{name: 'acme-more', text: PASSAGE, extendsTopic: 'acme-base'},
|
|
736
|
+
]);
|
|
737
|
+
|
|
738
|
+
const [issue] = copied(
|
|
739
|
+
await integrationDocConflicts(undefined, {cwd: tmpDir}),
|
|
740
|
+
);
|
|
741
|
+
|
|
742
|
+
expect(issue).toMatchObject({topic: 'acme-more', owner: 'acme-base'});
|
|
743
|
+
expect(issue.message).toContain(
|
|
744
|
+
'"acme-more" and "acme-base" show on the same page ("acme-base"): delete the passage from "acme-more"',
|
|
745
|
+
);
|
|
746
|
+
expect(issue.message).not.toContain('{@link');
|
|
747
|
+
});
|
|
748
|
+
|
|
749
|
+
it('compares pages without regard to case, and for two extensions of one page', async () => {
|
|
750
|
+
writeTopics([
|
|
751
|
+
{name: 'acme-colors', text: PASSAGE, extendsTopic: 'Theme'},
|
|
752
|
+
{name: 'acme-menus', text: PASSAGE, extendsTopic: 'theme'},
|
|
753
|
+
]);
|
|
754
|
+
|
|
755
|
+
const [issue] = copied(
|
|
756
|
+
await integrationDocConflicts(undefined, {cwd: tmpDir}),
|
|
757
|
+
);
|
|
758
|
+
|
|
759
|
+
expect(issue.message).toContain('show on the same page ("theme")');
|
|
760
|
+
expect(issue.message).not.toContain('{@link');
|
|
761
|
+
});
|
|
762
|
+
|
|
763
|
+
it('finds the line of the string that holds the copy, whatever it opens with', async () => {
|
|
764
|
+
writeTopics([{name: 'acme-menus', text: PASSAGE}]);
|
|
765
|
+
fs.writeFileSync(
|
|
766
|
+
path.join(tmpDir, 'docs', 'acme-setup.doc.mjs'),
|
|
767
|
+
[
|
|
768
|
+
'export default {',
|
|
769
|
+
" type: 'generic',",
|
|
770
|
+
" name: 'acme-setup',",
|
|
771
|
+
" title: 'Fixture',",
|
|
772
|
+
" description: 'Fixture topic.',",
|
|
773
|
+
" sections: [{title: 'Overview', content: [",
|
|
774
|
+
" {type: 'prose', text: '`acme` (the CLI) opens here, as {@link generic:acme-menus} says.'},",
|
|
775
|
+
` {type: 'prose', text: '\`acme\` (the CLI) opens here: ${PASSAGE}'},`,
|
|
776
|
+
' ]}],',
|
|
777
|
+
'};',
|
|
778
|
+
'',
|
|
779
|
+
].join('\n'),
|
|
780
|
+
);
|
|
781
|
+
|
|
782
|
+
const [issue] = copied(
|
|
783
|
+
await integrationDocConflicts(undefined, {cwd: tmpDir}),
|
|
784
|
+
);
|
|
785
|
+
|
|
786
|
+
expect(issue).toMatchObject({topic: 'acme-setup', line: 8});
|
|
787
|
+
});
|
|
788
|
+
|
|
789
|
+
it('does not list a 9-word sentence that ends in a link', async () => {
|
|
790
|
+
const sentence =
|
|
791
|
+
'Theme tokens control every surface color, as explained in {@link generic:acme-theme}.';
|
|
792
|
+
writeTopics([
|
|
793
|
+
{name: 'acme-colors', text: `Colors first. ${sentence}`},
|
|
794
|
+
{name: 'acme-menus', text: `Menus next. ${sentence}`},
|
|
795
|
+
]);
|
|
796
|
+
|
|
797
|
+
expect(
|
|
798
|
+
copied(await integrationDocConflicts(undefined, {cwd: tmpDir})),
|
|
799
|
+
).toEqual([]);
|
|
800
|
+
});
|
|
801
|
+
|
|
802
|
+
it('counts no function word toward which topic a passage fits', async () => {
|
|
803
|
+
writeTopics([
|
|
804
|
+
{name: 'acme-getting-started', text: `${PASSAGE} Then run setup.`},
|
|
805
|
+
{name: 'acme-menus', text: PASSAGE},
|
|
806
|
+
]);
|
|
807
|
+
// Titles that share only function words with the passage.
|
|
808
|
+
for (const [name, title] of [
|
|
809
|
+
['acme-getting-started', 'Get started with the widgets'],
|
|
810
|
+
['acme-menus', 'Menus'],
|
|
811
|
+
]) {
|
|
812
|
+
const file = path.join(tmpDir, 'docs', `${name}.doc.mjs`);
|
|
813
|
+
fs.writeFileSync(
|
|
814
|
+
file,
|
|
815
|
+
fs
|
|
816
|
+
.readFileSync(file, 'utf8')
|
|
817
|
+
.replace('"title":"Fixture"', `"title":"${title}"`),
|
|
818
|
+
);
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
const [issue] = copied(
|
|
822
|
+
await integrationDocConflicts(undefined, {cwd: tmpDir}),
|
|
823
|
+
);
|
|
824
|
+
|
|
825
|
+
expect(issue).toMatchObject({
|
|
826
|
+
owner: 'acme-menus',
|
|
827
|
+
topic: 'acme-getting-started',
|
|
828
|
+
});
|
|
829
|
+
});
|
|
830
|
+
|
|
831
|
+
it('finds a copy after a lead-in three topics share', async () => {
|
|
832
|
+
const lead =
|
|
833
|
+
'Every package ships its integration docs as plain modules the CLI reads';
|
|
834
|
+
writeTopics([
|
|
835
|
+
{name: 'acme-menus', text: `${lead}. ${PASSAGE}`},
|
|
836
|
+
{name: 'acme-setup', text: `${lead}. ${PASSAGE} Then run setup.`},
|
|
837
|
+
{name: 'acme-other', text: `${lead}. Nothing else here is shared.`},
|
|
838
|
+
]);
|
|
839
|
+
|
|
840
|
+
const found = copied(
|
|
841
|
+
await integrationDocConflicts(undefined, {cwd: tmpDir}),
|
|
842
|
+
);
|
|
843
|
+
|
|
844
|
+
expect(found).toHaveLength(1);
|
|
845
|
+
expect(found[0].text).toBe(PASSAGE);
|
|
846
|
+
});
|
|
847
|
+
|
|
848
|
+
it("links to a package topic that replaces Core's by its own name", async () => {
|
|
849
|
+
writeTopics([
|
|
850
|
+
{name: 'theme', text: PASSAGE, replaces: 'theme'},
|
|
851
|
+
{name: 'acme-setup', text: `${PASSAGE} Then run setup.`},
|
|
852
|
+
]);
|
|
853
|
+
|
|
854
|
+
const found = copied(
|
|
855
|
+
await integrationDocConflicts(undefined, {cwd: tmpDir}),
|
|
856
|
+
);
|
|
857
|
+
|
|
858
|
+
for (const each of found) {
|
|
859
|
+
expect(each.message).not.toContain('@astryxdesign/cli:generic:theme');
|
|
860
|
+
}
|
|
861
|
+
expect(
|
|
862
|
+
found.some((/** @type {any} */ each) =>
|
|
863
|
+
each.message.includes('with {@link generic:theme}.'),
|
|
864
|
+
),
|
|
865
|
+
).toBe(true);
|
|
866
|
+
});
|
|
867
|
+
|
|
868
|
+
it('prints no link to a Core topic one of the package topics replaces', async () => {
|
|
869
|
+
const [file] = builtinGuideFiles();
|
|
870
|
+
const coreDoc = /** @type {any} */ (await loadTopicModule(file));
|
|
871
|
+
const coreText = proseWords(coreDoc)
|
|
872
|
+
.slice(0, 30)
|
|
873
|
+
.map(each => each.word)
|
|
874
|
+
.join(' ');
|
|
875
|
+
writeTopics([
|
|
876
|
+
{name: 'acme-own', text: 'Our version.', replaces: coreDoc.name},
|
|
877
|
+
{name: 'acme-copy', text: coreText},
|
|
878
|
+
]);
|
|
879
|
+
|
|
880
|
+
const found = copied(
|
|
881
|
+
await integrationDocConflicts(undefined, {cwd: tmpDir}),
|
|
882
|
+
).filter((/** @type {any} */ each) => each.owner === coreDoc.name);
|
|
883
|
+
|
|
884
|
+
expect(found).toHaveLength(1);
|
|
885
|
+
expect(found[0].message).toContain(
|
|
886
|
+
`"acme-own" replaces the Core topic "${coreDoc.name}"`,
|
|
887
|
+
);
|
|
888
|
+
expect(found[0].message).not.toContain('{@link');
|
|
889
|
+
});
|
|
890
|
+
});
|
|
@@ -32,6 +32,55 @@ export type IntegrationDocFinding = {
|
|
|
32
32
|
coreTopic: string;
|
|
33
33
|
message: string;
|
|
34
34
|
};
|
|
35
|
+
/**
|
|
36
|
+
* A passage two topics repeat word for word: two of the package's own topics,
|
|
37
|
+
* or one of them and a Core topic (never the Core topic it replaces). Only
|
|
38
|
+
* prose counts, and only a run of 10 or more identical words, so each entry
|
|
39
|
+
* is a real copy. Each is also a `copied_passage` warning, so
|
|
40
|
+
* `integration check --strict` fails on it (architecture:cli-surface DEC-8).
|
|
41
|
+
*/
|
|
42
|
+
export type CopiedPassage = {
|
|
43
|
+
/**
|
|
44
|
+
* the package topic to change: it repeats the passage
|
|
45
|
+
*/
|
|
46
|
+
topic: string;
|
|
47
|
+
/**
|
|
48
|
+
* the title of the section the passage starts in
|
|
49
|
+
*/
|
|
50
|
+
section: string | null;
|
|
51
|
+
/**
|
|
52
|
+
* the file line where the passage starts in `topic`, or null
|
|
53
|
+
*/
|
|
54
|
+
line: number | null;
|
|
55
|
+
/**
|
|
56
|
+
* the topic that also has it
|
|
57
|
+
*/
|
|
58
|
+
otherTopic: string;
|
|
59
|
+
/**
|
|
60
|
+
* the topic that should keep the text: a Core topic, or of two package topics the one it fits
|
|
61
|
+
*/
|
|
62
|
+
owner: string;
|
|
63
|
+
/**
|
|
64
|
+
* the passage as `topic` writes it: what to replace
|
|
65
|
+
*/
|
|
66
|
+
text: string;
|
|
67
|
+
/**
|
|
68
|
+
* whether that topic is the package's own or Core's
|
|
69
|
+
*/
|
|
70
|
+
otherOwner: "package" | "core";
|
|
71
|
+
/**
|
|
72
|
+
* the length of the longest shared run, in words
|
|
73
|
+
*/
|
|
74
|
+
words: number;
|
|
75
|
+
/**
|
|
76
|
+
* how many separate runs the two topics share
|
|
77
|
+
*/
|
|
78
|
+
passages: number;
|
|
79
|
+
/**
|
|
80
|
+
* what is repeated, and the exact fix: the passage in `topic` replaced by a link to `owner`
|
|
81
|
+
*/
|
|
82
|
+
message: string;
|
|
83
|
+
};
|
|
35
84
|
/**
|
|
36
85
|
* Each of the three authoring checks reports `validated`: false means no
|
|
37
86
|
* integration manifest was found, so nothing was inspected and the empty
|
|
@@ -47,6 +96,14 @@ export type IntegrationTemplateConflictResponse = {
|
|
|
47
96
|
issues: import("../../foundation/integrations/issue").AstryxIntegrationIssue[];
|
|
48
97
|
};
|
|
49
98
|
};
|
|
99
|
+
/**
|
|
100
|
+
* Documented props compared with the component's TypeScript props. Present
|
|
101
|
+
* when the manifest loads and declares a components root. `status: 'skipped'`
|
|
102
|
+
* means nothing was compared (no TypeScript in the project) and `reason` says
|
|
103
|
+
* why. Every finding is a warning.
|
|
104
|
+
*/
|
|
105
|
+
export type PropDriftReport = import("../../foundation/discovery/prop-drift.mjs").PropDriftReport;
|
|
106
|
+
export type PropDriftFinding = import("../../foundation/discovery/prop-drift.mjs").PropDriftFinding;
|
|
50
107
|
export type IntegrationComponentConflictResponse = {
|
|
51
108
|
type: "integration.component-conflicts";
|
|
52
109
|
data: {
|
|
@@ -55,6 +112,7 @@ export type IntegrationComponentConflictResponse = {
|
|
|
55
112
|
version: string | null;
|
|
56
113
|
conflicts: IntegrationComponentConflict[];
|
|
57
114
|
issues: import("../../foundation/integrations/issue").AstryxIntegrationIssue[];
|
|
115
|
+
propDrift?: PropDriftReport;
|
|
58
116
|
};
|
|
59
117
|
};
|
|
60
118
|
export type IntegrationDocConflictResponse = {
|
|
@@ -64,6 +122,7 @@ export type IntegrationDocConflictResponse = {
|
|
|
64
122
|
name: string | null;
|
|
65
123
|
version: string | null;
|
|
66
124
|
findings: IntegrationDocFinding[];
|
|
125
|
+
copiedPassages: CopiedPassage[];
|
|
67
126
|
issues: import("../../foundation/integrations/issue").AstryxIntegrationIssue[];
|
|
68
127
|
};
|
|
69
128
|
};
|
|
@@ -48,6 +48,26 @@
|
|
|
48
48
|
* @property {string} message
|
|
49
49
|
*/
|
|
50
50
|
|
|
51
|
+
/**
|
|
52
|
+
* A passage two topics repeat word for word: two of the package's own topics,
|
|
53
|
+
* or one of them and a Core topic (never the Core topic it replaces). Only
|
|
54
|
+
* prose counts, and only a run of 10 or more identical words, so each entry
|
|
55
|
+
* is a real copy. Each is also a `copied_passage` warning, so
|
|
56
|
+
* `integration check --strict` fails on it (architecture:cli-surface DEC-8).
|
|
57
|
+
*
|
|
58
|
+
* @typedef {object} CopiedPassage
|
|
59
|
+
* @property {string} topic the package topic to change: it repeats the passage
|
|
60
|
+
* @property {string | null} section the title of the section the passage starts in
|
|
61
|
+
* @property {number | null} line the file line where the passage starts in `topic`, or null
|
|
62
|
+
* @property {string} otherTopic the topic that also has it
|
|
63
|
+
* @property {string} owner the topic that should keep the text: a Core topic, or of two package topics the one it fits
|
|
64
|
+
* @property {string} text the passage as `topic` writes it: what to replace
|
|
65
|
+
* @property {'package' | 'core'} otherOwner whether that topic is the package's own or Core's
|
|
66
|
+
* @property {number} words the length of the longest shared run, in words
|
|
67
|
+
* @property {number} passages how many separate runs the two topics share
|
|
68
|
+
* @property {string} message what is repeated, and the exact fix: the passage in `topic` replaced by a link to `owner`
|
|
69
|
+
*/
|
|
70
|
+
|
|
51
71
|
/**
|
|
52
72
|
* Each of the three authoring checks reports `validated`: false means no
|
|
53
73
|
* integration manifest was found, so nothing was inspected and the empty
|
|
@@ -58,16 +78,29 @@
|
|
|
58
78
|
* @property {{validated: boolean, name: string | null, version: string | null, conflicts: IntegrationTemplateConflict[], issues: import('../../foundation/integrations/issue').AstryxIntegrationIssue[]}} data
|
|
59
79
|
*/
|
|
60
80
|
|
|
81
|
+
/**
|
|
82
|
+
* Documented props compared with the component's TypeScript props. Present
|
|
83
|
+
* when the manifest loads and declares a components root. `status: 'skipped'`
|
|
84
|
+
* means nothing was compared (no TypeScript in the project) and `reason` says
|
|
85
|
+
* why. Every finding is a warning.
|
|
86
|
+
*
|
|
87
|
+
* @typedef {import('../../foundation/discovery/prop-drift.mjs').PropDriftReport} PropDriftReport
|
|
88
|
+
*/
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* @typedef {import('../../foundation/discovery/prop-drift.mjs').PropDriftFinding} PropDriftFinding
|
|
92
|
+
*/
|
|
93
|
+
|
|
61
94
|
/**
|
|
62
95
|
* @typedef {object} IntegrationComponentConflictResponse
|
|
63
96
|
* @property {'integration.component-conflicts'} type
|
|
64
|
-
* @property {{validated: boolean, name: string | null, version: string | null, conflicts: IntegrationComponentConflict[], issues: import('../../foundation/integrations/issue').AstryxIntegrationIssue[]}} data
|
|
97
|
+
* @property {{validated: boolean, name: string | null, version: string | null, conflicts: IntegrationComponentConflict[], issues: import('../../foundation/integrations/issue').AstryxIntegrationIssue[], propDrift?: PropDriftReport}} data
|
|
65
98
|
*/
|
|
66
99
|
|
|
67
100
|
/**
|
|
68
101
|
* @typedef {object} IntegrationDocConflictResponse
|
|
69
102
|
* @property {'integration.doc-conflicts'} type
|
|
70
|
-
* @property {{validated: boolean, name: string | null, version: string | null, findings: IntegrationDocFinding[], issues: import('../../foundation/integrations/issue').AstryxIntegrationIssue[]}} data
|
|
103
|
+
* @property {{validated: boolean, name: string | null, version: string | null, findings: IntegrationDocFinding[], copiedPassages: CopiedPassage[], issues: import('../../foundation/integrations/issue').AstryxIntegrationIssue[]}} data
|
|
71
104
|
*/
|
|
72
105
|
|
|
73
106
|
export {};
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
// @generated by scripts/sync-api-types.mjs from the JSDoc in api/**/*.mjs.
|
|
2
|
+
// DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The code a skipped comparison carries under `--strict`: its key in the
|
|
6
|
+
* check's result, in snake case, then `_skipped` (`propDrift` is
|
|
7
|
+
* `prop_drift_skipped`).
|
|
8
|
+
* @param {string} key
|
|
9
|
+
*/
|
|
10
|
+
export function skippedCode(key: string): string;
|
|
11
|
+
/**
|
|
12
|
+
* Whether a value is a report a check carries beside its issues: a
|
|
13
|
+
* comparison with a `status` of `checked` or `skipped` and its `findings`.
|
|
14
|
+
* @param {unknown} value
|
|
15
|
+
* @returns {value is IntegrationCheckReport}
|
|
16
|
+
*/
|
|
17
|
+
export function isCheckReport(value: unknown): value is IntegrationCheckReport;
|
|
18
|
+
/**
|
|
19
|
+
* Every warning in one check's result, and every piece of work it skipped,
|
|
20
|
+
* as issues: what `--strict` reports as errors. The counts come from the
|
|
21
|
+
* same list, so the default run and the strict run read the same data.
|
|
22
|
+
* @param {IntegrationCheckName} check
|
|
23
|
+
* @param {IntegrationCheckResponse} response
|
|
24
|
+
* @param {{noPackage?: boolean}} [context] `noPackage`: validate found no
|
|
25
|
+
* package.json, which only it reports; then no other check names a
|
|
26
|
+
* missing manifest as skipped work
|
|
27
|
+
* @returns {{warnings: Array<Omit<IntegrationCheckFailure, 'check' | 'severity'>>, skipped: Array<Omit<IntegrationCheckFailure, 'check' | 'severity'>>}}
|
|
28
|
+
*/
|
|
29
|
+
export function strictIssues(check: IntegrationCheckName, response: IntegrationCheckResponse, context?: {
|
|
30
|
+
noPackage?: boolean;
|
|
31
|
+
}): {
|
|
32
|
+
warnings: Array<Omit<IntegrationCheckFailure, "check" | "severity">>;
|
|
33
|
+
skipped: Array<Omit<IntegrationCheckFailure, "check" | "severity">>;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Count one check's result the way its own subcommand exits. Errors are what
|
|
37
|
+
* make it exit 1: error-severity issues, and for `docs` error findings.
|
|
38
|
+
* Warnings are warning issues, conflicts and findings, and the findings of
|
|
39
|
+
* any report the check carries. Skipped names work that did not run: no
|
|
40
|
+
* integration manifest, or a report that was skipped.
|
|
41
|
+
* @param {IntegrationCheckResponse} response
|
|
42
|
+
* @param {{noPackage?: boolean}} [context] as {@link strictIssues} takes it
|
|
43
|
+
* @returns {Omit<IntegrationCheckResult, 'check' | 'response'>}
|
|
44
|
+
*/
|
|
45
|
+
export function summarizeCheck(response: IntegrationCheckResponse, context?: {
|
|
46
|
+
noPackage?: boolean;
|
|
47
|
+
}): Omit<IntegrationCheckResult, "check" | "response">;
|
|
48
|
+
/**
|
|
49
|
+
* Run every `doctor integration` check against the integration package in
|
|
50
|
+
* `cwd`, as its own build does, and return the `integration.check` envelope.
|
|
51
|
+
*
|
|
52
|
+
* @param {IntegrationCheckOptions} [options]
|
|
53
|
+
* @returns {Promise<IntegrationCheckCommandResponse>}
|
|
54
|
+
*/
|
|
55
|
+
export function integrationCheck(options?: IntegrationCheckOptions): Promise<IntegrationCheckCommandResponse>;
|
|
56
|
+
/**
|
|
57
|
+
* Count the four checks' results into one summary. Each check's own row
|
|
58
|
+
* counts as its subcommand exits; the totals and `failures` count validate's
|
|
59
|
+
* issues once, though the other checks repeat them, and every other finding
|
|
60
|
+
* on its own, so two findings with one message stay two.
|
|
61
|
+
* @param {IntegrationCheckResponse[]} responses validate first
|
|
62
|
+
* @param {boolean} strict
|
|
63
|
+
*/
|
|
64
|
+
export function combineChecks(responses: IntegrationCheckResponse[], strict: boolean): {
|
|
65
|
+
checks: import("../integration-check.type.mjs").IntegrationCheckResult[];
|
|
66
|
+
errors: number;
|
|
67
|
+
warnings: number;
|
|
68
|
+
skipped: string[];
|
|
69
|
+
unchecked: number;
|
|
70
|
+
failures: import("../integration-check.type.mjs").IntegrationCheckFailure[];
|
|
71
|
+
failed: boolean;
|
|
72
|
+
};
|
|
73
|
+
/** @typedef {import('../integration-check.type.mjs').IntegrationCheckName} IntegrationCheckName */
|
|
74
|
+
/** @typedef {import('../integration-check.type.mjs').IntegrationCheckReport} IntegrationCheckReport */
|
|
75
|
+
/** @typedef {import('../integration-check.type.mjs').IntegrationCheckResponse} IntegrationCheckResponse */
|
|
76
|
+
/** @typedef {import('../integration-check.type.mjs').IntegrationCheckResult} IntegrationCheckResult */
|
|
77
|
+
/** @typedef {import('../integration-check.type.mjs').IntegrationCheckOptions} IntegrationCheckOptions */
|
|
78
|
+
/** @typedef {import('../integration-check.type.mjs').IntegrationCheckCommandResponse} IntegrationCheckCommandResponse */
|
|
79
|
+
/** @typedef {import('../integration-check.type.mjs').IntegrationCheckFailure} IntegrationCheckFailure */
|
|
80
|
+
/** The checks `integration check` runs, in the order it runs them. */
|
|
81
|
+
export const INTEGRATION_CHECKS: readonly ["validate", "components", "templates", "docs"];
|
|
82
|
+
/** The skipped-work line for a package with no integration manifest. */
|
|
83
|
+
export const NO_MANIFEST_SKIP: "No astryx.integration.* found next to package.json, so nothing was checked.";
|
|
84
|
+
export namespace CONFLICT_CODES {
|
|
85
|
+
let components: "component_name_conflict";
|
|
86
|
+
let templates: "template_id_conflict";
|
|
87
|
+
}
|
|
88
|
+
/** The code a check with no integration manifest carries under `--strict`. */
|
|
89
|
+
export const NO_MANIFEST_CODE: "missing_manifest";
|
|
90
|
+
export type IntegrationCheckName = import("../integration-check.type.mjs").IntegrationCheckName;
|
|
91
|
+
export type IntegrationCheckReport = import("../integration-check.type.mjs").IntegrationCheckReport;
|
|
92
|
+
export type IntegrationCheckResponse = import("../integration-check.type.mjs").IntegrationCheckResponse;
|
|
93
|
+
export type IntegrationCheckResult = import("../integration-check.type.mjs").IntegrationCheckResult;
|
|
94
|
+
export type IntegrationCheckOptions = import("../integration-check.type.mjs").IntegrationCheckOptions;
|
|
95
|
+
export type IntegrationCheckCommandResponse = import("../integration-check.type.mjs").IntegrationCheckCommandResponse;
|
|
96
|
+
export type IntegrationCheckFailure = import("../integration-check.type.mjs").IntegrationCheckFailure;
|