@astryxdesign/cli 0.6.5 → 0.6.6-canary.11a80dd
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 +87 -0
- package/README.md +91 -88
- package/api/build/_adapter.d.mts +70 -2
- package/api/build/_adapter.mjs +122 -10
- package/api/build/build.doc.mjs +3 -3
- package/api/build/build.test.mjs +111 -2
- 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 +110 -22
- package/api/build/kit/rank.d.mts +32 -8
- package/api/build/kit/rank.mjs +291 -97
- package/api/build/kit/rank.test.mjs +231 -48
- package/api/build/kit/weights.d.mts +82 -0
- package/api/build/kit/weights.json +1 -0
- package/api/build/kit/weights.mjs +305 -0
- package/api/build/kit/weights.test.mjs +190 -0
- package/api/component/_adapter.d.mts +19 -0
- package/api/component/_adapter.mjs +33 -0
- package/api/component/component-replacement.test.mjs +603 -0
- 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 +25 -0
- package/api/docs/detail/detail.mjs +19 -3
- package/api/docs/detail/section/section.mjs +7 -1
- package/api/docs/docOverlays.test.mjs +10 -6
- package/api/docs/docs.d.mts +6 -0
- package/api/docs/docs.depth.test.mjs +134 -0
- package/api/docs/docs.doc.mjs +31 -2
- package/api/docs/docs.mjs +46 -1
- package/api/docs/docs.test.mjs +279 -0
- package/api/docs/docs.type.d.mts +81 -4
- package/api/docs/docs.type.mjs +41 -4
- package/api/docs/index/index.mjs +11 -2
- package/api/docs/index/index.test.mjs +7 -2
- package/api/docs/integration-tree.test.mjs +572 -0
- package/api/docs/integrationDocs.test.mjs +337 -0
- package/api/docs/node/node.d.mts +28 -3
- package/api/docs/node/node.mjs +149 -23
- package/api/doctor/_adapter.d.mts +50 -0
- package/api/doctor/_adapter.mjs +190 -0
- package/api/doctor/doctor.d.mts +0 -10
- package/api/doctor/doctor.doc.mjs +1 -3
- package/api/doctor/doctor.mjs +8 -123
- 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/error.d.mts +22 -0
- package/api/error.mjs +42 -0
- package/api/gap-report/gap-report.d.mts +3 -1
- package/api/gap-report/gap-report.mjs +27 -3
- package/api/gap-report/gap-report.test.mjs +106 -0
- 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.d.mts +1 -1
- 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-contribution.d.mts +2 -1
- package/api/integration/add-contribution.mjs +7 -3
- package/api/integration/add-contribution.test.mjs +3 -3
- package/api/integration/add-helpers.d.mts +26 -5
- package/api/integration/add-helpers.mjs +50 -5
- package/api/integration/add-theme.mjs +354 -28
- package/api/integration/add-theme.test.mjs +380 -16
- package/api/integration/authoring-checks.mjs +31 -8
- package/api/integration/authoring-checks.type.d.mts +8 -0
- package/api/integration/authoring-checks.type.mjs +7 -3
- package/api/integration/integration-authoring.type.d.mts +4 -1
- package/api/integration/integration-authoring.type.mjs +6 -1
- package/api/integration/integrationAdd.doc.mjs +6 -0
- package/api/integration/integrationAddTheme.doc.mjs +10 -0
- package/api/integration/integrationComponentConflicts.doc.mjs +6 -3
- package/api/integration/integrationDocConflicts.doc.mjs +1 -1
- package/api/integration/integrationTemplateConflicts.doc.mjs +1 -1
- 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 +495 -4
- package/api/integration/pack-check.test.mjs +619 -10
- package/api/integration/validate-integration.d.mts +4 -2
- package/api/integration/validate-integration.mjs +7 -2
- package/api/integration/validate-integration.test.mjs +55 -0
- package/api/integration/validate-integration.type.d.mts +5 -0
- package/api/integration/validate-integration.type.mjs +5 -1
- package/api/integration/validateIntegration.doc.mjs +1 -1
- 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 +13 -7
- package/api/layout/expand/expand.receipt.test.mjs +74 -0
- package/api/layout/grammar/grammar.d.mts +1 -0
- package/api/layout/grammar/grammar.mjs +1 -0
- package/api/layout/layout.type.d.mts +1 -0
- package/api/layout/layout.type.mjs +1 -0
- package/api/layout/layoutCheck.doc.mjs +1 -1
- package/api/layout/layoutExpand.doc.mjs +2 -2
- package/api/layout/layoutGrammar.doc.mjs +1 -1
- package/api/search/search.d.mts +39 -8
- package/api/search/search.doc.mjs +4 -4
- package/api/search/search.mjs +248 -66
- package/api/search/search.test.mjs +829 -0
- package/api/search/search.type.d.mts +6 -6
- package/api/search/search.type.mjs +5 -5
- 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 +95 -13
- package/api/swizzle/list/list.mjs +2 -2
- package/api/swizzle/swizzle.doc.mjs +4 -0
- 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 +27 -8
- package/api/template/copy/copy.receipt.test.mjs +77 -0
- package/api/template/show/show.mjs +17 -4
- package/api/template/show/show.test.mjs +76 -0
- package/api/template/skeleton/skeleton.mjs +2 -1
- package/api/template/template-integration.test.mjs +14 -0
- package/api/template/template.d.mts +1 -1
- package/api/template/template.doc.mjs +6 -2
- package/api/template/template.mjs +2 -0
- package/api/template/template.type.d.mts +17 -0
- package/api/template/template.type.mjs +8 -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 +120 -2
- package/api/theme/build/build.family.test.mjs +13 -4
- package/api/theme/build/build.icon-lineage.test.mjs +117 -0
- package/api/theme/build/build.icon-preservation.test.mjs +639 -0
- package/api/theme/build/build.mjs +667 -195
- package/api/theme/build/build.project-core.test.mjs +165 -0
- package/api/theme/build/build.test.mjs +220 -1
- package/api/theme/build/font-warning.d.mts +11 -0
- package/api/theme/build/font-warning.mjs +28 -3
- package/api/theme/build/icon-imports.d.mts +47 -0
- package/api/theme/build/icon-imports.mjs +691 -0
- 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.d.mts +4 -1
- package/api/theme/themeBuild.doc.mjs +15 -4
- 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/run/run.mjs +20 -3
- package/api/upgrade/run/run.test.mjs +45 -1
- package/api/upgrade/upgrade.doc.mjs +1 -1
- package/api/upgrade/upgrade.type.d.mts +5 -0
- package/api/upgrade/upgrade.type.mjs +2 -0
- package/assets/codemods/integration-discovery.mjs +1 -1
- package/assets/codemods/integration-discovery.test.mjs +64 -0
- package/assets/codemods/transforms/next/__tests__/migrate-copied-themes-to-descriptors.test.mjs +129 -0
- package/assets/codemods/transforms/next/index.mjs +14 -1
- package/assets/codemods/transforms/next/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 +59 -15
- package/assets/docs/icons.doc.mjs +1 -0
- package/assets/docs/principles.doc.dense.mjs +2 -2
- package/assets/docs/principles.doc.mjs +2 -2
- package/assets/docs/principles.doc.zh.mjs +2 -2
- package/assets/docs/styling-libraries.doc.mjs +1 -1
- package/assets/docs/styling-overview.doc.mjs +211 -0
- package/assets/docs/styling.doc.mjs +2 -2
- package/assets/docs/theme.doc.dense.mjs +10 -198
- package/assets/docs/theme.doc.mjs +13 -770
- package/assets/docs/theme.doc.zh.mjs +31 -12
- package/assets/docs/tokens.doc.mjs +4 -4
- package/assets/docs/tree/add-a-theme.doc.mjs +6 -2
- package/assets/docs/tree/add-a-topic.doc.mjs +1 -1
- package/assets/docs/tree/check-your-docs.doc.mjs +2 -2
- package/assets/docs/tree/checks.doc.mjs +6 -5
- package/assets/docs/tree/debug-and-gap-reports.doc.mjs +1 -1
- package/assets/docs/tree/define-the-theme.doc.mjs +2 -2
- package/assets/docs/tree/document-the-theme.doc.mjs +4 -4
- package/assets/docs/tree/fonts-and-assets.doc.mjs +25 -20
- package/assets/docs/tree/headers-and-footers.doc.mjs +68 -0
- package/assets/docs/tree/layout-spacing.doc.mjs +168 -0
- package/assets/docs/tree/layout.doc.mjs +52 -0
- package/assets/docs/tree/replace-a-core-component.doc.mjs +21 -4
- package/assets/docs/tree/responsive.doc.mjs +102 -0
- package/assets/docs/tree/scaffold.doc.mjs +145 -0
- package/assets/docs/tree/sections-and-placement.doc.mjs +1 -1
- package/assets/docs/tree/side-panels.doc.mjs +82 -0
- package/assets/docs/tree/structure.doc.mjs +144 -0
- package/assets/docs/tree/template-doc-overview.doc.mjs +13 -1
- package/assets/docs/tree/themes.doc.mjs +2 -2
- package/assets/docs/tree/troubleshooting.doc.mjs +13 -5
- package/assets/docs/tree/use-a-theme-in-an-app.doc.mjs +22 -5
- package/assets/docs/tree/versioning.doc.mjs +11 -7
- package/assets/docs/use-a-theme.doc.mjs +212 -0
- package/assets/templates/blocks/components/DropdownMenuGroup/DropdownMenuGroupShowcase.doc.mjs +15 -0
- package/assets/templates/blocks/components/DropdownMenuGroup/DropdownMenuGroupShowcase.tsx +38 -0
- package/assets/templates/blocks/components/DropdownMenuGroup/DropdownMenuGroupWithSelectable.doc.mjs +20 -0
- package/assets/templates/blocks/components/DropdownMenuGroup/DropdownMenuGroupWithSelectable.tsx +48 -0
- package/assets/templates/pages/ai-chat/template.doc.mjs +16 -1
- package/assets/templates/pages/ai-chat-landing/template.doc.mjs +9 -1
- package/assets/templates/pages/blank/template.doc.mjs +3 -1
- package/assets/templates/pages/canvas-editor/template.doc.mjs +9 -1
- package/assets/templates/pages/centered-hero/template.doc.mjs +3 -1
- package/assets/templates/pages/checkout-wizard/template.doc.mjs +1 -0
- package/assets/templates/pages/classic-gallery/template.doc.mjs +3 -1
- package/assets/templates/pages/contact-form/template.doc.mjs +16 -1
- package/assets/templates/pages/dashboard/template.doc.mjs +15 -1
- package/assets/templates/pages/dashboard-alert-rail/template.doc.mjs +23 -1
- package/assets/templates/pages/dashboard-cohort-funnel/template.doc.mjs +10 -1
- package/assets/templates/pages/dashboard-comparison/template.doc.mjs +9 -1
- package/assets/templates/pages/dashboard-composition/template.doc.mjs +10 -1
- package/assets/templates/pages/dashboard-progress/template.doc.mjs +17 -1
- package/assets/templates/pages/dashboard-scorecard/template.doc.mjs +2 -1
- package/assets/templates/pages/detail-page/template.doc.mjs +8 -0
- package/assets/templates/pages/documentation/template.doc.mjs +10 -1
- package/assets/templates/pages/documentation-design/template.doc.mjs +10 -1
- package/assets/templates/pages/documentation-technical/template.doc.mjs +10 -1
- package/assets/templates/pages/editor/template.doc.mjs +9 -1
- package/assets/templates/pages/file-explorer/template.doc.mjs +3 -1
- package/assets/templates/pages/form-two-column/template.doc.mjs +17 -1
- package/assets/templates/pages/form-wizard/template.doc.mjs +14 -1
- package/assets/templates/pages/form-wizard-dialog/template.doc.mjs +1 -0
- package/assets/templates/pages/gallery-hero/template.doc.mjs +10 -1
- package/assets/templates/pages/ide/template.doc.mjs +9 -1
- package/assets/templates/pages/incident-console/page.tsx +1 -1
- package/assets/templates/pages/incident-console/template.doc.mjs +10 -1
- package/assets/templates/pages/kanban-board/template.doc.mjs +11 -1
- package/assets/templates/pages/library/template.doc.mjs +15 -1
- package/assets/templates/pages/login/template.doc.mjs +10 -1
- package/assets/templates/pages/login-card/template.doc.mjs +11 -1
- package/assets/templates/pages/login-split/template.doc.mjs +10 -1
- package/assets/templates/pages/login-sso/template.doc.mjs +10 -1
- package/assets/templates/pages/messaging-shell/template.doc.mjs +11 -1
- package/assets/templates/pages/mixed-gallery/template.doc.mjs +10 -1
- package/assets/templates/pages/payment-form/template.doc.mjs +3 -1
- package/assets/templates/pages/product-detail/template.doc.mjs +9 -1
- package/assets/templates/pages/product-gallery/template.doc.mjs +10 -1
- package/assets/templates/pages/settings/template.doc.mjs +3 -1
- package/assets/templates/pages/settings-dialog/template.doc.mjs +9 -1
- package/assets/templates/pages/settings-sidebar/template.doc.mjs +9 -1
- package/assets/templates/pages/shell-nav/template.doc.mjs +10 -1
- package/assets/templates/pages/shell-side-nav/template.doc.mjs +14 -1
- package/assets/templates/pages/shell-top-nav/template.doc.mjs +11 -1
- package/assets/templates/pages/side-gallery/template.doc.mjs +3 -1
- package/assets/templates/pages/table/template.doc.mjs +11 -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/templates/pages/table-filter/template.doc.mjs +21 -1
- package/assets/templates/pages/table-grouped/template.doc.mjs +15 -1
- package/assets/templates/pages/table-inbox/template.doc.mjs +18 -6
- package/assets/templates/pages/table-page/template.doc.mjs +20 -1
- package/assets/templates/pages/table-tree/template.doc.mjs +14 -1
- package/assets/templates/pages/theme-showcase/template.doc.mjs +10 -1
- package/assets/templates/pages/work-item-detail/template.doc.mjs +10 -0
- package/assets/templates/themes/butter/icons.tsx +2 -0
- package/assets/templates/themes/chocolate/icons.tsx +2 -0
- package/assets/templates/themes/gothic/icons.tsx +2 -0
- package/assets/templates/themes/matcha/icons.tsx +2 -0
- package/assets/templates/themes/neutral/icons.tsx +2 -0
- package/assets/templates/themes/stone/icons.tsx +2 -0
- package/assets/templates/themes/y2k/icons.tsx +2 -0
- 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/parse.d.mts +2 -0
- package/authoring/doctypes/template/parse.mjs +1 -0
- package/authoring/doctypes/template/parse.test.mjs +21 -0
- package/authoring/doctypes/template/template.doc.mjs +6 -0
- package/authoring/doctypes/template/type.ts +11 -0
- 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 +346 -47
- 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 +88 -12
- package/clients/cli/commands/component-replacement.text.test.mjs +271 -0
- package/clients/cli/commands/component.doc.mjs +9 -2
- package/clients/cli/commands/discover.mjs +29 -1
- package/clients/cli/commands/discover.no-source.test.mjs +75 -0
- package/clients/cli/commands/docs.depth.test.mjs +219 -0
- package/clients/cli/commands/docs.doc.mjs +15 -2
- package/clients/cli/commands/docs.mjs +273 -16
- package/clients/cli/commands/docs.test.mjs +383 -0
- 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.mjs +4 -4
- package/clients/cli/commands/doctor.test.mjs +26 -52
- package/clients/cli/commands/gap-report.doc.mjs +2 -2
- package/clients/cli/commands/gap-report.mjs +12 -0
- package/clients/cli/commands/gap-report.test.mjs +63 -0
- 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-add.doc.mjs +10 -0
- package/clients/cli/commands/integration-authoring.test.mjs +12 -2
- package/clients/cli/commands/integration-real-world.test.mjs +61 -12
- package/clients/cli/commands/integration.mjs +3 -1
- package/clients/cli/commands/layout-check.doc.mjs +2 -0
- package/clients/cli/commands/layout-expand.doc.mjs +5 -1
- 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.expand-receipt.test.mjs +94 -0
- package/clients/cli/commands/layout.mjs +56 -4
- package/clients/cli/commands/no-prompt-wording.test.mjs +4 -4
- package/clients/cli/commands/search.doc.mjs +5 -4
- package/clients/cli/commands/search.mjs +30 -6
- package/clients/cli/commands/search.test.mjs +69 -19
- 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.copy-receipt.test.mjs +60 -0
- package/clients/cli/commands/template.mjs +71 -6
- package/clients/cli/commands/template.show-media.test.mjs +62 -0
- 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 +44 -0
- 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.ascii-output.test.mjs +14 -0
- package/clients/cli/commands/upgrade.config-ordering.test.mjs +2 -1
- package/clients/cli/commands/upgrade.mjs +1 -1
- package/clients/cli/commands/write-failure.test.mjs +175 -0
- package/clients/cli/index.mjs +5 -2
- package/clients/cli/lib/component-format.mjs +19 -2
- package/clients/cli/lib/component-format.test.mjs +1 -1
- package/clients/cli/lib/define-command.mjs +4 -0
- package/clients/cli/lib/manifest.mjs +44 -165
- package/clients/cli/lib/manifest.test.mjs +98 -7
- 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 +34 -28
- package/foundation/agent-docs/agent-docs.test.mjs +1181 -0
- 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/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-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-adapter.d.mts +14 -0
- package/foundation/discovery/template-adapter.fixture-refs.test.mjs +37 -1
- package/foundation/discovery/template-adapter.mjs +21 -1
- 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 +78 -5
- package/foundation/discovery/theme-discovery.mjs +143 -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/doc-loads.test.mjs +18 -8
- package/foundation/doc-compiler/inputs.mjs +2 -1
- package/foundation/doc-compiler/inputs.test.mjs +0 -1
- package/foundation/doc-compiler/lenses.d.mts +4 -2
- package/foundation/doc-compiler/lenses.mjs +1 -1
- package/foundation/doc-compiler/tree.test.mjs +649 -0
- package/foundation/env/package-manager.d.mts +28 -8
- package/foundation/env/package-manager.mjs +49 -10
- package/foundation/env/package-manager.test.mjs +93 -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 +79 -13
- package/foundation/integrations/cli-requirement.mjs +115 -22
- package/foundation/integrations/cli-requirement.test.mjs +205 -8
- package/foundation/integrations/contribution-inventory.mjs +3 -3
- 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.d.mts +5 -5
- package/foundation/response/response-types.doc.mjs +52 -37
- 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
|
@@ -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,31 @@ 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).
|
|
296
|
+
/** @type {Map<string, any>} */
|
|
297
|
+
const replacements = new Map();
|
|
298
|
+
for (const items of Object.values(result.data.components)) {
|
|
299
|
+
for (const item of /** @type {any[]} */ (items)) {
|
|
300
|
+
if (
|
|
301
|
+
item.package !== '@astryxdesign/core' &&
|
|
302
|
+
typeof item.replaces === 'string'
|
|
303
|
+
) {
|
|
304
|
+
replacements.set(item.replaces, item);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
emit(
|
|
309
|
+
code(
|
|
310
|
+
await formatBriefAll(coreDir, {
|
|
311
|
+
zh,
|
|
312
|
+
lang,
|
|
313
|
+
themeData,
|
|
314
|
+
replacements,
|
|
315
|
+
}),
|
|
316
|
+
),
|
|
317
|
+
);
|
|
263
318
|
break;
|
|
264
319
|
}
|
|
265
320
|
|
|
@@ -275,7 +330,13 @@ export function registerComponent(program) {
|
|
|
275
330
|
const isUngrouped =
|
|
276
331
|
entries.length === 1 && items.length === 1 && items[0]?.name === cat;
|
|
277
332
|
if (!isUngrouped) out.push(section(cat));
|
|
278
|
-
|
|
333
|
+
// An entry from another package says which one (cli-surface INV28).
|
|
334
|
+
const named = items.map(item =>
|
|
335
|
+
item.package === '@astryxdesign/core'
|
|
336
|
+
? item
|
|
337
|
+
: {...item, import: `${item.import} [${item.package}]`},
|
|
338
|
+
);
|
|
339
|
+
out.push(records(named, {fields: ['name', 'import', 'description']}));
|
|
279
340
|
}
|
|
280
341
|
out.push(listFooter);
|
|
281
342
|
emit(...out);
|
|
@@ -340,6 +401,12 @@ export function registerComponent(program) {
|
|
|
340
401
|
out.push(
|
|
341
402
|
record(row, {fields: ['selector', 'status']}),
|
|
342
403
|
section('Result'),
|
|
404
|
+
// A batch is not piped as one file, so a source row names its
|
|
405
|
+
// package here; the other rows name it themselves.
|
|
406
|
+
...(row.result.type === 'component.detail.source' ||
|
|
407
|
+
row.result.type === 'component.detail.showcase'
|
|
408
|
+
? [record({package: row.result.package})]
|
|
409
|
+
: []),
|
|
343
410
|
...componentDetailBlocks(
|
|
344
411
|
row.result,
|
|
345
412
|
row.selector,
|
|
@@ -377,6 +444,15 @@ export function registerComponent(program) {
|
|
|
377
444
|
case 'component.detail.source':
|
|
378
445
|
case 'component.detail.showcase':
|
|
379
446
|
case 'component.detail.blocks':
|
|
447
|
+
// Source and showcase print the file alone so it pipes byte for
|
|
448
|
+
// byte; the package they come from goes to stderr (cli-surface
|
|
449
|
+
// INV28).
|
|
450
|
+
if (
|
|
451
|
+
result.type === 'component.detail.source' ||
|
|
452
|
+
result.type === 'component.detail.showcase'
|
|
453
|
+
) {
|
|
454
|
+
console.error(`package: ${result.package}`);
|
|
455
|
+
}
|
|
380
456
|
emit(
|
|
381
457
|
...componentDetailBlocks(
|
|
382
458
|
result,
|
|
@@ -0,0 +1,271 @@
|
|
|
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
|
+
|
|
223
|
+
describe('help documents the replacement', () => {
|
|
224
|
+
it.each([
|
|
225
|
+
[
|
|
226
|
+
['component', '--help'],
|
|
227
|
+
['replaced by an integration component', '--package @astryxdesign/core'],
|
|
228
|
+
],
|
|
229
|
+
[
|
|
230
|
+
['swizzle', '--help'],
|
|
231
|
+
['replaces', '--package @astryxdesign/core', '--list'],
|
|
232
|
+
],
|
|
233
|
+
[
|
|
234
|
+
['gap-report', '--help'],
|
|
235
|
+
['the integration whose component replaces the named Core component'],
|
|
236
|
+
],
|
|
237
|
+
[
|
|
238
|
+
['doctor', 'integration', 'components', '--help'],
|
|
239
|
+
['replaces', 'an invalid replaces'],
|
|
240
|
+
],
|
|
241
|
+
])('%s', async (args, needles) => {
|
|
242
|
+
const run = await runCli(/** @type {string[]} */ (args), {cwd: tmpDir});
|
|
243
|
+
const help = run.stdout + run.stderr;
|
|
244
|
+
for (const needle of needles) expect(help).toContain(needle);
|
|
245
|
+
});
|
|
246
|
+
});
|
|
247
|
+
|
|
248
|
+
describe('doctor integration components text and exit codes', () => {
|
|
249
|
+
it('exits 1 for an invalid replaces in a package with the floor', async () => {
|
|
250
|
+
const run = await runCli(
|
|
251
|
+
['doctor', 'integration', 'components', '@acme/bad'],
|
|
252
|
+
{
|
|
253
|
+
cwd: tmpDir,
|
|
254
|
+
},
|
|
255
|
+
);
|
|
256
|
+
expect(run.status).toBe(1);
|
|
257
|
+
expect(run.stdout).toContain('missing_component_replacement_target');
|
|
258
|
+
});
|
|
259
|
+
|
|
260
|
+
it('warns and exits 0 for a package without the floor', async () => {
|
|
261
|
+
const run = await runCli(
|
|
262
|
+
['doctor', 'integration', 'components', '@acme/old'],
|
|
263
|
+
{
|
|
264
|
+
cwd: tmpDir,
|
|
265
|
+
},
|
|
266
|
+
);
|
|
267
|
+
expect(run.status, run.stdout).toBe(0);
|
|
268
|
+
expect(run.stdout).toContain('inactive_component_replacement');
|
|
269
|
+
expect(run.stdout).toContain(`">=${COMPONENT_REPLACES_CLI}"`);
|
|
270
|
+
});
|
|
271
|
+
});
|
|
@@ -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'},
|
|
@@ -268,19 +268,47 @@ export function registerDiscover(program) {
|
|
|
268
268
|
// No discover source: the list of what this project has, as always.
|
|
269
269
|
if (available === undefined) {
|
|
270
270
|
if (result.data.length === 0) {
|
|
271
|
-
if (
|
|
271
|
+
if (options.available) {
|
|
272
|
+
// The user specifically asked for available packages but
|
|
273
|
+
// there is no source to answer from. Say so honestly.
|
|
274
|
+
emit(
|
|
275
|
+
text('No discover source is configured.'),
|
|
276
|
+
text(
|
|
277
|
+
[
|
|
278
|
+
'Available integrations are listed by discover sources.',
|
|
279
|
+
'A project can set one in astryx.config.mjs, and installed',
|
|
280
|
+
'integrations can provide one.',
|
|
281
|
+
].join(' '),
|
|
282
|
+
),
|
|
283
|
+
text(
|
|
284
|
+
[
|
|
285
|
+
`Find Astryx packages on npm: npm search @astryxdesign`,
|
|
286
|
+
`Learn more: ${run} docs cli/integrations`,
|
|
287
|
+
].join('\n'),
|
|
288
|
+
),
|
|
289
|
+
);
|
|
290
|
+
} else if (result.meta && result.meta.configured === false) {
|
|
272
291
|
emit(
|
|
273
292
|
text('No integrations configured.'),
|
|
274
293
|
text('Add integration package names to astryx.config.mjs:'),
|
|
275
294
|
code(
|
|
276
295
|
"export default {\n integrations: ['@scope/your-integration'],\n};",
|
|
277
296
|
),
|
|
297
|
+
text(
|
|
298
|
+
[
|
|
299
|
+
`Find Astryx packages on npm: npm search @astryxdesign`,
|
|
300
|
+
`Learn more: ${run} docs cli/integrations`,
|
|
301
|
+
].join('\n'),
|
|
302
|
+
),
|
|
278
303
|
);
|
|
279
304
|
} else {
|
|
280
305
|
emit(
|
|
281
306
|
text(
|
|
282
307
|
'No external components found in configured integrations.',
|
|
283
308
|
),
|
|
309
|
+
text(
|
|
310
|
+
`Find more packages: ${run} discover --available (needs a discover source)`,
|
|
311
|
+
),
|
|
284
312
|
);
|
|
285
313
|
}
|
|
286
314
|
break;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file `astryx discover` when no discover source is configured and no
|
|
5
|
+
* integration provides one.
|
|
6
|
+
*
|
|
7
|
+
* In a fresh public app with no integrations, `discover --available` used to
|
|
8
|
+
* print "No integrations configured. Add integration package names..." — a
|
|
9
|
+
* message that told users to add names they had no way to find. These tests
|
|
10
|
+
* pin the honest replacement.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import {describe, it, expect, beforeEach, afterEach} from 'vitest';
|
|
14
|
+
import * as fs from 'node:fs';
|
|
15
|
+
import * as path from 'node:path';
|
|
16
|
+
import * as os from 'node:os';
|
|
17
|
+
import {runCli} from '../../../test-utils/run-cli.mjs';
|
|
18
|
+
|
|
19
|
+
let tmpDir;
|
|
20
|
+
let project;
|
|
21
|
+
|
|
22
|
+
beforeEach(() => {
|
|
23
|
+
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'astryx-discover-nosource-'));
|
|
24
|
+
project = path.join(tmpDir, 'project');
|
|
25
|
+
fs.mkdirSync(project, {recursive: true});
|
|
26
|
+
fs.writeFileSync(
|
|
27
|
+
path.join(project, 'package.json'),
|
|
28
|
+
JSON.stringify({name: 'my-app', version: '1.0.0'}),
|
|
29
|
+
);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
afterEach(() => {
|
|
33
|
+
fs.rmSync(tmpDir, {recursive: true, force: true});
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
describe('astryx discover --available with no source', () => {
|
|
37
|
+
it('explains what discover sources are and where to find packages', async () => {
|
|
38
|
+
const {status, stdout} = await runCli(['discover', '--available'], {
|
|
39
|
+
cwd: project,
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
expect(status).toBe(0);
|
|
43
|
+
expect(stdout).toContain('No discover source is configured.');
|
|
44
|
+
expect(stdout).toContain('discover sources');
|
|
45
|
+
expect(stdout).toContain('npm search @astryxdesign');
|
|
46
|
+
expect(stdout).toContain('docs cli/integrations');
|
|
47
|
+
// Must not show the old misleading message
|
|
48
|
+
expect(stdout).not.toContain('Add integration package names');
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it('returns an empty list with configured=false in --json', async () => {
|
|
52
|
+
const {status, stdout} = await runCli(
|
|
53
|
+
['discover', '--available', '--json'],
|
|
54
|
+
{cwd: project},
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
expect(status).toBe(0);
|
|
58
|
+
const result = JSON.parse(stdout);
|
|
59
|
+
expect(result.type).toBe('discover.list');
|
|
60
|
+
expect(result.data).toEqual([]);
|
|
61
|
+
expect(result.meta).toEqual({configured: false});
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
describe('astryx discover with nothing configured', () => {
|
|
66
|
+
it('shows the config snippet and a pointer to npm and docs', async () => {
|
|
67
|
+
const {status, stdout} = await runCli(['discover'], {cwd: project});
|
|
68
|
+
|
|
69
|
+
expect(status).toBe(0);
|
|
70
|
+
expect(stdout).toContain('No integrations configured.');
|
|
71
|
+
expect(stdout).toContain("integrations: ['@scope/your-integration']");
|
|
72
|
+
expect(stdout).toContain('npm search @astryxdesign');
|
|
73
|
+
expect(stdout).toContain('docs cli/integrations');
|
|
74
|
+
});
|
|
75
|
+
});
|