@astryxdesign/cli 0.6.6 → 0.6.7-canary.1d28282
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 +38 -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 +483 -1
- package/api/integration/pack-check.test.mjs +568 -8
- 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 +10 -198
- package/assets/docs/theme.doc.mjs +13 -771
- 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 +5 -4
- 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/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/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 +4 -0
- 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 +4 -1
- 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 +4 -3
- 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/type.ts +1 -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 +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 +22 -0
- package/foundation/integrations/cli-requirement.mjs +31 -0
- package/foundation/integrations/cli-requirement.test.mjs +70 -0
- 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
|
@@ -0,0 +1,667 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/** @file Fault-injection coverage for all ten app-theme doctor checks. */
|
|
4
|
+
|
|
5
|
+
import {afterEach, describe, expect, it} from 'vitest';
|
|
6
|
+
import * as fs from 'node:fs';
|
|
7
|
+
import * as path from 'node:path';
|
|
8
|
+
import {spawnSync} from 'node:child_process';
|
|
9
|
+
import {checkAppThemes, checkThemes} from './theme-checks.mjs';
|
|
10
|
+
import {runChecks} from './doctor.mjs';
|
|
11
|
+
import {themeAdd} from '../theme/add/add.mjs';
|
|
12
|
+
import {themeEject} from '../theme/eject/eject.mjs';
|
|
13
|
+
import {themeBuild} from '../theme/build/build.mjs';
|
|
14
|
+
import {parseThemeModuleRecord} from '../../foundation/config/theme-state.mjs';
|
|
15
|
+
|
|
16
|
+
/** @type {string[]} */
|
|
17
|
+
const dirs = [];
|
|
18
|
+
const REPO_ROOT = path.resolve(import.meta.dirname, '../../../..');
|
|
19
|
+
|
|
20
|
+
/** @param {string} file @param {string} content */
|
|
21
|
+
function write(file, content) {
|
|
22
|
+
fs.mkdirSync(path.dirname(file), {recursive: true});
|
|
23
|
+
fs.writeFileSync(file, content);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @param {Array<{slug: string, css?: string, fontFamily?: string, fontCss?: string}>} themeSpecs
|
|
28
|
+
* @param {{peerRange?: string, importModule?: boolean}} [options]
|
|
29
|
+
*/
|
|
30
|
+
async function fixture(themeSpecs = [{slug: 'ocean'}], options = {}) {
|
|
31
|
+
const dir = fs.mkdtempSync(
|
|
32
|
+
path.join(process.cwd(), '.astryx-doctor-themes-'),
|
|
33
|
+
);
|
|
34
|
+
dirs.push(dir);
|
|
35
|
+
fs.mkdirSync(path.join(dir, 'src'), {recursive: true});
|
|
36
|
+
write(path.join(dir, 'tsconfig.json'), '{}\n');
|
|
37
|
+
write(
|
|
38
|
+
path.join(dir, 'package.json'),
|
|
39
|
+
JSON.stringify({
|
|
40
|
+
name: 'doctor-app',
|
|
41
|
+
private: true,
|
|
42
|
+
dependencies: {
|
|
43
|
+
'@acme/themes': '1.0.0',
|
|
44
|
+
'@astryxdesign/core': '1.0.0',
|
|
45
|
+
},
|
|
46
|
+
}),
|
|
47
|
+
);
|
|
48
|
+
write(
|
|
49
|
+
path.join(dir, 'node_modules/@astryxdesign/core/package.json'),
|
|
50
|
+
JSON.stringify({name: '@astryxdesign/core', version: '1.0.0'}),
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
const packageDir = path.join(dir, 'node_modules/@acme/themes');
|
|
54
|
+
const exportsMap = {};
|
|
55
|
+
for (const spec of themeSpecs) {
|
|
56
|
+
exportsMap[`./themes/${spec.slug}`] = `./dist/${spec.slug}.js`;
|
|
57
|
+
exportsMap[`./themes/${spec.slug}.css`] = `./dist/${spec.slug}.css`;
|
|
58
|
+
if (spec.fontCss != null) {
|
|
59
|
+
exportsMap[`./themes/${spec.slug}.fonts.css`] =
|
|
60
|
+
`./dist/${spec.slug}.fonts.css`;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
write(
|
|
64
|
+
path.join(packageDir, 'package.json'),
|
|
65
|
+
JSON.stringify({
|
|
66
|
+
name: '@acme/themes',
|
|
67
|
+
version: '1.0.0',
|
|
68
|
+
type: 'module',
|
|
69
|
+
peerDependencies: {
|
|
70
|
+
'@astryxdesign/core': options.peerRange ?? '^1.0.0',
|
|
71
|
+
},
|
|
72
|
+
exports: exportsMap,
|
|
73
|
+
}),
|
|
74
|
+
);
|
|
75
|
+
write(
|
|
76
|
+
path.join(packageDir, 'astryx.integration.mjs'),
|
|
77
|
+
"export default {themes: './themes'};\n",
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
for (const spec of themeSpecs) {
|
|
81
|
+
const exportName = `${spec.slug}Theme`;
|
|
82
|
+
const sourceDir = path.join(packageDir, 'themes', spec.slug);
|
|
83
|
+
const fontProperty = spec.fontFamily
|
|
84
|
+
? `, fontFamily: ${JSON.stringify(spec.fontFamily)}`
|
|
85
|
+
: '';
|
|
86
|
+
write(
|
|
87
|
+
path.join(sourceDir, `${exportName}.doc.mjs`),
|
|
88
|
+
`/** @type {import('@astryxdesign/cli/authoring').ThemeDoc} */\nexport default {type: 'theme', name: '${spec.slug}', displayName: '${spec.slug}', description: '${spec.slug} theme.', maintained: true};\n`,
|
|
89
|
+
);
|
|
90
|
+
write(
|
|
91
|
+
path.join(sourceDir, `${exportName}.ts`),
|
|
92
|
+
`export const ${exportName} = {name: '${spec.slug}', tokens: {}${fontProperty}};\n`,
|
|
93
|
+
);
|
|
94
|
+
write(
|
|
95
|
+
path.join(packageDir, `dist/${spec.slug}.js`),
|
|
96
|
+
`export const ${exportName} = {name: '${spec.slug}', tokens: {}${fontProperty}};\n`,
|
|
97
|
+
);
|
|
98
|
+
write(
|
|
99
|
+
path.join(packageDir, `dist/${spec.slug}.css`),
|
|
100
|
+
spec.css ??
|
|
101
|
+
`[data-astryx-theme="${spec.slug}"] { --color-text: black; }\n`,
|
|
102
|
+
);
|
|
103
|
+
if (spec.fontCss != null) {
|
|
104
|
+
write(path.join(packageDir, `dist/${spec.slug}.fonts.css`), spec.fontCss);
|
|
105
|
+
}
|
|
106
|
+
await themeAdd(spec.slug, {
|
|
107
|
+
cwd: dir,
|
|
108
|
+
import: true,
|
|
109
|
+
package: '@acme/themes',
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
if (options.importModule !== false) {
|
|
114
|
+
write(
|
|
115
|
+
path.join(dir, 'src/index.tsx'),
|
|
116
|
+
"import {themes, defaultThemeSlug} from './astryx-themes';\nvoid themes[defaultThemeSlug];\n",
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
return {dir, packageDir, moduleFile: path.join(dir, 'src/astryx-themes.ts')};
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/** @param {Awaited<ReturnType<typeof checkAppThemes>>} checks @param {string} id */
|
|
123
|
+
function check(checks, id) {
|
|
124
|
+
const result = checks.find(item => item.id === id);
|
|
125
|
+
if (!result) throw new Error(`Missing doctor check ${id}`);
|
|
126
|
+
return result;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/** @param {string} dir */
|
|
130
|
+
function runDoctor(dir) {
|
|
131
|
+
return spawnSync(
|
|
132
|
+
process.execPath,
|
|
133
|
+
[path.join(REPO_ROOT, 'packages/cli/clients/cli/bin/astryx.mjs'), 'doctor'],
|
|
134
|
+
{cwd: dir, encoding: 'utf-8', timeout: 30_000},
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
afterEach(() => {
|
|
139
|
+
while (dirs.length > 0) {
|
|
140
|
+
fs.rmSync(dirs.pop(), {recursive: true, force: true});
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
describe('the released themes check', () => {
|
|
145
|
+
/** @param {string} name */
|
|
146
|
+
function emptyApp(name) {
|
|
147
|
+
const dir = fs.mkdtempSync(
|
|
148
|
+
path.join(process.cwd(), `.astryx-doctor-${name}-`),
|
|
149
|
+
);
|
|
150
|
+
dirs.push(dir);
|
|
151
|
+
write(path.join(dir, 'package.json'), '{"name":"app","private":true}\n');
|
|
152
|
+
return dir;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/** @param {string} dir @param {string} slug */
|
|
156
|
+
function installThemePackage(dir, slug) {
|
|
157
|
+
write(
|
|
158
|
+
path.join(
|
|
159
|
+
dir,
|
|
160
|
+
'node_modules/@astryxdesign',
|
|
161
|
+
`theme-${slug}`,
|
|
162
|
+
'package.json',
|
|
163
|
+
),
|
|
164
|
+
JSON.stringify({name: `@astryxdesign/theme-${slug}`, version: '1.0.0'}),
|
|
165
|
+
);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
it('keeps its released id, label, fields, and statuses without a generated theme module', async () => {
|
|
169
|
+
const dir = emptyApp('themes-none');
|
|
170
|
+
expect(checkThemes(dir, await checkAppThemes(dir))).toEqual({
|
|
171
|
+
id: 'themes',
|
|
172
|
+
label: 'Theme packages',
|
|
173
|
+
status: 'warn',
|
|
174
|
+
message: 'No @astryxdesign/theme-* packages are installed.',
|
|
175
|
+
fix: expect.stringContaining('theme add neutral --import'),
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
installThemePackage(dir, 'neutral');
|
|
179
|
+
const unwired = checkThemes(dir, await checkAppThemes(dir));
|
|
180
|
+
expect(unwired).toEqual({
|
|
181
|
+
id: 'themes',
|
|
182
|
+
label: 'Theme packages',
|
|
183
|
+
status: 'warn',
|
|
184
|
+
message:
|
|
185
|
+
'Theme package(s) installed (@astryxdesign/theme-neutral) but no theme appears wired.',
|
|
186
|
+
fix: expect.stringContaining('theme add <slug> --import'),
|
|
187
|
+
});
|
|
188
|
+
expect(unwired.fix).not.toContain('ASTRYX_THEME');
|
|
189
|
+
|
|
190
|
+
write(
|
|
191
|
+
path.join(dir, 'package.json'),
|
|
192
|
+
JSON.stringify({
|
|
193
|
+
name: 'app',
|
|
194
|
+
private: true,
|
|
195
|
+
astryx: {theme: '@astryxdesign/theme-neutral'},
|
|
196
|
+
}),
|
|
197
|
+
);
|
|
198
|
+
expect(checkThemes(dir, await checkAppThemes(dir))).toEqual({
|
|
199
|
+
id: 'themes',
|
|
200
|
+
label: 'Theme packages',
|
|
201
|
+
status: 'pass',
|
|
202
|
+
message:
|
|
203
|
+
'Theme package(s) installed (@astryxdesign/theme-neutral); wired via package.json astryx.theme.',
|
|
204
|
+
});
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
it('reports the overall result of the app-theme checks with a generated module', async () => {
|
|
208
|
+
const healthy = await fixture();
|
|
209
|
+
expect(checkThemes(healthy.dir, await checkAppThemes(healthy.dir))).toEqual(
|
|
210
|
+
{
|
|
211
|
+
id: 'themes',
|
|
212
|
+
label: 'Theme packages',
|
|
213
|
+
status: 'pass',
|
|
214
|
+
message:
|
|
215
|
+
'App themes come from the generated theme module, and every theme check passes.',
|
|
216
|
+
},
|
|
217
|
+
);
|
|
218
|
+
|
|
219
|
+
// A module is loaded once per process, so the broken one is a new fixture.
|
|
220
|
+
const {dir, packageDir} = await fixture();
|
|
221
|
+
write(
|
|
222
|
+
path.join(packageDir, 'dist/ocean.js'),
|
|
223
|
+
`import '@acme/definitely-missing-dep';\nexport const oceanTheme = {name: 'ocean', tokens: {}};\n`,
|
|
224
|
+
);
|
|
225
|
+
expect(checkThemes(dir, await checkAppThemes(dir))).toEqual({
|
|
226
|
+
id: 'themes',
|
|
227
|
+
label: 'Theme packages',
|
|
228
|
+
status: 'fail',
|
|
229
|
+
message: 'One theme check needs attention: theme-owners.',
|
|
230
|
+
fix: 'Follow the fix on the theme-owners check.',
|
|
231
|
+
});
|
|
232
|
+
}, 30_000);
|
|
233
|
+
|
|
234
|
+
it('passes the module rollup only when every summarized check passed', () => {
|
|
235
|
+
/** @param {string} id @param {'pass'|'warn'|'fail'|'info'} status */
|
|
236
|
+
const result = (id, status) => ({id, label: id, status, message: id});
|
|
237
|
+
const passing = [
|
|
238
|
+
result('theme-owners', 'pass'),
|
|
239
|
+
result('theme-module', 'pass'),
|
|
240
|
+
];
|
|
241
|
+
|
|
242
|
+
expect(
|
|
243
|
+
checkThemes(process.cwd(), [
|
|
244
|
+
...passing,
|
|
245
|
+
result('theme-stylesheet-imports', 'info'),
|
|
246
|
+
]),
|
|
247
|
+
).toEqual({
|
|
248
|
+
id: 'themes',
|
|
249
|
+
label: 'Theme packages',
|
|
250
|
+
status: 'info',
|
|
251
|
+
message:
|
|
252
|
+
'One theme check could not prove its result: theme-stylesheet-imports.',
|
|
253
|
+
fix: 'See the theme-stylesheet-imports check.',
|
|
254
|
+
});
|
|
255
|
+
expect(
|
|
256
|
+
checkThemes(process.cwd(), [
|
|
257
|
+
result('theme-owners', 'fail'),
|
|
258
|
+
result('theme-module', 'pass'),
|
|
259
|
+
result('theme-fonts', 'warn'),
|
|
260
|
+
result('theme-global-rules', 'info'),
|
|
261
|
+
]),
|
|
262
|
+
).toMatchObject({
|
|
263
|
+
status: 'fail',
|
|
264
|
+
message: '2 theme checks need attention: theme-owners, theme-fonts.',
|
|
265
|
+
});
|
|
266
|
+
expect(checkThemes(process.cwd(), passing)).toMatchObject({
|
|
267
|
+
status: 'pass',
|
|
268
|
+
});
|
|
269
|
+
});
|
|
270
|
+
|
|
271
|
+
it('appears once in the doctor report, right after version alignment, with and without a module', async () => {
|
|
272
|
+
const {dir} = await fixture();
|
|
273
|
+
for (const cwd of [emptyApp('themes-report'), dir]) {
|
|
274
|
+
const ids = (await runChecks({cwd})).checks.map(item => item.id);
|
|
275
|
+
expect(ids.filter(id => id === 'themes')).toHaveLength(1);
|
|
276
|
+
expect(ids.indexOf('themes')).toBe(ids.indexOf('version-alignment') + 1);
|
|
277
|
+
expect(ids.indexOf('themes')).toBeLessThan(
|
|
278
|
+
ids.findIndex(id => id === 'theme-management' || id === 'theme-owners'),
|
|
279
|
+
);
|
|
280
|
+
}
|
|
281
|
+
}, 30_000);
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
describe('app-theme doctor checks', () => {
|
|
285
|
+
it('returns ten positive passes for a healthy package theme', async () => {
|
|
286
|
+
const {dir} = await fixture();
|
|
287
|
+
const checks = await checkAppThemes(dir);
|
|
288
|
+
|
|
289
|
+
expect(checks.map(item => item.id)).toEqual([
|
|
290
|
+
'theme-owners',
|
|
291
|
+
'theme-module',
|
|
292
|
+
'theme-module-import',
|
|
293
|
+
'theme-stylesheet-imports',
|
|
294
|
+
'theme-local-builds',
|
|
295
|
+
'theme-private-variables',
|
|
296
|
+
'theme-core-peers',
|
|
297
|
+
'theme-default',
|
|
298
|
+
'theme-fonts',
|
|
299
|
+
'theme-global-rules',
|
|
300
|
+
]);
|
|
301
|
+
expect(checks.map(item => item.status)).toEqual(Array(10).fill('pass'));
|
|
302
|
+
expect(check(checks, 'theme-owners').message).toContain(
|
|
303
|
+
'every built module loads',
|
|
304
|
+
);
|
|
305
|
+
});
|
|
306
|
+
|
|
307
|
+
it('fails theme-owners when a recorded module has a missing dependency', async () => {
|
|
308
|
+
const {dir, packageDir} = await fixture();
|
|
309
|
+
write(
|
|
310
|
+
path.join(packageDir, 'dist/ocean.js'),
|
|
311
|
+
`import '@acme/definitely-missing-dep';\nexport const oceanTheme = {name: 'ocean', tokens: {}};\n`,
|
|
312
|
+
);
|
|
313
|
+
|
|
314
|
+
const result = check(await checkAppThemes(dir), 'theme-owners');
|
|
315
|
+
|
|
316
|
+
expect(result).toMatchObject({id: 'theme-owners', status: 'fail'});
|
|
317
|
+
expect(result.message).toContain('Theme "ocean"');
|
|
318
|
+
expect(result.message).toContain('@acme/definitely-missing-dep');
|
|
319
|
+
expect(result.message).not.toMatch(/\n\s+at /u);
|
|
320
|
+
const cli = runDoctor(dir);
|
|
321
|
+
expect(cli.status).toBe(1);
|
|
322
|
+
expect(cli.stdout).not.toContain('No failures');
|
|
323
|
+
expect(cli.stdout).toContain('Theme owners and built imports');
|
|
324
|
+
expect(cli.stdout).toContain('@acme/definitely-missing-dep');
|
|
325
|
+
expect(cli.stderr).not.toMatch(/\n\s+at /u);
|
|
326
|
+
}, 30_000);
|
|
327
|
+
|
|
328
|
+
it('fails theme-owners when a recorded module is malformed', async () => {
|
|
329
|
+
const {dir, packageDir} = await fixture();
|
|
330
|
+
write(
|
|
331
|
+
path.join(packageDir, 'dist/ocean.js'),
|
|
332
|
+
'export const oceanTheme = ;\n',
|
|
333
|
+
);
|
|
334
|
+
|
|
335
|
+
const result = check(await checkAppThemes(dir), 'theme-owners');
|
|
336
|
+
|
|
337
|
+
expect(result).toMatchObject({id: 'theme-owners', status: 'fail'});
|
|
338
|
+
expect(result.message).toContain('Theme "ocean"');
|
|
339
|
+
expect(result.message).toContain('does not export "oceanTheme"');
|
|
340
|
+
expect(result.message).not.toMatch(/\n\s+at /u);
|
|
341
|
+
});
|
|
342
|
+
|
|
343
|
+
it('fails theme-owners for an ambiguous multi-theme record', async () => {
|
|
344
|
+
const {dir, packageDir} = await fixture([{slug: 'ocean'}, {slug: 'reef'}]);
|
|
345
|
+
const packageFile = path.join(packageDir, 'package.json');
|
|
346
|
+
const pkg = JSON.parse(fs.readFileSync(packageFile, 'utf-8'));
|
|
347
|
+
delete pkg.exports['./themes/ocean'];
|
|
348
|
+
write(packageFile, JSON.stringify(pkg));
|
|
349
|
+
|
|
350
|
+
const result = check(await checkAppThemes(dir), 'theme-owners');
|
|
351
|
+
|
|
352
|
+
expect(result).toMatchObject({id: 'theme-owners', status: 'fail'});
|
|
353
|
+
expect(result.message).toContain('ocean');
|
|
354
|
+
expect(result.message).not.toMatch(/\n\s+at /u);
|
|
355
|
+
});
|
|
356
|
+
|
|
357
|
+
it.each([
|
|
358
|
+
'theme-local-builds',
|
|
359
|
+
'theme-private-variables',
|
|
360
|
+
'theme-core-peers',
|
|
361
|
+
'theme-fonts',
|
|
362
|
+
'theme-global-rules',
|
|
363
|
+
])('%s cannot pass when theme discovery throws', async id => {
|
|
364
|
+
const {dir} = await fixture();
|
|
365
|
+
write(
|
|
366
|
+
path.join(dir, 'astryx.config.mjs'),
|
|
367
|
+
"throw new Error('fixture discovery failure');\n",
|
|
368
|
+
);
|
|
369
|
+
|
|
370
|
+
expect(check(await checkAppThemes(dir), id)).toMatchObject({
|
|
371
|
+
status: 'info',
|
|
372
|
+
});
|
|
373
|
+
});
|
|
374
|
+
|
|
375
|
+
it('lets the static default check pass when discovery throws', async () => {
|
|
376
|
+
const {dir} = await fixture();
|
|
377
|
+
write(
|
|
378
|
+
path.join(dir, 'astryx.config.mjs'),
|
|
379
|
+
"throw new Error('fixture discovery failure');\n",
|
|
380
|
+
);
|
|
381
|
+
|
|
382
|
+
expect(check(await checkAppThemes(dir), 'theme-default')).toMatchObject({
|
|
383
|
+
status: 'pass',
|
|
384
|
+
});
|
|
385
|
+
});
|
|
386
|
+
|
|
387
|
+
it('check 1 fails when a recorded built stylesheet no longer resolves', async () => {
|
|
388
|
+
const {dir, packageDir} = await fixture();
|
|
389
|
+
fs.rmSync(path.join(packageDir, 'dist/ocean.css'));
|
|
390
|
+
|
|
391
|
+
expect(check(await checkAppThemes(dir), 'theme-owners')).toMatchObject({
|
|
392
|
+
status: 'fail',
|
|
393
|
+
fix: expect.stringContaining('theme add ocean --import'),
|
|
394
|
+
});
|
|
395
|
+
});
|
|
396
|
+
|
|
397
|
+
it('check 2 fails when the generated module is hand-edited', async () => {
|
|
398
|
+
const {dir, moduleFile} = await fixture();
|
|
399
|
+
fs.appendFileSync(moduleFile, '// hand edit\n');
|
|
400
|
+
|
|
401
|
+
expect(check(await checkAppThemes(dir), 'theme-module')).toMatchObject({
|
|
402
|
+
status: 'fail',
|
|
403
|
+
fix: expect.stringContaining('theme use ocean'),
|
|
404
|
+
});
|
|
405
|
+
});
|
|
406
|
+
|
|
407
|
+
it('check 3 warns when no project source imports the generated module', async () => {
|
|
408
|
+
const {dir} = await fixture([{slug: 'ocean'}], {importModule: false});
|
|
409
|
+
|
|
410
|
+
expect(
|
|
411
|
+
check(await checkAppThemes(dir), 'theme-module-import'),
|
|
412
|
+
).toMatchObject({
|
|
413
|
+
status: 'warn',
|
|
414
|
+
fix: expect.stringContaining('themes[defaultThemeSlug]'),
|
|
415
|
+
});
|
|
416
|
+
});
|
|
417
|
+
|
|
418
|
+
it('check 4 fails when a built module import loses its stylesheet pair', async () => {
|
|
419
|
+
const {dir, moduleFile} = await fixture();
|
|
420
|
+
const source = fs
|
|
421
|
+
.readFileSync(moduleFile, 'utf-8')
|
|
422
|
+
.replace('import "@acme/themes/themes/ocean.css";\n', '');
|
|
423
|
+
fs.writeFileSync(moduleFile, source);
|
|
424
|
+
|
|
425
|
+
expect(
|
|
426
|
+
check(await checkAppThemes(dir), 'theme-stylesheet-imports'),
|
|
427
|
+
).toMatchObject({
|
|
428
|
+
status: 'fail',
|
|
429
|
+
fix: expect.stringContaining('theme use ocean'),
|
|
430
|
+
});
|
|
431
|
+
});
|
|
432
|
+
|
|
433
|
+
it('check 5 fails when an added local theme cannot reproduce its outputs', async () => {
|
|
434
|
+
const {dir} = await fixture();
|
|
435
|
+
await themeEject('ocean', {cwd: dir, package: '@acme/themes'});
|
|
436
|
+
const localDir = path.join(dir, 'src/themes/ocean');
|
|
437
|
+
const sourceFile = path.join(localDir, 'oceanTheme.ts');
|
|
438
|
+
fs.writeFileSync(
|
|
439
|
+
sourceFile,
|
|
440
|
+
"const oceanTheme = {name: 'ocean', tokens: {'--color-bg': '#000'}};\nexport {oceanTheme};\nexport default oceanTheme;\n",
|
|
441
|
+
);
|
|
442
|
+
await themeBuild(sourceFile, {}, {cwd: dir});
|
|
443
|
+
await themeAdd('ocean', {cwd: dir, import: true});
|
|
444
|
+
expect(
|
|
445
|
+
parseThemeModuleRecord(
|
|
446
|
+
fs.readFileSync(path.join(dir, 'src/astryx-themes.ts'), 'utf-8'),
|
|
447
|
+
),
|
|
448
|
+
).toMatchObject({themes: {ocean: './src/themes'}});
|
|
449
|
+
fs.appendFileSync(path.join(localDir, 'ocean.css'), '\n.injected {}\n');
|
|
450
|
+
|
|
451
|
+
expect(
|
|
452
|
+
check(await checkAppThemes(dir), 'theme-local-builds'),
|
|
453
|
+
).toMatchObject({
|
|
454
|
+
status: 'fail',
|
|
455
|
+
fix: expect.stringContaining('theme build'),
|
|
456
|
+
});
|
|
457
|
+
});
|
|
458
|
+
|
|
459
|
+
it('check 6 ignores private variables generated from guaranteed component properties', async () => {
|
|
460
|
+
const {dir, packageDir} = await fixture([
|
|
461
|
+
{
|
|
462
|
+
slug: 'ocean',
|
|
463
|
+
css: '[data-astryx-theme="ocean"] { --_button-radius: var(--radius-full); }\n',
|
|
464
|
+
},
|
|
465
|
+
]);
|
|
466
|
+
write(
|
|
467
|
+
path.join(packageDir, 'themes/ocean/oceanTheme.ts'),
|
|
468
|
+
"export const oceanTheme = {name: 'ocean', tokens: {}, components: {button: {base: {borderRadius: 'var(--radius-full)'}}}};\n",
|
|
469
|
+
);
|
|
470
|
+
|
|
471
|
+
expect(
|
|
472
|
+
check(await checkAppThemes(dir), 'theme-private-variables'),
|
|
473
|
+
).toMatchObject({status: 'pass'});
|
|
474
|
+
});
|
|
475
|
+
|
|
476
|
+
it('check 6 fails on a private --_* key in theme input', async () => {
|
|
477
|
+
const {dir, packageDir} = await fixture();
|
|
478
|
+
write(
|
|
479
|
+
path.join(packageDir, 'themes/ocean/oceanTheme.ts'),
|
|
480
|
+
"export const oceanTheme = {name: 'ocean', tokens: {}, components: {button: {base: {'--_button-radius': '2px'}}}};\n",
|
|
481
|
+
);
|
|
482
|
+
|
|
483
|
+
const result = check(await checkAppThemes(dir), 'theme-private-variables');
|
|
484
|
+
expect(result).toMatchObject({status: 'fail'});
|
|
485
|
+
expect(result.message).toContain('--_button-radius');
|
|
486
|
+
});
|
|
487
|
+
|
|
488
|
+
it('check 7 fails when a theme peer range rejects installed Core', async () => {
|
|
489
|
+
const {dir} = await fixture([{slug: 'ocean'}], {peerRange: '^9.0.0'});
|
|
490
|
+
|
|
491
|
+
const result = check(await checkAppThemes(dir), 'theme-core-peers');
|
|
492
|
+
expect(result).toMatchObject({
|
|
493
|
+
status: 'fail',
|
|
494
|
+
fix: expect.stringContaining('npm install'),
|
|
495
|
+
});
|
|
496
|
+
expect(result.message).toContain('^9.0.0');
|
|
497
|
+
});
|
|
498
|
+
|
|
499
|
+
it('check 8 fails when the static default is not an added slug', async () => {
|
|
500
|
+
const {dir, moduleFile} = await fixture();
|
|
501
|
+
const source = fs
|
|
502
|
+
.readFileSync(moduleFile, 'utf-8')
|
|
503
|
+
.replace('"defaultThemeSlug":"ocean"', '"defaultThemeSlug":"ghost"');
|
|
504
|
+
fs.writeFileSync(moduleFile, source);
|
|
505
|
+
|
|
506
|
+
expect(check(await checkAppThemes(dir), 'theme-default')).toMatchObject({
|
|
507
|
+
status: 'fail',
|
|
508
|
+
fix: expect.stringContaining('theme use ocean'),
|
|
509
|
+
});
|
|
510
|
+
});
|
|
511
|
+
|
|
512
|
+
it('check 9 warns when a named font has no stylesheet loader', async () => {
|
|
513
|
+
const {dir} = await fixture([{slug: 'ocean', fontFamily: 'Ocean Sans'}]);
|
|
514
|
+
|
|
515
|
+
const checks = await checkAppThemes(dir);
|
|
516
|
+
const result = check(checks, 'theme-fonts');
|
|
517
|
+
expect(result).toMatchObject({
|
|
518
|
+
status: 'warn',
|
|
519
|
+
fix: expect.stringContaining('fonts.css'),
|
|
520
|
+
});
|
|
521
|
+
expect(result.message).toContain('Ocean Sans');
|
|
522
|
+
expect(checks.some(item => item.status === 'fail')).toBe(false);
|
|
523
|
+
});
|
|
524
|
+
|
|
525
|
+
it('check 9 warns when a local theme has no font stylesheet', async () => {
|
|
526
|
+
const {dir} = await fixture([{slug: 'ocean', fontFamily: 'Ocean Sans'}]);
|
|
527
|
+
await themeEject('ocean', {cwd: dir, package: '@acme/themes'});
|
|
528
|
+
const sourceFile = path.join(dir, 'src/themes/ocean/oceanTheme.ts');
|
|
529
|
+
await themeBuild(sourceFile, {}, {cwd: dir});
|
|
530
|
+
await themeAdd('ocean', {cwd: dir, import: true});
|
|
531
|
+
|
|
532
|
+
const checks = await checkAppThemes(dir);
|
|
533
|
+
expect(check(checks, 'theme-fonts')).toMatchObject({
|
|
534
|
+
status: 'warn',
|
|
535
|
+
message: expect.stringContaining('Ocean Sans'),
|
|
536
|
+
fix: expect.stringContaining('<slug>.fonts.css'),
|
|
537
|
+
});
|
|
538
|
+
expect(checks.some(item => item.status === 'fail')).toBe(false);
|
|
539
|
+
});
|
|
540
|
+
|
|
541
|
+
it('check 9 passes when a local @font-face proves the named family', async () => {
|
|
542
|
+
const {dir} = await fixture([
|
|
543
|
+
{
|
|
544
|
+
slug: 'ocean',
|
|
545
|
+
fontFamily: 'Ocean Sans',
|
|
546
|
+
fontCss:
|
|
547
|
+
'@font-face { font-family: "Ocean Sans"; src: url("./ocean.woff2"); }\n',
|
|
548
|
+
},
|
|
549
|
+
]);
|
|
550
|
+
|
|
551
|
+
expect(check(await checkAppThemes(dir), 'theme-fonts')).toMatchObject({
|
|
552
|
+
status: 'pass',
|
|
553
|
+
});
|
|
554
|
+
});
|
|
555
|
+
|
|
556
|
+
it('check 9 warns when an external import cannot prove the named family', async () => {
|
|
557
|
+
const {dir} = await fixture([
|
|
558
|
+
{
|
|
559
|
+
slug: 'ocean',
|
|
560
|
+
fontFamily: 'Ocean Sans',
|
|
561
|
+
fontCss: '@import url("https://fonts.example/ocean.css");\n',
|
|
562
|
+
},
|
|
563
|
+
]);
|
|
564
|
+
|
|
565
|
+
expect(check(await checkAppThemes(dir), 'theme-fonts')).toMatchObject({
|
|
566
|
+
status: 'warn',
|
|
567
|
+
message: expect.stringContaining('Ocean Sans'),
|
|
568
|
+
});
|
|
569
|
+
});
|
|
570
|
+
|
|
571
|
+
it('check 10 fails on conflicting unscoped rules across added themes', async () => {
|
|
572
|
+
const {dir} = await fixture([
|
|
573
|
+
{slug: 'ocean', css: 'body { color: blue; }\n'},
|
|
574
|
+
{slug: 'sunset', css: 'body { color: red; }\n'},
|
|
575
|
+
]);
|
|
576
|
+
|
|
577
|
+
const result = check(await checkAppThemes(dir), 'theme-global-rules');
|
|
578
|
+
expect(result).toMatchObject({status: 'fail'});
|
|
579
|
+
expect(result.message).toContain('body');
|
|
580
|
+
});
|
|
581
|
+
|
|
582
|
+
it('reports one information check when the CLI manages no themes', async () => {
|
|
583
|
+
const dir = fs.mkdtempSync(
|
|
584
|
+
path.join(process.cwd(), '.astryx-doctor-empty-'),
|
|
585
|
+
);
|
|
586
|
+
dirs.push(dir);
|
|
587
|
+
write(path.join(dir, 'package.json'), '{"name":"empty"}\n');
|
|
588
|
+
|
|
589
|
+
const checks = await checkAppThemes(dir);
|
|
590
|
+
expect(checks).toEqual([
|
|
591
|
+
expect.objectContaining({
|
|
592
|
+
id: 'theme-management',
|
|
593
|
+
status: 'info',
|
|
594
|
+
message: expect.stringContaining('manages no themes'),
|
|
595
|
+
fix: expect.stringContaining('theme add <slug> --import'),
|
|
596
|
+
}),
|
|
597
|
+
]);
|
|
598
|
+
});
|
|
599
|
+
|
|
600
|
+
it('reads astryx.theme from the app package when node_modules is hoisted to a workspace root', async () => {
|
|
601
|
+
const root = fs.mkdtempSync(
|
|
602
|
+
path.join(process.cwd(), '.astryx-doctor-monorepo-'),
|
|
603
|
+
);
|
|
604
|
+
dirs.push(root);
|
|
605
|
+
write(
|
|
606
|
+
path.join(root, 'package.json'),
|
|
607
|
+
JSON.stringify({name: 'mono', private: true, workspaces: ['packages/*']}),
|
|
608
|
+
);
|
|
609
|
+
for (const name of ['@astryxdesign/core', '@astryxdesign/theme-neutral']) {
|
|
610
|
+
write(
|
|
611
|
+
path.join(root, 'node_modules', name, 'package.json'),
|
|
612
|
+
JSON.stringify({name, version: '1.0.0'}),
|
|
613
|
+
);
|
|
614
|
+
}
|
|
615
|
+
const app = path.join(root, 'packages/app');
|
|
616
|
+
write(
|
|
617
|
+
path.join(app, 'package.json'),
|
|
618
|
+
JSON.stringify({
|
|
619
|
+
name: 'app',
|
|
620
|
+
private: true,
|
|
621
|
+
dependencies: {
|
|
622
|
+
'@astryxdesign/core': '1.0.0',
|
|
623
|
+
'@astryxdesign/theme-neutral': '1.0.0',
|
|
624
|
+
},
|
|
625
|
+
astryx: {theme: '@astryxdesign/theme-neutral'},
|
|
626
|
+
}),
|
|
627
|
+
);
|
|
628
|
+
|
|
629
|
+
expect(await checkAppThemes(app)).toEqual([
|
|
630
|
+
expect.objectContaining({
|
|
631
|
+
id: 'theme-management',
|
|
632
|
+
status: 'info',
|
|
633
|
+
message: expect.stringContaining(
|
|
634
|
+
'astryx.theme value "@astryxdesign/theme-neutral" remains active',
|
|
635
|
+
),
|
|
636
|
+
}),
|
|
637
|
+
]);
|
|
638
|
+
const doctor = runDoctor(app);
|
|
639
|
+
expect(doctor.stdout).toContain('remains active');
|
|
640
|
+
expect(doctor.stdout).not.toContain('no theme appears wired');
|
|
641
|
+
});
|
|
642
|
+
|
|
643
|
+
it('names an unmigrated copy without failing a project that has no module', async () => {
|
|
644
|
+
const dir = fs.mkdtempSync(
|
|
645
|
+
path.join(process.cwd(), '.astryx-doctor-unmigrated-'),
|
|
646
|
+
);
|
|
647
|
+
dirs.push(dir);
|
|
648
|
+
write(path.join(dir, 'package.json'), '{"name":"empty"}\n');
|
|
649
|
+
write(
|
|
650
|
+
path.join(dir, 'src/themes/ocean/oceanTheme.ts'),
|
|
651
|
+
'export const oceanTheme = {};\n',
|
|
652
|
+
);
|
|
653
|
+
|
|
654
|
+
const checks = await checkAppThemes(dir);
|
|
655
|
+
|
|
656
|
+
expect(checks).toHaveLength(2);
|
|
657
|
+
expect(checks.some(item => item.status === 'fail')).toBe(false);
|
|
658
|
+
expect(checks).toContainEqual(
|
|
659
|
+
expect.objectContaining({
|
|
660
|
+
id: 'theme-unmigrated-copies',
|
|
661
|
+
status: 'warn',
|
|
662
|
+
message: expect.stringContaining('src/themes/ocean'),
|
|
663
|
+
fix: expect.stringContaining('upgrade --from 0.6.4 --path . --apply'),
|
|
664
|
+
}),
|
|
665
|
+
);
|
|
666
|
+
});
|
|
667
|
+
});
|
|
@@ -15,6 +15,7 @@ export const doc = {
|
|
|
15
15
|
summary:
|
|
16
16
|
'Report a missing or hard-to-use design-system capability to the package that owns it.',
|
|
17
17
|
description:
|
|
18
|
+
'Routes the report to the package that owns the gap: options.package when given, else the integration whose component replaces the named Core component, else the one package that provides the component, else Core. ' +
|
|
18
19
|
'Sends a gap report to every configured handler: the project config handler first, then each integration handler in config order. ' +
|
|
19
20
|
'Each handler has 30 s to finish, and its output goes to stderr. Public handlers run only with confirmPublic; internal handlers always run. ' +
|
|
20
21
|
"With no handler, it files a GitHub issue for the owning package only with confirmPublic (without it nothing is sent), or returns the package's issues URL when that is not on GitHub. " +
|
|
@@ -60,7 +61,7 @@ export const doc = {
|
|
|
60
61
|
name: 'options.package',
|
|
61
62
|
type: 'string',
|
|
62
63
|
description:
|
|
63
|
-
'Package that owns the gap: @astryxdesign/core, or a loaded integration by package name or config entry. Overrides automatic owner routing; required when more than one package provides the component.',
|
|
64
|
+
'Package that owns the gap: @astryxdesign/core, or a loaded integration by package name or config entry. Overrides automatic owner routing, which picks the integration whose component replaces the named Core component, else the one package that provides it, else Core; required when more than one package provides the component.',
|
|
64
65
|
},
|
|
65
66
|
{
|
|
66
67
|
name: 'options.confirmPublic',
|