@astryxdesign/cli 0.6.6 → 0.6.7-canary.13feb39
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/CHANGELOG.md +129 -0
- package/README.md +84 -82
- package/api/build/_adapter.d.mts +20 -0
- package/api/build/_adapter.mjs +24 -0
- package/api/build/build.doc.mjs +1 -1
- package/api/build/build.test.mjs +1 -1
- package/api/build/build.type.d.mts +12 -0
- package/api/build/build.type.mjs +3 -0
- package/api/build/help/help.mjs +1 -1
- package/api/build/kit/kit.mjs +13 -1
- package/api/component/_adapter.d.mts +19 -0
- package/api/component/_adapter.mjs +33 -0
- package/api/component/component-replacement.test.mjs +615 -0
- package/api/component/component.doc.mjs +5 -2
- package/api/component/component.mjs +49 -15
- package/api/component/component.test.mjs +32 -0
- package/api/component/component.type.d.mts +33 -3
- package/api/component/component.type.mjs +10 -3
- package/api/component/detail/blocks/blocks.d.mts +2 -1
- package/api/component/detail/blocks/blocks.mjs +5 -2
- package/api/component/detail/detail.mjs +5 -1
- package/api/component/detail/props/props.d.mts +2 -1
- package/api/component/detail/props/props.mjs +3 -2
- package/api/component/detail/showcase/showcase.d.mts +3 -1
- package/api/component/detail/showcase/showcase.mjs +3 -1
- package/api/component/detail/source/source.d.mts +3 -2
- package/api/component/detail/source/source.mjs +7 -3
- package/api/component/list/list.mjs +128 -10
- package/api/docs/_adapter.d.mts +11 -0
- package/api/docs/_adapter.mjs +73 -1
- package/api/docs/compiled-topics.test.mjs +1 -1
- package/api/docs/detail/detail.mjs +19 -3
- package/api/docs/detail/section/section.d.mts +44 -0
- package/api/docs/detail/section/section.mjs +171 -14
- package/api/docs/detail/section/section.test.mjs +4 -4
- package/api/docs/docOverlays.test.mjs +52 -23
- package/api/docs/docs.depth.test.mjs +2 -0
- package/api/docs/docs.doc.mjs +3 -3
- package/api/docs/docs.mjs +13 -16
- package/api/docs/docs.test.mjs +9 -10
- package/api/docs/docs.type.d.mts +43 -3
- package/api/docs/docs.type.mjs +23 -3
- package/api/docs/index/index.mjs +11 -2
- package/api/docs/index/index.test.mjs +7 -2
- package/api/docs/integration-tree.test.mjs +26 -26
- package/api/docs/integrationDocs.test.mjs +8 -7
- package/api/docs/namespace-section.test.mjs +260 -0
- package/api/docs/node/node.mjs +3 -0
- package/api/docs/token-tables.test.mjs +93 -0
- package/api/doctor/_adapter.d.mts +50 -0
- package/api/doctor/_adapter.mjs +190 -0
- package/api/doctor/doctor.d.mts +6 -10
- package/api/doctor/doctor.doc.mjs +1 -3
- package/api/doctor/doctor.mjs +144 -150
- package/api/doctor/doctor.test.mjs +104 -0
- package/api/doctor/theme-checks.d.mts +24 -0
- package/api/doctor/theme-checks.mjs +1231 -0
- package/api/doctor/theme-checks.test.mjs +667 -0
- package/api/gap-report/gap-report.doc.mjs +2 -1
- package/api/gap-report/gap-report.mjs +15 -1
- package/api/hook/_adapter.d.mts +1 -0
- package/api/hook/_adapter.mjs +3 -0
- package/api/hook/detail/detail.mjs +2 -2
- package/api/hook/detail/params/params.mjs +2 -2
- package/api/hook/hook.type.d.mts +12 -0
- package/api/hook/hook.type.mjs +3 -0
- package/api/hook/list/list.mjs +8 -8
- package/api/index.d.mts +1 -1
- package/api/index.mjs +4 -0
- package/api/init/run/run.d.mts +3 -5
- package/api/init/run/run.mjs +11 -11
- package/api/integration/__fixtures__/released-0.6.5-ocean.d.mts +14 -0
- package/api/integration/__fixtures__/released-0.6.5-ocean.mjs +15 -0
- package/api/integration/add-helpers.d.mts +26 -5
- package/api/integration/add-helpers.mjs +50 -5
- package/api/integration/add-theme.mjs +16 -2
- package/api/integration/add-theme.test.mjs +66 -15
- package/api/integration/authoring-checks.mjs +21 -1
- package/api/integration/integrationComponentConflicts.doc.mjs +6 -3
- package/api/integration/pack-check.component-replaces.test.mjs +126 -0
- package/api/integration/pack-check.d.mts +10 -0
- package/api/integration/pack-check.lifecycle-output.test.mjs +21 -2
- package/api/integration/pack-check.mjs +485 -3
- package/api/integration/pack-check.test.mjs +578 -10
- package/api/integration/validate-integration.mjs +20 -4
- package/api/integration/validate-integration.test.mjs +73 -0
- package/api/layout/check/check.d.mts +1 -0
- package/api/layout/check/check.mjs +1 -0
- package/api/layout/expand/expand.d.mts +1 -0
- package/api/layout/expand/expand.mjs +1 -0
- package/api/layout/grammar/grammar.d.mts +1 -0
- package/api/layout/grammar/grammar.mjs +1 -0
- package/api/layout/layoutCheck.doc.mjs +1 -1
- package/api/layout/layoutExpand.doc.mjs +1 -1
- package/api/layout/layoutGrammar.doc.mjs +1 -1
- package/api/search/search.d.mts +47 -3
- package/api/search/search.doc.mjs +1 -1
- package/api/search/search.domain-priority.test.mjs +261 -0
- package/api/search/search.mjs +247 -43
- package/api/search/search.test.mjs +5 -1
- package/api/search/search.type.d.mts +3 -3
- package/api/search/search.type.mjs +2 -2
- package/api/swizzle/_adapter.d.mts +10 -0
- package/api/swizzle/_adapter.mjs +23 -0
- package/api/swizzle/copy/copy.d.mts +5 -6
- package/api/swizzle/copy/copy.mjs +29 -10
- package/api/swizzle/list/list.mjs +2 -2
- package/api/swizzle/swizzle.doc.mjs +5 -2
- package/api/swizzle/swizzle.test.mjs +55 -5
- package/api/swizzle/swizzle.type.d.mts +8 -0
- package/api/swizzle/swizzle.type.mjs +2 -0
- package/api/template/copy/copy.mjs +14 -1
- package/api/template/show/show.mjs +2 -0
- package/api/template/skeleton/skeleton.mjs +2 -1
- package/api/template/template.d.mts +1 -1
- package/api/template/template.doc.mjs +1 -1
- package/api/template/template.mjs +1 -0
- package/api/template/template.type.d.mts +15 -0
- package/api/template/template.type.mjs +6 -0
- package/api/theme/_adapter.d.mts +106 -6
- package/api/theme/_adapter.mjs +687 -18
- package/api/theme/add/add.binary.test.mjs +76 -3
- package/api/theme/add/add.d.mts +5 -9
- package/api/theme/add/add.mjs +87 -64
- package/api/theme/add/add.rollback.test.mjs +9 -9
- package/api/theme/add/add.staging.test.mjs +9 -9
- package/api/theme/add/add.test.mjs +461 -55
- package/api/theme/add/add.types.test.mjs +151 -0
- package/api/theme/build/build.d.mts +96 -2
- package/api/theme/build/build.family.test.mjs +13 -4
- package/api/theme/build/build.mjs +286 -118
- package/api/theme/build/build.test.mjs +30 -0
- package/api/theme/build/font-warning.d.mts +11 -0
- package/api/theme/build/font-warning.mjs +28 -3
- package/api/theme/eject/eject.binary.test.mjs +90 -0
- package/api/theme/eject/eject.d.mts +17 -0
- package/api/theme/eject/eject.mjs +65 -0
- package/api/theme/eject/eject.rollback.test.mjs +158 -0
- package/api/theme/eject/eject.staging.test.mjs +83 -0
- package/api/theme/eject/eject.test.mjs +160 -0
- package/api/theme/integration-themes.test.mjs +30 -6
- package/api/theme/list/list.d.mts +10 -0
- package/api/theme/list/list.mjs +75 -7
- package/api/theme/list/list.test.mjs +155 -4
- package/api/theme/remove/remove.d.mts +12 -0
- package/api/theme/remove/remove.mjs +15 -0
- package/api/theme/remove/remove.test.mjs +94 -0
- package/api/theme/template/template.mjs +3 -4
- package/api/theme/theme.d.mts +5 -2
- package/api/theme/theme.mjs +13 -8
- package/api/theme/theme.type.d.mts +106 -2
- package/api/theme/theme.type.mjs +54 -5
- package/api/theme/themeAdd.doc.d.mts +1 -3
- package/api/theme/themeAdd.doc.mjs +35 -22
- package/api/theme/themeBuild.doc.mjs +1 -1
- package/api/theme/themeEject.doc.d.mts +8 -0
- package/api/theme/themeEject.doc.mjs +89 -0
- package/api/theme/themeListAvailable.doc.mjs +4 -4
- package/api/theme/themeListCopySources.doc.d.mts +8 -0
- package/api/theme/themeListCopySources.doc.mjs +60 -0
- package/api/theme/themeRemove.doc.d.mts +6 -0
- package/api/theme/themeRemove.doc.mjs +50 -0
- package/api/theme/themeTemplate.doc.mjs +4 -3
- package/api/theme/themeUse.doc.d.mts +6 -0
- package/api/theme/themeUse.doc.mjs +47 -0
- package/api/theme/use/use.d.mts +12 -0
- package/api/theme/use/use.mjs +15 -0
- package/api/theme/use/use.test.mjs +98 -0
- package/api/upgrade/_adapter.d.mts +1 -0
- package/api/upgrade/_adapter.mjs +3 -0
- package/api/upgrade/list/list.mjs +9 -3
- package/api/upgrade/upgrade.type.d.mts +4 -0
- package/api/upgrade/upgrade.type.mjs +1 -0
- package/assets/codemods/__tests__/registry.test.mjs +1 -0
- package/assets/codemods/integration-discovery.mjs +1 -1
- package/assets/codemods/integration-discovery.test.mjs +64 -0
- package/assets/codemods/registry.mjs +1 -0
- package/assets/codemods/transforms/v0.6.7/__tests__/migrate-copied-themes-to-descriptors.test.mjs +129 -0
- package/assets/codemods/transforms/v0.6.7/index.mjs +23 -0
- package/assets/codemods/transforms/v0.6.7/migrate-copied-themes-to-descriptors.mjs +54 -0
- package/assets/docs/author-a-theme.doc.mjs +166 -0
- package/assets/docs/getting-started.doc.mjs +61 -17
- package/assets/docs/principles.doc.dense.mjs +4 -4
- package/assets/docs/principles.doc.mjs +6 -6
- package/assets/docs/principles.doc.zh.mjs +4 -4
- package/assets/docs/styling-overview.doc.mjs +211 -0
- package/assets/docs/theme.doc.dense.mjs +11 -197
- package/assets/docs/theme.doc.mjs +16 -764
- package/assets/docs/theme.doc.zh.mjs +31 -12
- package/assets/docs/tree/add-a-theme.doc.mjs +2 -2
- package/assets/docs/tree/checks.doc.mjs +6 -5
- package/assets/docs/tree/component-migration.doc.mjs +107 -0
- package/assets/docs/tree/css-and-stylex.doc.mjs +150 -0
- package/assets/docs/tree/define-the-theme.doc.mjs +1 -1
- package/assets/docs/tree/document-the-theme.doc.mjs +4 -4
- package/assets/docs/tree/font-setup.doc.mjs +122 -0
- package/assets/docs/tree/fonts-and-assets.doc.mjs +25 -20
- package/assets/docs/tree/headers-and-footers.doc.mjs +67 -0
- package/assets/docs/tree/i18n-library-integration.doc.mjs +167 -0
- package/assets/docs/tree/i18n-quick-start.doc.mjs +101 -0
- package/assets/docs/{internationalization.doc.mjs → tree/i18n-rtl-and-testing.doc.mjs} +17 -223
- package/assets/docs/tree/internationalization.doc.mjs +29 -0
- package/assets/docs/tree/layout-spacing.doc.mjs +168 -0
- package/assets/docs/tree/layout.doc.mjs +55 -0
- package/assets/docs/{migration.doc.mjs → tree/migration-setup.doc.mjs} +24 -129
- package/assets/docs/tree/migration-verification.doc.mjs +67 -0
- package/assets/docs/tree/migration.doc.mjs +28 -0
- package/assets/docs/tree/non-css-processing.doc.mjs +112 -0
- package/assets/docs/tree/other-libraries.doc.mjs +218 -0
- package/assets/docs/tree/replace-a-core-component.doc.mjs +21 -4
- package/assets/docs/tree/replace-a-core-template.doc.mjs +1 -1
- package/assets/docs/tree/responsive.doc.mjs +98 -0
- package/assets/docs/tree/scaffold.doc.mjs +140 -0
- package/assets/docs/tree/side-panels.doc.mjs +81 -0
- package/assets/docs/tree/structure.doc.mjs +140 -0
- package/assets/docs/tree/styling-advanced.doc.mjs +159 -0
- package/assets/docs/tree/styling-basics.doc.mjs +181 -0
- package/assets/docs/tree/styling-libraries.doc.mjs +30 -0
- package/assets/docs/tree/styling.doc.mjs +29 -0
- package/assets/docs/tree/tailwind.doc.mjs +65 -0
- package/assets/docs/tree/template-doc-overview.doc.mjs +1 -1
- package/assets/docs/tree/themes.doc.mjs +2 -2
- package/assets/docs/tree/tokens-and-setup.doc.mjs +128 -0
- package/assets/docs/tree/tokens-border.doc.mjs +46 -0
- package/assets/docs/tree/tokens-color.doc.dense.mjs +10 -0
- package/assets/docs/tree/tokens-color.doc.mjs +438 -0
- package/assets/docs/tree/tokens-color.doc.zh.mjs +10 -0
- package/assets/docs/tree/tokens-data.doc.mjs +323 -0
- package/assets/docs/tree/tokens-duration.doc.mjs +78 -0
- package/assets/docs/tree/tokens-ease.doc.mjs +46 -0
- package/assets/docs/tree/tokens-focus.doc.mjs +57 -0
- package/assets/docs/tree/tokens-font-weight.doc.mjs +58 -0
- package/assets/docs/tree/tokens-radius.doc.dense.mjs +10 -0
- package/assets/docs/tree/tokens-radius.doc.mjs +70 -0
- package/assets/docs/tree/tokens-radius.doc.zh.mjs +10 -0
- package/assets/docs/tree/tokens-shadow.doc.dense.mjs +10 -0
- package/assets/docs/tree/tokens-shadow.doc.mjs +74 -0
- package/assets/docs/tree/tokens-shadow.doc.zh.mjs +10 -0
- package/assets/docs/tree/tokens-size.doc.dense.mjs +10 -0
- package/assets/docs/tree/tokens-size.doc.mjs +54 -0
- package/assets/docs/tree/tokens-size.doc.zh.mjs +10 -0
- package/assets/docs/tree/tokens-spacing.doc.dense.mjs +10 -0
- package/assets/docs/tree/tokens-spacing.doc.mjs +102 -0
- package/assets/docs/tree/tokens-spacing.doc.zh.mjs +10 -0
- package/assets/docs/tree/tokens-syntax.doc.mjs +98 -0
- package/assets/docs/tree/tokens-text-size.doc.mjs +90 -0
- package/assets/docs/tree/tokens-type-scale.doc.mjs +210 -0
- package/assets/docs/tree/tokens-typography.doc.mjs +54 -0
- package/assets/docs/tree/tokens-usage.doc.dense.mjs +10 -0
- package/assets/docs/tree/tokens-usage.doc.mjs +36 -0
- package/assets/docs/tree/tokens-usage.doc.zh.mjs +10 -0
- package/assets/docs/tree/tokens.doc.mjs +28 -0
- package/assets/docs/tree/troubleshooting.doc.mjs +7 -3
- package/assets/docs/tree/type-scale.doc.mjs +147 -0
- package/assets/docs/tree/typography-best-practices.doc.mjs +55 -0
- package/assets/docs/tree/typography.doc.mjs +29 -0
- package/assets/docs/tree/use-a-theme-in-an-app.doc.mjs +22 -5
- package/assets/docs/tree/versioning.doc.mjs +6 -3
- package/assets/docs/use-a-theme.doc.mjs +212 -0
- package/assets/templates/pages/incident-console/page.tsx +1 -1
- package/assets/templates/pages/table-collapsible/page.tsx +1474 -0
- package/assets/templates/pages/table-collapsible/template.doc.mjs +12 -0
- package/assets/templates/pages/table-comparison/page.tsx +1449 -0
- package/assets/templates/pages/table-comparison/template.doc.mjs +12 -0
- package/assets/theme.template.ts +28 -11
- package/authoring/doctypes/command/command.doc.mjs +5 -0
- package/authoring/doctypes/command/type.ts +2 -0
- package/authoring/doctypes/component/component.doc.mjs +1 -1
- package/authoring/doctypes/component/type.ts +8 -4
- package/authoring/doctypes/template/template.doc.mjs +2 -2
- package/authoring/doctypes/template/type.ts +5 -3
- package/authoring/integration/integration.doc.mjs +1 -1
- package/clients/cli/commands/blog.mjs +3 -3
- package/clients/cli/commands/build-theme.adaptations.test.mjs +1 -1
- package/clients/cli/commands/build-theme.ascii-output.test.mjs +11 -1
- package/clients/cli/commands/build-theme.batch-report.test.mjs +335 -0
- package/clients/cli/commands/build-theme.font-warning.test.mjs +36 -7
- package/clients/cli/commands/build-theme.import-path.test.mjs +3 -3
- package/clients/cli/commands/build-theme.mjs +338 -45
- package/clients/cli/commands/build-theme.watch.test.mjs +33 -0
- package/clients/cli/commands/build.mjs +8 -6
- package/clients/cli/commands/build.text-fields.test.mjs +1 -1
- package/clients/cli/commands/component/index.mjs +91 -12
- package/clients/cli/commands/component-replacement.text.test.mjs +316 -0
- package/clients/cli/commands/component.doc.mjs +9 -2
- package/clients/cli/commands/docs.doc.mjs +2 -1
- package/clients/cli/commands/docs.mjs +63 -23
- package/clients/cli/commands/docs.test.mjs +17 -15
- package/clients/cli/commands/doctor-integration-components.doc.mjs +15 -4
- package/clients/cli/commands/doctor.doc.mjs +1 -1
- package/clients/cli/commands/doctor.test.mjs +59 -52
- package/clients/cli/commands/gap-report.doc.mjs +2 -2
- package/clients/cli/commands/hook/index.mjs +7 -2
- package/clients/cli/commands/import-hint-correctness.test.mjs +28 -5
- package/clients/cli/commands/init.next-steps.test.mjs +18 -23
- package/clients/cli/commands/integration-real-world.test.mjs +61 -12
- package/clients/cli/commands/layout-check.doc.mjs +2 -0
- package/clients/cli/commands/layout-expand.doc.mjs +2 -0
- package/clients/cli/commands/layout-grammar.doc.mjs +2 -0
- package/clients/cli/commands/layout.deprecation-lifecycle.test.mjs +140 -0
- package/clients/cli/commands/layout.doc.mjs +2 -0
- package/clients/cli/commands/layout.mjs +40 -4
- package/clients/cli/commands/no-prompt-wording.test.mjs +4 -4
- package/clients/cli/commands/search.test.mjs +10 -4
- package/clients/cli/commands/swizzle.doc.mjs +12 -3
- package/clients/cli/commands/swizzle.mjs +2 -1
- package/clients/cli/commands/swizzle.routing.test.mjs +2 -1
- package/clients/cli/commands/template.mjs +56 -5
- package/clients/cli/commands/text-json-parity.test.mjs +40 -0
- package/clients/cli/commands/theme-add-lifecycle.test.mjs +135 -0
- package/clients/cli/commands/theme-add.doc.mjs +19 -19
- package/clients/cli/commands/theme-build.doc.mjs +3 -1
- package/clients/cli/commands/theme-eject.doc.mjs +47 -0
- package/clients/cli/commands/theme-list.behavior.test.mjs +5 -2
- package/clients/cli/commands/theme-list.doc.mjs +2 -2
- package/clients/cli/commands/theme-palette-generate.doc.mjs +1 -2
- package/clients/cli/commands/theme-remove.doc.mjs +22 -0
- package/clients/cli/commands/theme-template.doc.mjs +4 -3
- package/clients/cli/commands/theme-use.doc.mjs +22 -0
- package/clients/cli/commands/theme.doc.mjs +21 -16
- package/clients/cli/commands/upgrade.config-ordering.test.mjs +2 -1
- package/clients/cli/commands/upgrade.mjs +1 -1
- package/clients/cli/index.mjs +5 -2
- package/clients/cli/lib/component-format.mjs +29 -2
- package/clients/cli/lib/component-format.test.mjs +1 -1
- package/clients/cli/lib/define-command.mjs +4 -0
- package/clients/cli/lib/resolve-theme.mjs +80 -78
- package/clients/cli/lib/resolve-theme.test.mjs +523 -27
- package/foundation/agent-docs/agent-docs.mjs +48 -30
- package/foundation/agent-docs/agent-docs.test.mjs +47 -34
- package/foundation/agent-docs/app-theme-workflow.test.mjs +13 -0
- package/foundation/config/project.d.mts +20 -5
- package/foundation/config/project.mjs +43 -6
- package/foundation/config/project.test.mjs +1 -1
- package/foundation/config/theme-private-vars.d.mts +12 -0
- package/foundation/config/theme-private-vars.mjs +107 -0
- package/foundation/config/theme-private-vars.test.mjs +55 -0
- package/foundation/config/theme-state.d.mts +145 -0
- package/foundation/config/theme-state.mjs +417 -0
- package/foundation/config/theme-state.test.mjs +182 -0
- package/foundation/discovery/component-discovery.d.mts +5 -2
- package/foundation/discovery/component-discovery.mjs +12 -6
- package/foundation/discovery/component-replacement.d.mts +91 -0
- package/foundation/discovery/component-replacement.mjs +417 -0
- package/foundation/discovery/component-replacement.test.mjs +480 -0
- package/foundation/discovery/docs-discovery.test.mjs +1 -1
- package/foundation/discovery/docs-output-budget.d.mts +6 -2
- package/foundation/discovery/docs-output-budget.mjs +2 -1
- package/foundation/discovery/docs-section-key.d.mts +4 -2
- package/foundation/discovery/docs-section-key.mjs +1 -1
- package/foundation/discovery/module-exports.d.mts +10 -0
- package/foundation/discovery/module-exports.mjs +146 -0
- package/foundation/discovery/package-exports.d.mts +29 -0
- package/foundation/discovery/package-exports.mjs +200 -0
- package/foundation/discovery/template-needs.d.mts +31 -0
- package/foundation/discovery/template-needs.mjs +156 -0
- package/foundation/discovery/template-needs.test.mjs +203 -0
- package/foundation/discovery/theme-discovery.d.mts +72 -5
- package/foundation/discovery/theme-discovery.mjs +134 -18
- package/foundation/discovery/theme-discovery.test.mjs +9 -3
- package/foundation/discovery/theme-imports.d.mts +15 -0
- package/foundation/discovery/theme-imports.mjs +217 -0
- package/foundation/discovery/theme-imports.test.mjs +173 -0
- package/foundation/doc-compiler/bundle.mjs +52 -1
- package/foundation/doc-compiler/doc-loads.test.mjs +15 -5
- package/foundation/doc-compiler/inputs.mjs +2 -1
- package/foundation/doc-compiler/lenses.d.mts +4 -2
- package/foundation/doc-compiler/lenses.mjs +1 -1
- package/foundation/doc-compiler/split-topic-keywords.test.mjs +73 -0
- package/foundation/doc-compiler/tree.d.mts +10 -0
- package/foundation/doc-compiler/tree.mjs +22 -0
- package/foundation/doc-compiler/tree.test.mjs +3 -2
- package/foundation/env/package-manager.d.mts +31 -8
- package/foundation/env/package-manager.mjs +120 -13
- package/foundation/env/package-manager.test.mjs +174 -1
- package/foundation/fs/module-loader.d.mts +9 -0
- package/foundation/fs/module-loader.mjs +71 -2
- package/foundation/integrations/cli-requirement.d.mts +43 -10
- package/foundation/integrations/cli-requirement.mjs +56 -13
- package/foundation/integrations/cli-requirement.test.mjs +160 -23
- package/foundation/integrations/contribution-inventory.mjs +3 -3
- package/foundation/integrations/validate-contributions.d.mts +16 -0
- package/foundation/integrations/validate-contributions.mjs +56 -8
- package/foundation/response/base.d.ts +9 -3
- package/foundation/response/json.d.mts +7 -4
- package/foundation/response/json.mjs +10 -6
- package/foundation/response/response-types.doc.mjs +41 -26
- package/foundation/response/response.doc.mjs +18 -4
- package/foundation/text/copyright-header.mjs +1 -1
- package/foundation/text/copyright-header.test.mjs +1 -1
- package/package.json +9 -9
- package/assets/docs/layout.doc.dense.mjs +0 -388
- package/assets/docs/layout.doc.mjs +0 -550
- package/assets/docs/styling-libraries.doc.mjs +0 -469
- package/assets/docs/styling.doc.mjs +0 -412
- package/assets/docs/tokens.doc.dense.mjs +0 -15
- package/assets/docs/tokens.doc.mjs +0 -1491
- package/assets/docs/tokens.doc.zh.mjs +0 -15
- package/assets/docs/typography.doc.mjs +0 -286
|
@@ -157,6 +157,39 @@ describe('theme build --watch', () => {
|
|
|
157
157
|
expect(stdout).toMatch(/Stopped watching/);
|
|
158
158
|
}, 30_000);
|
|
159
159
|
|
|
160
|
+
it.each([
|
|
161
|
+
[[], false],
|
|
162
|
+
[['--detail', 'full'], true],
|
|
163
|
+
])(
|
|
164
|
+
'keeps the detail level for each build (%j)',
|
|
165
|
+
async (detail, full) => {
|
|
166
|
+
fs.writeFileSync(
|
|
167
|
+
path.join(tmpDir, 'wd.mjs'),
|
|
168
|
+
`export default { name: 'wd', tokens: { '--color-bg': '#ffffff' } };\n`,
|
|
169
|
+
);
|
|
170
|
+
const child = spawn(
|
|
171
|
+
process.execPath,
|
|
172
|
+
[CLI_BIN, ...detail, 'theme', 'build', 'wd.mjs', '--watch'],
|
|
173
|
+
{cwd: tmpDir, env: {...process.env, FORCE_COLOR: '0'}},
|
|
174
|
+
);
|
|
175
|
+
let stdout = '';
|
|
176
|
+
child.stdout.on('data', d => (stdout += d.toString()));
|
|
177
|
+
child.stderr.on('data', d => (stdout += d.toString()));
|
|
178
|
+
try {
|
|
179
|
+
expect(await waitFor(() => /Watching/i.test(stdout))).toBe(true);
|
|
180
|
+
} finally {
|
|
181
|
+
child.kill('SIGINT');
|
|
182
|
+
}
|
|
183
|
+
await new Promise(resolve => {
|
|
184
|
+
child.on('exit', resolve);
|
|
185
|
+
setTimeout(resolve, 4000);
|
|
186
|
+
});
|
|
187
|
+
expect(stdout.includes('Install in your app')).toBe(full);
|
|
188
|
+
expect(/\[ok\] wd\.css \(/.test(stdout)).toBe(!full);
|
|
189
|
+
},
|
|
190
|
+
30_000,
|
|
191
|
+
);
|
|
192
|
+
|
|
160
193
|
it('watches every file it was given and rebuilds only the one that changed', async () => {
|
|
161
194
|
const first = path.join(tmpDir, 'w1.mjs');
|
|
162
195
|
const second = path.join(tmpDir, 'w2.mjs');
|
|
@@ -169,6 +169,7 @@ export function registerBuild(program) {
|
|
|
169
169
|
const full = {
|
|
170
170
|
fields: [
|
|
171
171
|
'name',
|
|
172
|
+
'package',
|
|
172
173
|
'domain',
|
|
173
174
|
'displayName',
|
|
174
175
|
'score',
|
|
@@ -220,11 +221,12 @@ export function registerBuild(program) {
|
|
|
220
221
|
start,
|
|
221
222
|
verbose
|
|
222
223
|
? {
|
|
223
|
-
fields: ['name', 'displayName', 'description', 'command'],
|
|
224
|
+
fields: ['name', 'package', 'displayName', 'description', 'command'],
|
|
224
225
|
format: {command: formatCliCommand},
|
|
225
226
|
}
|
|
226
|
-
: brief(['name', 'description', 'command']),
|
|
227
|
+
: brief(['name', 'package', 'description', 'command']),
|
|
227
228
|
),
|
|
229
|
+
...(start.notes ?? []).map(note => text(note)),
|
|
228
230
|
);
|
|
229
231
|
if (start.alternatives.length) {
|
|
230
232
|
out.push(
|
|
@@ -234,7 +236,7 @@ export function registerBuild(program) {
|
|
|
234
236
|
),
|
|
235
237
|
records(
|
|
236
238
|
start.alternatives,
|
|
237
|
-
verbose ? full : brief(['name', 'description', 'command']),
|
|
239
|
+
verbose ? full : brief(['name', 'package', 'description', 'command']),
|
|
238
240
|
),
|
|
239
241
|
);
|
|
240
242
|
}
|
|
@@ -249,7 +251,7 @@ export function registerBuild(program) {
|
|
|
249
251
|
'Page templates keyword search matched, best first.',
|
|
250
252
|
)
|
|
251
253
|
: text(
|
|
252
|
-
`Keyword search matched these page templates: ${pages.map(p => p.name).join(', ')}.`,
|
|
254
|
+
`Keyword search matched these page templates: ${pages.map(p => `${p.name} (${p.package})`).join(', ')}.`,
|
|
253
255
|
),
|
|
254
256
|
);
|
|
255
257
|
if (verbose) out.push(records(pages, full));
|
|
@@ -262,7 +264,7 @@ export function registerBuild(program) {
|
|
|
262
264
|
),
|
|
263
265
|
records(
|
|
264
266
|
shown(blocks),
|
|
265
|
-
verbose ? full : brief(['name', 'description']),
|
|
267
|
+
verbose ? full : brief(['name', 'package', 'description']),
|
|
266
268
|
),
|
|
267
269
|
);
|
|
268
270
|
}
|
|
@@ -275,7 +277,7 @@ export function registerBuild(program) {
|
|
|
275
277
|
? [
|
|
276
278
|
records(
|
|
277
279
|
shown(domain),
|
|
278
|
-
verbose ? full : brief(['name', 'description']),
|
|
280
|
+
verbose ? full : brief(['name', 'package', 'description']),
|
|
279
281
|
),
|
|
280
282
|
]
|
|
281
283
|
: []),
|
|
@@ -75,7 +75,7 @@ describe('build kit text fields mirror the JSON keys', () => {
|
|
|
75
75
|
expect(data.pages.length).toBeGreaterThan(0);
|
|
76
76
|
const human = await runCli(['build', 'contact form'], REPO);
|
|
77
77
|
expect(human.stdout).toContain(
|
|
78
|
-
`Keyword search matched these page templates: ${data.pages.map(p => p.name).join(', ')}.`,
|
|
78
|
+
`Keyword search matched these page templates: ${data.pages.map(p => `${p.name} (${p.package})`).join(', ')}.`,
|
|
79
79
|
);
|
|
80
80
|
}, SLOW);
|
|
81
81
|
});
|
|
@@ -93,18 +93,26 @@ function summarize(result) {
|
|
|
93
93
|
* @param {import('../../../../api/component/component.type.mjs').ComponentSingleResponse} result
|
|
94
94
|
* @param {string} requestedName
|
|
95
95
|
* @param {'full'|'compact'|'brief'} detail
|
|
96
|
-
* @param {ReturnType<typeof resolveTheme
|
|
96
|
+
* @param {Awaited<ReturnType<typeof resolveTheme>>} themeData
|
|
97
97
|
* @returns {import('../../formatters/index.mjs').Block[]}
|
|
98
98
|
*/
|
|
99
99
|
function componentDetailBlocks(result, requestedName, detail, themeData) {
|
|
100
|
-
const
|
|
100
|
+
const requested = (requestedName.split('/').pop() ?? requestedName).replace(
|
|
101
101
|
/^XDS/,
|
|
102
102
|
'',
|
|
103
103
|
);
|
|
104
|
+
// A replacement answers to the Core name it replaces (spec:AST-035 FR11),
|
|
105
|
+
// but its package exports it under its own name: print that one.
|
|
106
|
+
const resolvedName =
|
|
107
|
+
result.type === 'component.detail' &&
|
|
108
|
+
typeof result.data.name === 'string' &&
|
|
109
|
+
result.data.replaces === requested
|
|
110
|
+
? result.data.name
|
|
111
|
+
: requested;
|
|
104
112
|
switch (result.type) {
|
|
105
113
|
case 'component.detail': {
|
|
106
114
|
/** @type {import('../../formatters/index.mjs').Block[]} */
|
|
107
|
-
const out = [];
|
|
115
|
+
const out = [record({package: result.package})];
|
|
108
116
|
if (result.data.parentDoc) {
|
|
109
117
|
out.push(record(result.data, {fields: ['parentDoc']}));
|
|
110
118
|
}
|
|
@@ -129,24 +137,37 @@ function componentDetailBlocks(result, requestedName, detail, themeData) {
|
|
|
129
137
|
return out;
|
|
130
138
|
}
|
|
131
139
|
case 'component.detail.props':
|
|
132
|
-
return [
|
|
140
|
+
return [
|
|
141
|
+
record({package: result.package}),
|
|
142
|
+
code(formatProps({props: result.data}, resolvedName)),
|
|
143
|
+
];
|
|
133
144
|
case 'component.detail.source':
|
|
134
145
|
case 'component.detail.showcase':
|
|
135
146
|
return [code(result.data.source)];
|
|
136
147
|
case 'component.detail.blocks': {
|
|
137
148
|
const {showcase, examples, related} = result.data;
|
|
149
|
+
// A block another package owns says which one.
|
|
150
|
+
/** @param {{package: string}} block @param {string} label */
|
|
151
|
+
const owned = (block, label) =>
|
|
152
|
+
block.package === result.package ? label : `${label} (${block.package})`;
|
|
138
153
|
/** @type {import('../../formatters/index.mjs').Block[]} */
|
|
139
|
-
const out = [];
|
|
154
|
+
const out = [record({package: result.package})];
|
|
140
155
|
if (showcase) {
|
|
141
156
|
out.push(
|
|
142
157
|
section('Showcase'),
|
|
143
|
-
record(
|
|
158
|
+
record(
|
|
159
|
+
{...showcase, displayName: owned(showcase, showcase.displayName)},
|
|
160
|
+
{fields: ['displayName', 'description']},
|
|
161
|
+
),
|
|
144
162
|
);
|
|
145
163
|
}
|
|
146
164
|
if (examples.length > 0) {
|
|
147
165
|
out.push(
|
|
148
166
|
section('Examples'),
|
|
149
|
-
records(
|
|
167
|
+
records(
|
|
168
|
+
examples.map(block => ({...block, name: owned(block, block.name)})),
|
|
169
|
+
{fields: ['name', 'description']},
|
|
170
|
+
),
|
|
150
171
|
);
|
|
151
172
|
}
|
|
152
173
|
if (related.length > 0) {
|
|
@@ -154,7 +175,7 @@ function componentDetailBlocks(result, requestedName, detail, themeData) {
|
|
|
154
175
|
section(
|
|
155
176
|
`Related: ${related.length} blocks that use ${result.data.component}`,
|
|
156
177
|
),
|
|
157
|
-
list(related.map(block => block.name)),
|
|
178
|
+
list(related.map(block => owned(block, block.name))),
|
|
158
179
|
);
|
|
159
180
|
}
|
|
160
181
|
if (!showcase && examples.length === 0 && related.length === 0) {
|
|
@@ -242,7 +263,18 @@ export function registerComponent(program) {
|
|
|
242
263
|
// The api layer already resolved against core (result exists), so core is
|
|
243
264
|
// present on this path; narrow away the null branch findCoreDir allows.
|
|
244
265
|
const coreDir = /** @type {string} */ (findCoreDir(process.cwd()));
|
|
245
|
-
|
|
266
|
+
let themeData;
|
|
267
|
+
try {
|
|
268
|
+
themeData = await resolveTheme(process.cwd());
|
|
269
|
+
} catch (error) {
|
|
270
|
+
const message =
|
|
271
|
+
error instanceof Error
|
|
272
|
+
? error.message.split('\n', 1)[0]?.trim() || error.name
|
|
273
|
+
: String(error);
|
|
274
|
+
return cliError(`Could not load the recorded theme: ${message}`, {
|
|
275
|
+
code: ERROR_CODES.ERR_THEME_LOAD,
|
|
276
|
+
});
|
|
277
|
+
}
|
|
246
278
|
|
|
247
279
|
// Footer shared by the compact + names list views (prose → text()).
|
|
248
280
|
const listFooter = text(
|
|
@@ -258,8 +290,34 @@ export function registerComponent(program) {
|
|
|
258
290
|
// in result.data.detail and the grouped map in result.data.components.
|
|
259
291
|
if (result.data.detail === 'full') {
|
|
260
292
|
// --detail full — dense per-component docs (signature, props, theming,
|
|
261
|
-
// examples). Verbatim doc block from the shared formatter.
|
|
262
|
-
|
|
293
|
+
// examples). Verbatim doc block from the shared formatter. A Core slot
|
|
294
|
+
// an integration component replaces prints that component, from the
|
|
295
|
+
// list result (spec:AST-035 FR11). Only the result's groups print, so
|
|
296
|
+
// `--category` text shows what its JSON shows and every printed slot
|
|
297
|
+
// is covered by the replacement map built from that result.
|
|
298
|
+
/** @type {Map<string, any>} */
|
|
299
|
+
const replacements = new Map();
|
|
300
|
+
for (const items of Object.values(result.data.components)) {
|
|
301
|
+
for (const item of /** @type {any[]} */ (items)) {
|
|
302
|
+
if (
|
|
303
|
+
item.package !== '@astryxdesign/core' &&
|
|
304
|
+
typeof item.replaces === 'string'
|
|
305
|
+
) {
|
|
306
|
+
replacements.set(item.replaces, item);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
emit(
|
|
311
|
+
code(
|
|
312
|
+
await formatBriefAll(coreDir, {
|
|
313
|
+
zh,
|
|
314
|
+
lang,
|
|
315
|
+
themeData,
|
|
316
|
+
replacements,
|
|
317
|
+
categories: Object.keys(result.data.components),
|
|
318
|
+
}),
|
|
319
|
+
),
|
|
320
|
+
);
|
|
263
321
|
break;
|
|
264
322
|
}
|
|
265
323
|
|
|
@@ -275,7 +333,13 @@ export function registerComponent(program) {
|
|
|
275
333
|
const isUngrouped =
|
|
276
334
|
entries.length === 1 && items.length === 1 && items[0]?.name === cat;
|
|
277
335
|
if (!isUngrouped) out.push(section(cat));
|
|
278
|
-
|
|
336
|
+
// An entry from another package says which one (cli-surface INV28).
|
|
337
|
+
const named = items.map(item =>
|
|
338
|
+
item.package === '@astryxdesign/core'
|
|
339
|
+
? item
|
|
340
|
+
: {...item, import: `${item.import} [${item.package}]`},
|
|
341
|
+
);
|
|
342
|
+
out.push(records(named, {fields: ['name', 'import', 'description']}));
|
|
279
343
|
}
|
|
280
344
|
out.push(listFooter);
|
|
281
345
|
emit(...out);
|
|
@@ -340,6 +404,12 @@ export function registerComponent(program) {
|
|
|
340
404
|
out.push(
|
|
341
405
|
record(row, {fields: ['selector', 'status']}),
|
|
342
406
|
section('Result'),
|
|
407
|
+
// A batch is not piped as one file, so a source row names its
|
|
408
|
+
// package here; the other rows name it themselves.
|
|
409
|
+
...(row.result.type === 'component.detail.source' ||
|
|
410
|
+
row.result.type === 'component.detail.showcase'
|
|
411
|
+
? [record({package: row.result.package})]
|
|
412
|
+
: []),
|
|
343
413
|
...componentDetailBlocks(
|
|
344
414
|
row.result,
|
|
345
415
|
row.selector,
|
|
@@ -377,6 +447,15 @@ export function registerComponent(program) {
|
|
|
377
447
|
case 'component.detail.source':
|
|
378
448
|
case 'component.detail.showcase':
|
|
379
449
|
case 'component.detail.blocks':
|
|
450
|
+
// Source and showcase print the file alone so it pipes byte for
|
|
451
|
+
// byte; the package they come from goes to stderr (cli-surface
|
|
452
|
+
// INV28).
|
|
453
|
+
if (
|
|
454
|
+
result.type === 'component.detail.source' ||
|
|
455
|
+
result.type === 'component.detail.showcase'
|
|
456
|
+
) {
|
|
457
|
+
console.error(`package: ${result.package}`);
|
|
458
|
+
}
|
|
380
459
|
emit(
|
|
381
460
|
...componentDetailBlocks(
|
|
382
461
|
result,
|
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Component replacement in text mode (spec:AST-035 FR11, FR13, FR15;
|
|
5
|
+
* architecture:cli-surface INV28): what a person sees from the real CLI for a
|
|
6
|
+
* replaced Core component, at every detail level, single, batch, and list,
|
|
7
|
+
* plus the help that documents it.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import {afterAll, beforeAll, describe, expect, it, vi} from 'vitest';
|
|
11
|
+
import * as fs from 'node:fs';
|
|
12
|
+
import * as path from 'node:path';
|
|
13
|
+
import {runCli} from '../../../test-utils/run-cli.mjs';
|
|
14
|
+
import {COMPONENT_REPLACES_CLI} from '../../../foundation/integrations/cli-requirement.mjs';
|
|
15
|
+
|
|
16
|
+
vi.setConfig({testTimeout: 60_000, hookTimeout: 60_000});
|
|
17
|
+
|
|
18
|
+
const FLOOR = {'@astryxdesign/cli': `>=${COMPONENT_REPLACES_CLI}`};
|
|
19
|
+
|
|
20
|
+
let tmpDir;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @param {string} name
|
|
24
|
+
* @param {Array<{name: string, replaces?: string}>} components
|
|
25
|
+
* @param {Record<string, string>} [peers]
|
|
26
|
+
*/
|
|
27
|
+
function writeIntegration(name, components, peers) {
|
|
28
|
+
const pkgDir = path.join(tmpDir, 'node_modules', ...name.split('/'));
|
|
29
|
+
const componentsDir = path.join(pkgDir, 'components');
|
|
30
|
+
fs.mkdirSync(componentsDir, {recursive: true});
|
|
31
|
+
fs.writeFileSync(
|
|
32
|
+
path.join(pkgDir, 'package.json'),
|
|
33
|
+
JSON.stringify({
|
|
34
|
+
name,
|
|
35
|
+
version: '1.0.0',
|
|
36
|
+
...(peers ? {peerDependencies: peers} : {}),
|
|
37
|
+
}),
|
|
38
|
+
);
|
|
39
|
+
fs.writeFileSync(
|
|
40
|
+
path.join(pkgDir, 'astryx.integration.mjs'),
|
|
41
|
+
"export default {components: './components'};\n",
|
|
42
|
+
);
|
|
43
|
+
for (const component of components) {
|
|
44
|
+
fs.writeFileSync(
|
|
45
|
+
path.join(componentsDir, `${component.name}.doc.mjs`),
|
|
46
|
+
`export default ${JSON.stringify({
|
|
47
|
+
type: 'component',
|
|
48
|
+
name: component.name,
|
|
49
|
+
displayName: component.name,
|
|
50
|
+
...(component.replaces ? {replaces: component.replaces} : {}),
|
|
51
|
+
import: `${name}/components/${component.name}`,
|
|
52
|
+
usage: {description: `${component.name} for Acme apps.`},
|
|
53
|
+
props: [],
|
|
54
|
+
})};\n`,
|
|
55
|
+
);
|
|
56
|
+
fs.writeFileSync(
|
|
57
|
+
path.join(componentsDir, `${component.name}.tsx`),
|
|
58
|
+
`export function ${component.name}() { return null; }\n`,
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
beforeAll(() => {
|
|
64
|
+
// Under the repository so the project resolves the workspace's Core.
|
|
65
|
+
tmpDir = fs.mkdtempSync(
|
|
66
|
+
path.join(process.cwd(), '.astryx-component-replacement-text-'),
|
|
67
|
+
);
|
|
68
|
+
writeIntegration(
|
|
69
|
+
'@acme/nav',
|
|
70
|
+
[{name: 'AcmeSideNav', replaces: 'SideNav'}],
|
|
71
|
+
FLOOR,
|
|
72
|
+
);
|
|
73
|
+
writeIntegration('@acme/old', [{name: 'OldTopNav', replaces: 'TopNav'}]);
|
|
74
|
+
writeIntegration(
|
|
75
|
+
'@acme/bad',
|
|
76
|
+
[{name: 'BadThing', replaces: 'NoSuchComponent'}],
|
|
77
|
+
FLOOR,
|
|
78
|
+
);
|
|
79
|
+
fs.writeFileSync(
|
|
80
|
+
path.join(tmpDir, 'package.json'),
|
|
81
|
+
JSON.stringify({
|
|
82
|
+
name: 'consumer',
|
|
83
|
+
version: '1.0.0',
|
|
84
|
+
dependencies: {
|
|
85
|
+
'@acme/nav': '1.0.0',
|
|
86
|
+
'@acme/old': '1.0.0',
|
|
87
|
+
'@acme/bad': '1.0.0',
|
|
88
|
+
},
|
|
89
|
+
}),
|
|
90
|
+
);
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
afterAll(() => {
|
|
94
|
+
fs.rmSync(tmpDir, {recursive: true, force: true});
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
const IMPORT =
|
|
98
|
+
"import { AcmeSideNav } from '@acme/nav/components/AcmeSideNav';";
|
|
99
|
+
|
|
100
|
+
describe('component detail text', () => {
|
|
101
|
+
it('prints the replacement at full detail, naming its package', async () => {
|
|
102
|
+
const run = await runCli(['component', 'SideNav'], {cwd: tmpDir});
|
|
103
|
+
expect(run.status, run.stderr).toBe(0);
|
|
104
|
+
expect(run.stdout).toContain('package: @acme/nav');
|
|
105
|
+
expect(run.stdout).toContain('# AcmeSideNav');
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
it('imports the export the package has at compact detail', async () => {
|
|
109
|
+
const run = await runCli(['component', 'SideNav', '--detail', 'compact'], {
|
|
110
|
+
cwd: tmpDir,
|
|
111
|
+
});
|
|
112
|
+
expect(run.status, run.stderr).toBe(0);
|
|
113
|
+
expect(run.stdout).toContain(IMPORT);
|
|
114
|
+
expect(run.stdout).not.toContain('import { SideNav }');
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
it('names the export the package has at brief detail', async () => {
|
|
118
|
+
const run = await runCli(['component', 'SideNav', '--detail', 'brief'], {
|
|
119
|
+
cwd: tmpDir,
|
|
120
|
+
});
|
|
121
|
+
expect(run.status, run.stderr).toBe(0);
|
|
122
|
+
expect(run.stdout).toMatch(
|
|
123
|
+
/^AcmeSideNav {2}<- from '@acme\/nav\/components\/AcmeSideNav'/m,
|
|
124
|
+
);
|
|
125
|
+
expect(run.stdout).not.toMatch(/^SideNav {2}<- from '@acme/m);
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
it('answers to the Core name qualified by the replacing package', async () => {
|
|
129
|
+
const run = await runCli(
|
|
130
|
+
['component', '@acme/nav/SideNav', '--detail', 'compact'],
|
|
131
|
+
{
|
|
132
|
+
cwd: tmpDir,
|
|
133
|
+
},
|
|
134
|
+
);
|
|
135
|
+
expect(run.status, run.stderr).toBe(0);
|
|
136
|
+
expect(run.stdout).toContain(IMPORT);
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
it('keeps the Core original behind --package @astryxdesign/core', async () => {
|
|
140
|
+
const run = await runCli(
|
|
141
|
+
[
|
|
142
|
+
'component',
|
|
143
|
+
'SideNav',
|
|
144
|
+
'--package',
|
|
145
|
+
'@astryxdesign/core',
|
|
146
|
+
'--detail',
|
|
147
|
+
'compact',
|
|
148
|
+
],
|
|
149
|
+
{cwd: tmpDir},
|
|
150
|
+
);
|
|
151
|
+
expect(run.status, run.stderr).toBe(0);
|
|
152
|
+
expect(run.stdout).toContain('package: @astryxdesign/core');
|
|
153
|
+
expect(run.stdout).toContain("from '@astryxdesign/core/SideNav'");
|
|
154
|
+
});
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
describe('component batch text', () => {
|
|
158
|
+
it.each(['compact', 'brief'])(
|
|
159
|
+
'uses the replacement export at %s detail',
|
|
160
|
+
async detail => {
|
|
161
|
+
const run = await runCli(
|
|
162
|
+
['component', 'SideNav', 'Button', '--detail', detail],
|
|
163
|
+
{
|
|
164
|
+
cwd: tmpDir,
|
|
165
|
+
},
|
|
166
|
+
);
|
|
167
|
+
expect(run.status, run.stderr).toBe(0);
|
|
168
|
+
expect(run.stdout).toContain('AcmeSideNav');
|
|
169
|
+
expect(run.stdout).toContain("'@acme/nav/components/AcmeSideNav'");
|
|
170
|
+
expect(run.stdout).not.toContain('import { SideNav }');
|
|
171
|
+
expect(run.stdout).not.toMatch(/^SideNav {2}<- from '@acme/m);
|
|
172
|
+
},
|
|
173
|
+
);
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
describe('component list text', () => {
|
|
177
|
+
it('lists the replacement once, with its package, at brief detail', async () => {
|
|
178
|
+
const run = await runCli(['component', '--list'], {cwd: tmpDir});
|
|
179
|
+
expect(run.status, run.stderr).toBe(0);
|
|
180
|
+
expect(run.stdout).toContain('name: AcmeSideNav');
|
|
181
|
+
expect(run.stdout).toContain(
|
|
182
|
+
'@acme/nav/components/AcmeSideNav [@acme/nav]',
|
|
183
|
+
);
|
|
184
|
+
expect(run.stdout.match(/name: {3}AcmeSideNav\n/g)).toHaveLength(1);
|
|
185
|
+
expect(run.stdout).not.toMatch(/name: {3}SideNav\n/);
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
it('names the replacement package at compact detail', async () => {
|
|
189
|
+
const run = await runCli(['component', '--list', '--detail', 'compact'], {
|
|
190
|
+
cwd: tmpDir,
|
|
191
|
+
});
|
|
192
|
+
expect(run.status, run.stderr).toBe(0);
|
|
193
|
+
expect(run.stdout).toContain(
|
|
194
|
+
'@acme/nav/components/AcmeSideNav [@acme/nav]',
|
|
195
|
+
);
|
|
196
|
+
expect(run.stdout).not.toMatch(/name: +SideNav\n/);
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
it('prints the replacement in the Core slot at full detail', async () => {
|
|
200
|
+
const run = await runCli(['component', '--list', '--detail', 'full'], {
|
|
201
|
+
cwd: tmpDir,
|
|
202
|
+
});
|
|
203
|
+
expect(run.status, run.stderr).toBe(0);
|
|
204
|
+
expect(run.stdout).toMatch(
|
|
205
|
+
/^AcmeSideNav {2}<- from '@acme\/nav\/components\/AcmeSideNav' {2}\[@acme\/nav\]$/m,
|
|
206
|
+
);
|
|
207
|
+
expect(run.stdout).not.toMatch(/^SideNav[( ]/m);
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
it.each(['brief', 'compact', 'full'])(
|
|
211
|
+
'keeps the replacement in its category at %s detail',
|
|
212
|
+
async detail => {
|
|
213
|
+
const run = await runCli(
|
|
214
|
+
['component', '--category', 'Navigation', '--detail', detail],
|
|
215
|
+
{cwd: tmpDir},
|
|
216
|
+
);
|
|
217
|
+
expect(run.status, run.stderr).toBe(0);
|
|
218
|
+
expect(run.stdout).toContain('AcmeSideNav');
|
|
219
|
+
},
|
|
220
|
+
);
|
|
221
|
+
|
|
222
|
+
it('prints only the requested category at full detail', async () => {
|
|
223
|
+
const layout = await runCli(
|
|
224
|
+
['component', '--list', '--category', 'Layout', '--detail', 'full'],
|
|
225
|
+
{cwd: tmpDir},
|
|
226
|
+
);
|
|
227
|
+
expect(layout.status, layout.stderr).toBe(0);
|
|
228
|
+
expect(layout.stdout.match(/^## .+$/gm)).toEqual(['## Layout']);
|
|
229
|
+
expect(layout.stdout).not.toContain('@astryxdesign/core/SideNav');
|
|
230
|
+
expect(layout.stdout).not.toContain('AcmeSideNav');
|
|
231
|
+
|
|
232
|
+
const navigation = await runCli(
|
|
233
|
+
['component', '--list', '--category', 'Navigation', '--detail', 'full'],
|
|
234
|
+
{cwd: tmpDir},
|
|
235
|
+
);
|
|
236
|
+
expect(navigation.status, navigation.stderr).toBe(0);
|
|
237
|
+
expect(navigation.stdout.match(/^## .+$/gm)).toEqual(['## Navigation']);
|
|
238
|
+
expect(navigation.stdout).toMatch(
|
|
239
|
+
/^AcmeSideNav {2}<- from '@acme\/nav\/components\/AcmeSideNav' {2}\[@acme\/nav\]$/m,
|
|
240
|
+
);
|
|
241
|
+
expect(navigation.stdout).not.toMatch(/^SideNav[( ]/m);
|
|
242
|
+
});
|
|
243
|
+
|
|
244
|
+
it.each(['brief', 'compact'])(
|
|
245
|
+
'prints only the requested category at %s detail',
|
|
246
|
+
async detail => {
|
|
247
|
+
const layout = await runCli(
|
|
248
|
+
['component', '--category', 'Layout', '--detail', detail],
|
|
249
|
+
{cwd: tmpDir},
|
|
250
|
+
);
|
|
251
|
+
expect(layout.status, layout.stderr).toBe(0);
|
|
252
|
+
expect(layout.stdout).not.toContain('@astryxdesign/core/SideNav');
|
|
253
|
+
expect(layout.stdout).not.toContain('AcmeSideNav');
|
|
254
|
+
|
|
255
|
+
const navigation = await runCli(
|
|
256
|
+
['component', '--category', 'Navigation', '--detail', detail],
|
|
257
|
+
{cwd: tmpDir},
|
|
258
|
+
);
|
|
259
|
+
expect(navigation.status, navigation.stderr).toBe(0);
|
|
260
|
+
expect(navigation.stdout).toContain(
|
|
261
|
+
'@acme/nav/components/AcmeSideNav [@acme/nav]',
|
|
262
|
+
);
|
|
263
|
+
expect(navigation.stdout).not.toMatch(/^name: +SideNav$/m);
|
|
264
|
+
},
|
|
265
|
+
);
|
|
266
|
+
});
|
|
267
|
+
|
|
268
|
+
describe('help documents the replacement', () => {
|
|
269
|
+
it.each([
|
|
270
|
+
[
|
|
271
|
+
['component', '--help'],
|
|
272
|
+
['replaced by an integration component', '--package @astryxdesign/core'],
|
|
273
|
+
],
|
|
274
|
+
[
|
|
275
|
+
['swizzle', '--help'],
|
|
276
|
+
['replaces', '--package @astryxdesign/core', '--list'],
|
|
277
|
+
],
|
|
278
|
+
[
|
|
279
|
+
['gap-report', '--help'],
|
|
280
|
+
['the integration whose component replaces the named Core component'],
|
|
281
|
+
],
|
|
282
|
+
[
|
|
283
|
+
['doctor', 'integration', 'components', '--help'],
|
|
284
|
+
['replaces', 'an invalid replaces'],
|
|
285
|
+
],
|
|
286
|
+
])('%s', async (args, needles) => {
|
|
287
|
+
const run = await runCli(/** @type {string[]} */ (args), {cwd: tmpDir});
|
|
288
|
+
const help = run.stdout + run.stderr;
|
|
289
|
+
for (const needle of needles) expect(help).toContain(needle);
|
|
290
|
+
});
|
|
291
|
+
});
|
|
292
|
+
|
|
293
|
+
describe('doctor integration components text and exit codes', () => {
|
|
294
|
+
it('exits 1 for an invalid replaces in a package with the floor', async () => {
|
|
295
|
+
const run = await runCli(
|
|
296
|
+
['doctor', 'integration', 'components', '@acme/bad'],
|
|
297
|
+
{
|
|
298
|
+
cwd: tmpDir,
|
|
299
|
+
},
|
|
300
|
+
);
|
|
301
|
+
expect(run.status).toBe(1);
|
|
302
|
+
expect(run.stdout).toContain('missing_component_replacement_target');
|
|
303
|
+
});
|
|
304
|
+
|
|
305
|
+
it('warns and exits 0 for a package without the floor', async () => {
|
|
306
|
+
const run = await runCli(
|
|
307
|
+
['doctor', 'integration', 'components', '@acme/old'],
|
|
308
|
+
{
|
|
309
|
+
cwd: tmpDir,
|
|
310
|
+
},
|
|
311
|
+
);
|
|
312
|
+
expect(run.status, run.stdout).toBe(0);
|
|
313
|
+
expect(run.stdout).toContain('inactive_component_replacement');
|
|
314
|
+
expect(run.stdout).toContain(`">=${COMPONENT_REPLACES_CLI}"`);
|
|
315
|
+
});
|
|
316
|
+
});
|
|
@@ -21,7 +21,10 @@ export const doc = {
|
|
|
21
21
|
"Use 'Button', 'widgets/Button', '@acme/widgets/Button', or " +
|
|
22
22
|
"'@acme/widgets@1.2.3/Button'. A version applies to the package and must match the " +
|
|
23
23
|
'installed version. Boolean flags narrow every resolved component to just its props, ' +
|
|
24
|
-
'source, showcase, or example blocks.'
|
|
24
|
+
'source, showcase, or example blocks. An integration component that replaces a Core ' +
|
|
25
|
+
'component (its doc sets replaces, and its package declares the CLI range that turns ' +
|
|
26
|
+
'replacement on) answers to the Core name in detail, batch, and list views; use ' +
|
|
27
|
+
'--package @astryxdesign/core for the original.',
|
|
25
28
|
fn: 'component',
|
|
26
29
|
args: [
|
|
27
30
|
{
|
|
@@ -69,7 +72,7 @@ export const doc = {
|
|
|
69
72
|
flag: '--package <name>',
|
|
70
73
|
param: 'options.package',
|
|
71
74
|
description:
|
|
72
|
-
'Scope lookup to an external package (e.g. @acme/xds-widgets)',
|
|
75
|
+
'Scope lookup to an external package (e.g. @acme/xds-widgets). Use @astryxdesign/core to select an original replaced by an integration component.',
|
|
73
76
|
},
|
|
74
77
|
],
|
|
75
78
|
examples: [
|
|
@@ -82,6 +85,10 @@ export const doc = {
|
|
|
82
85
|
label: 'Props table as JSON',
|
|
83
86
|
cli: 'astryx component Button --props --json',
|
|
84
87
|
},
|
|
88
|
+
{
|
|
89
|
+
label: 'Select a replaced Core original',
|
|
90
|
+
cli: 'astryx component SideNav --package @astryxdesign/core',
|
|
91
|
+
},
|
|
85
92
|
],
|
|
86
93
|
exitCodes: [
|
|
87
94
|
{code: 0, when: 'success'},
|
|
@@ -22,7 +22,8 @@ export const doc = {
|
|
|
22
22
|
'does, and `--index` its section index. A route ' +
|
|
23
23
|
'opens a node of the docs tree: `cli` lists its guides and reference, ' +
|
|
24
24
|
'`cli/api/functions` lists every API function, and `cli/api/functions/search` prints ' +
|
|
25
|
-
'one.
|
|
25
|
+
'one. A namespace plus a section prints that section from the one guide below it ' +
|
|
26
|
+
'that has it (`astryx docs layout side-panels`). `--depth` reads as far down the tree as you ask, from the doc alone (0) to ' +
|
|
26
27
|
'everything below it (all), and with it `--detail` sets how much of each doc below ' +
|
|
27
28
|
'shows: one line (brief, the default), its sections (compact), or all of it (full).',
|
|
28
29
|
fn: 'docs',
|