@astryxdesign/cli 0.1.7 → 0.1.8-canary.07362a9
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 +40 -0
- package/README.md +115 -19
- package/{src/api → api/blog}/blog.mjs +42 -6
- package/{src/api → api/blog}/blog.test.mjs +2 -2
- package/api/build/build.mjs +92 -0
- package/api/build/build.test.mjs +92 -0
- package/{src/api → api/component}/component.mjs +49 -26
- package/{src/api → api/discover}/discover.mjs +55 -18
- package/{src/api → api/docs}/docs.mjs +47 -21
- package/{src/api → api/doctor}/doctor.mjs +13 -10
- package/{src/api → api}/error.mjs +2 -2
- package/{src/api → api/hook}/hook.mjs +11 -11
- package/{src/api → api}/index.mjs +16 -9
- package/{src/api → api/integration}/validate-integration.mjs +48 -15
- package/{src/api → api/integration}/validate-integration.test.mjs +1 -1
- package/{src/api → api/layout}/layout.mjs +66 -17
- package/{src/api → api/layout}/layout.test.mjs +1 -1
- package/{src/api → api/search}/search.mjs +71 -12
- package/api/swizzle/swizzle.mjs +283 -0
- package/{src/commands → api/swizzle}/swizzle.test.mjs +26 -1
- package/{src/api → api/template}/template-integration.test.mjs +2 -2
- package/{src/api → api/template}/template-suffix.test.mjs +3 -3
- package/{src/api → api/template}/template.mjs +96 -19
- package/{src/api → api/theme}/theme-add.mjs +35 -7
- package/{src → authoring}/codemod.mjs +6 -6
- package/{src → authoring}/config.test.mjs +1 -1
- package/{src → authoring}/doc.mjs +1 -1
- package/{src → authoring}/doc.test.mjs +1 -1
- package/{src → authoring}/template.mjs +1 -1
- package/bin/astryx.mjs +12 -10
- package/{src → cli}/commands/blog.mjs +48 -7
- package/{src → cli}/commands/build-theme.mjs +133 -115
- package/cli/commands/build.mjs +172 -0
- package/cli/commands/cli-postinstall.test.mjs +42 -0
- package/{src → cli}/commands/component/index.mjs +52 -25
- package/{src → cli}/commands/component-ownership.test.mjs +3 -3
- package/{src → cli}/commands/component-package.test.mjs +1 -1
- package/{src → cli}/commands/component-resolution.test.mjs +2 -2
- package/{src → cli}/commands/discover.mjs +23 -12
- package/{src → cli}/commands/docs.mjs +42 -10
- package/{src → cli}/commands/docs.test.mjs +1 -1
- package/{src → cli}/commands/doctor.mjs +3 -3
- package/{src → cli}/commands/doctor.test.mjs +2 -2
- package/{src → cli}/commands/ensure-core-built.mjs +3 -2
- package/{src → cli}/commands/external-showcase.test.mjs +1 -1
- package/{src → cli}/commands/hook/index.mjs +40 -17
- package/{src → cli}/commands/import-hint-correctness.test.mjs +1 -1
- package/cli/commands/init.mjs +195 -0
- package/{src → cli}/commands/init.next-steps.test.mjs +1 -1
- package/cli/commands/interactive-guard.test.mjs +66 -0
- package/{src → cli}/commands/json-contract.test.mjs +2 -2
- package/{src → cli}/commands/layout.mjs +59 -19
- package/{src → cli}/commands/search.mjs +22 -15
- package/{src → cli}/commands/search.test.mjs +1 -1
- package/cli/commands/setup-nudge.test.mjs +108 -0
- package/cli/commands/swizzle.mjs +103 -0
- package/{src → cli}/commands/template.mjs +84 -53
- package/{src → cli}/commands/template.path-safety.test.mjs +2 -2
- package/{src → cli}/commands/upgrade.integration-policy.test.mjs +1 -1
- package/{src → cli}/commands/upgrade.mjs +291 -77
- package/cli/commands/upgrade.test.mjs +314 -0
- package/{src → cli}/commands/validate-integration.mjs +17 -37
- package/{src → cli}/index.mjs +55 -19
- package/{src/codemods → codemods}/__tests__/registry.test.mjs +1 -0
- package/{src/codemods → codemods}/ensure-jscodeshift.mjs +12 -28
- package/{src/codemods → codemods}/integration-discovery.mjs +6 -3
- package/{src/codemods → codemods}/integration-discovery.test.mjs +1 -1
- package/{src/codemods → codemods}/integration-runner.mjs +8 -3
- package/{src/codemods → codemods}/registry.mjs +4 -1
- package/{src/codemods → codemods}/run-codemod.mjs +18 -11
- package/{src/codemods → codemods}/runner.mjs +24 -14
- package/{src/codemods → codemods}/transforms/v0.0.10/remove-size-props.mjs +9 -4
- package/{src/codemods → codemods}/transforms/v0.0.12/add-is-icon-only.mjs +27 -22
- package/{src/codemods → codemods}/transforms/v0.0.13/icon-name-deprecations.mjs +12 -5
- package/{src/codemods → codemods}/transforms/v0.0.13/rename-attachments-to-drawer.mjs +15 -8
- package/{src/codemods → codemods}/transforms/v0.0.13/toolbar-density-to-size.mjs +10 -4
- package/{src/codemods → codemods}/transforms/v0.0.14/rename-action-props.mjs +11 -5
- package/{src/codemods → codemods}/transforms/v0.0.14/rename-section-wash-to-muted.mjs +11 -6
- package/{src/codemods → codemods}/transforms/v0.0.14/rename-status-variants.mjs +15 -10
- package/{src/codemods → codemods}/transforms/v0.0.15/migrate-item-children-to-endcontent.mjs +13 -8
- package/{src/codemods → codemods}/transforms/v0.0.15/migrate-selector-children-to-render-option.mjs +18 -13
- package/{src/codemods → codemods}/transforms/v0.0.15/migrate-theme-selectors-to-data-attrs.mjs +8 -4
- package/{src/codemods → codemods}/transforms/v0.0.15/rename-date-picker-to-input.mjs +11 -6
- package/{src/codemods → codemods}/transforms/v0.0.15/rename-imperative-ref-to-handleRef.mjs +6 -1
- package/{src/codemods → codemods}/transforms/v0.0.15/rename-isStreaming-to-isStopShown.mjs +6 -1
- package/{src/codemods → codemods}/transforms/v0.0.15/rename-stack-element-to-as.mjs +8 -3
- package/{src/codemods → codemods}/transforms/v0.0.2/migrate-badge-dot-to-statusdot.mjs +17 -10
- package/{src/codemods → codemods}/transforms/v0.0.2/migrate-gap-to-numeric.mjs +7 -1
- package/{src/codemods → codemods}/transforms/v0.0.2/migrate-isFullBleed-to-padding.mjs +9 -4
- package/{src/codemods → codemods}/transforms/v0.0.2/migrate-useXDSIcon-to-getIcon.mjs +12 -7
- package/{src/codemods → codemods}/transforms/v0.0.2/rename-banner-endButton-to-endContent.mjs +7 -2
- package/{src/codemods → codemods}/transforms/v0.0.2/rename-form-tooltip-startIcon.mjs +8 -2
- package/{src/codemods → codemods}/transforms/v0.0.2/rename-isShown-to-isOpen.mjs +7 -2
- package/{src/codemods → codemods}/transforms/v0.0.2/rename-selector-items-to-options.mjs +7 -2
- package/{src/codemods → codemods}/transforms/v0.0.2/rename-sidenav-header-to-heading.mjs +11 -4
- package/{src/codemods → codemods}/transforms/v0.0.2/rename-topnav-title-to-heading.mjs +10 -4
- package/{src/codemods → codemods}/transforms/v0.0.2/unify-uncontrolled-to-defaultX.mjs +7 -2
- package/{src/codemods → codemods}/transforms/v0.0.2/unify-visibility-to-onOpenChange.mjs +10 -5
- package/{src/codemods → codemods}/transforms/v0.0.6/migrate-badge-children-to-label.mjs +7 -2
- package/{src/codemods → codemods}/transforms/v0.0.6/migrate-collapse-to-collapsible.mjs +9 -3
- package/{src/codemods → codemods}/transforms/v0.0.6/migrate-radius-tokens.mjs +11 -5
- package/{src/codemods → codemods}/transforms/v0.0.6/migrate-shadow-tokens.mjs +13 -6
- package/{src/codemods → codemods}/transforms/v0.0.6/migrate-skeleton-radius.mjs +7 -1
- package/{src/codemods → codemods}/transforms/v0.0.6/migrate-token-names.mjs +11 -5
- package/{src/codemods → codemods}/transforms/v0.0.7/rename-banner-variant-to-container.mjs +8 -3
- package/{src/codemods → codemods}/transforms/v0.0.8/migrate-token-renames.mjs +15 -8
- package/{src/codemods → codemods}/transforms/v0.0.8/rename-endslot-to-endcontent.mjs +7 -2
- package/{src/codemods → codemods}/transforms/v0.1.0/__tests__/drop-xds-prefix-imports.test.mjs +42 -7
- package/{src/codemods → codemods}/transforms/v0.1.0/__tests__/migrate-xds-module-specifiers.test.mjs +43 -0
- package/{src/codemods → codemods}/transforms/v0.1.0/drop-xds-prefix-imports.mjs +117 -13
- package/{src/codemods → codemods}/transforms/v0.1.0/migrate-xds-css-surfaces.mjs +21 -17
- package/{src/codemods → codemods}/transforms/v0.1.0/migrate-xds-declare-module.mjs +7 -2
- package/{src/codemods → codemods}/transforms/v0.1.0/migrate-xds-module-specifiers.mjs +86 -15
- package/{src/codemods → codemods}/transforms/v0.1.2/rename-text-color-active-to-accent.mjs +15 -9
- package/{src/codemods → codemods}/transforms/v0.1.3/migrate-layout-components-to-experimental.mjs +17 -12
- package/{src/codemods → codemods}/transforms/v0.1.5/rename-switch-label-spacing-default-to-hug.mjs +15 -9
- package/{src/codemods → codemods}/transforms/v0.1.7/migrate-table-tableprops-to-direct-props.mjs +17 -10
- package/{src/codemods → codemods}/transforms/v0.1.7/rename-table-renderprops-styles-to-xstyle.mjs +18 -13
- package/codemods/transforms/v0.1.8/__tests__/rename-avatar-size-scale.test.mjs +161 -0
- package/codemods/transforms/v0.1.8/index.mjs +19 -0
- package/codemods/transforms/v0.1.8/rename-avatar-size-scale.mjs +239 -0
- package/docs/cli-integrations.doc.mjs +150 -0
- package/docs/elevation.doc.mjs +79 -1
- package/docs/getting-started.doc.mjs +9 -9
- package/docs/internationalization.doc.mjs +92 -46
- package/docs/migration.doc.mjs +18 -18
- package/docs/principles.doc.dense.mjs +1 -1
- package/docs/principles.doc.mjs +6 -6
- package/docs/principles.doc.zh.mjs +1 -1
- package/docs/styling-libraries.doc.mjs +3 -3
- package/docs/styling.doc.mjs +4 -4
- package/docs/theme.doc.dense.mjs +2 -2
- package/docs/theme.doc.mjs +7 -7
- package/docs/theme.doc.zh.mjs +1 -1
- package/docs/tokens.doc.mjs +1 -1
- package/docs/working-with-ai.doc.mjs +19 -19
- package/{src/commands → lib/agent-docs}/agent-docs.mjs +164 -29
- package/{src/commands → lib/agent-docs}/agent-docs.path-safety.test.mjs +1 -1
- package/{src/commands → lib/agent-docs}/agent-docs.test.mjs +123 -10
- package/{src/lib → lib}/cli-error.mjs +2 -2
- package/{src/lib → lib}/component-discovery.mjs +44 -2
- package/{src/lib → lib}/component-format.mjs +67 -25
- package/{src/lib → lib}/component-loader.mjs +27 -13
- package/{src/lib → lib}/componentDocOverlay.test.mjs +0 -1
- package/{src/lib → lib}/error-codes.test.mjs +1 -1
- package/{src/lib → lib}/hook-discovery.mjs +14 -1
- package/{src/lib → lib}/hook-format.mjs +29 -5
- package/{src/lib → lib}/integration-warnings.mjs +2 -2
- package/{src/lib → lib}/integrations.mjs +20 -0
- package/{src/lib → lib}/integrations.test.mjs +1 -1
- package/{src/lib → lib}/json-contract.test.mjs +1 -1
- package/{src/lib → lib}/json-shim.mjs +11 -6
- package/{src/lib → lib}/json-shim.test.mjs +1 -1
- package/{src/lib → lib}/json.mjs +3 -3
- package/{src/lib → lib}/levenshtein.mjs +6 -0
- package/{src/lib → lib}/manifest.mjs +7 -5
- package/{src/lib → lib}/manifest.test.mjs +2 -2
- package/{src/lib → lib}/module-loader.mjs +1 -0
- package/{src/lib → lib}/package-scanner.mjs +47 -0
- package/{src/lib → lib}/project.mjs +48 -18
- package/{src/lib → lib}/project.test.mjs +1 -1
- package/{src/lib → lib}/resolve-theme.mjs +5 -0
- package/{src/lib → lib}/string-utils.mjs +15 -0
- package/lib/term-log.mjs +57 -0
- package/{src/lib → lib}/xle/browser.mjs +18 -8
- package/{src/lib → lib}/xle/expand.mjs +155 -22
- package/{src/lib → lib}/xle/parse.mjs +119 -13
- package/{src/lib → lib}/xle/print.mjs +54 -14
- package/{src/lib → lib}/xle/registry-core.mjs +28 -3
- package/{src/lib → lib}/xle/registry.mjs +9 -4
- package/{src/lib → lib}/xle/splice.mjs +13 -2
- package/{src/lib → lib}/xle/validate.mjs +95 -14
- package/lib/xle/xle-ast.d.ts +214 -0
- package/package.json +37 -28
- package/scripts/postinstall.mjs +74 -0
- package/templates/blocks/components/Avatar/AvatarFallbackChain.tsx +4 -4
- package/templates/blocks/components/Avatar/AvatarGroup.tsx +2 -2
- package/templates/blocks/components/Avatar/AvatarInitialsFallback.tsx +1 -1
- package/templates/blocks/components/Avatar/AvatarShowcase.tsx +5 -5
- package/templates/blocks/components/Avatar/AvatarUserCard.tsx +1 -1
- package/templates/blocks/components/Avatar/AvatarWithImage.tsx +4 -4
- package/templates/blocks/components/Avatar/AvatarWithStatus.tsx +3 -3
- package/templates/blocks/components/AvatarGroup/AvatarGroupShowcase.tsx +2 -2
- package/templates/blocks/components/AvatarGroupOverflow/AvatarGroupOverflowCustomText.tsx +1 -1
- package/templates/blocks/components/AvatarGroupOverflow/AvatarGroupOverflowDefault.tsx +1 -1
- package/templates/blocks/components/AvatarGroupOverflow/AvatarGroupOverflowShowcase.tsx +2 -2
- package/templates/blocks/components/AvatarStatusDot/AvatarStatusDotShowcase.tsx +3 -3
- package/templates/blocks/components/AvatarStatusDot/AvatarStatusDotVariants.tsx +3 -3
- package/templates/blocks/components/Banner/BannerFloating.doc.mjs +14 -0
- package/templates/blocks/components/Banner/BannerFloating.tsx +16 -0
- package/templates/blocks/components/Button/ButtonFloating.doc.mjs +14 -0
- package/templates/blocks/components/Button/ButtonFloating.tsx +37 -0
- package/templates/blocks/components/ButtonGroup/ButtonGroupFloating.doc.mjs +14 -0
- package/templates/blocks/components/ButtonGroup/ButtonGroupFloating.tsx +23 -0
- package/templates/blocks/components/Card/CardElevations.doc.mjs +14 -0
- package/templates/blocks/components/Card/CardElevations.tsx +32 -0
- package/templates/blocks/components/Card/ClickableCardElevated.doc.mjs +14 -0
- package/templates/blocks/components/Card/ClickableCardElevated.tsx +21 -0
- package/templates/blocks/components/Card/SelectableCardElevated.doc.mjs +14 -0
- package/templates/blocks/components/Card/SelectableCardElevated.tsx +37 -0
- package/templates/blocks/components/Carousel/CarouselSnap.tsx +1 -1
- package/templates/blocks/components/ChatComposer/ChatComposerFlat.doc.mjs +14 -0
- package/templates/blocks/components/ChatComposer/ChatComposerFlat.tsx +75 -0
- package/templates/blocks/components/ChatMessage/ChatMessageAvatarName.tsx +2 -2
- package/templates/blocks/components/ChatMessage/ChatMessageMultiBubble.tsx +1 -1
- package/templates/blocks/components/ChatMessageBubble/ChatMessageBubbleGrouping.tsx +1 -1
- package/templates/blocks/components/ChatMessageBubble/ChatMessageBubbleMetadata.tsx +1 -1
- package/templates/blocks/components/ChatMessageList/ChatMessageListDensity.tsx +5 -9
- package/templates/blocks/components/ChatMessageList/ChatMessageListFullFeatured.tsx +1 -1
- package/templates/blocks/components/CodeBlock/CodeBlockTerminal.tsx +1 -1
- package/templates/blocks/components/HoverCard/HoverCardShowcase.tsx +1 -1
- package/templates/blocks/components/IconButton/IconButtonFloating.doc.mjs +14 -0
- package/templates/blocks/components/IconButton/IconButtonFloating.tsx +37 -0
- package/templates/blocks/components/InternationalizationProvider/InternationalizationProvider01ShippedLocale.doc.mjs +19 -0
- package/templates/blocks/components/InternationalizationProvider/InternationalizationProvider01ShippedLocale.tsx +46 -0
- package/templates/blocks/components/InternationalizationProvider/InternationalizationProvider02Overrides.doc.mjs +14 -0
- package/templates/blocks/components/InternationalizationProvider/InternationalizationProvider02Overrides.tsx +33 -0
- package/templates/blocks/components/Item/ItemWithMedia.tsx +2 -2
- package/templates/blocks/components/ListItem/ListItemWithMedia.tsx +2 -2
- package/templates/blocks/components/OverflowList/OverflowListCappedToolbar.doc.mjs +14 -0
- package/templates/blocks/components/OverflowList/OverflowListCappedToolbar.tsx +39 -0
- package/templates/blocks/components/OverflowList/OverflowListMultiRowTags.doc.mjs +14 -0
- package/templates/blocks/components/OverflowList/OverflowListMultiRowTags.tsx +44 -0
- package/templates/blocks/components/Pagination/PaginationDotsCarousel.tsx +2 -6
- package/templates/blocks/components/Stack/StackFillItem.tsx +2 -6
- package/templates/blocks/components/TabList/TabListTabsWithActions.doc.mjs +1 -1
- package/templates/blocks/components/TabList/TabListTabsWithActions.tsx +2 -7
- package/templates/blocks/components/Table/TableRowStatusTable.doc.mjs +14 -0
- package/templates/blocks/components/Table/TableRowStatusTable.tsx +59 -0
- package/templates/blocks/components/Thumbnail/ThumbnailDisabled.tsx +6 -1
- package/templates/blocks/components/Thumbnail/ThumbnailGallery.tsx +1 -0
- package/templates/blocks/components/Thumbnail/ThumbnailRemovable.tsx +1 -0
- package/templates/blocks/components/TypeaheadItem/TypeaheadItemShowcase.tsx +1 -1
- package/templates/pages/ai-chat/page.tsx +4 -4
- package/templates/pages/dashboard-portfolio/page.tsx +3 -11
- package/templates/pages/detail-page/page.tsx +5 -12
- package/templates/pages/documentation-design/page.tsx +1 -1
- package/templates/pages/messaging-shell/page.tsx +6 -8
- package/templates/pages/table-grouped/page.tsx +9 -14
- package/templates/pages/table-page/page.tsx +7 -9
- package/templates/pages/table-page-heatmap-status/page.tsx +5 -13
- package/{src/types → types}/api.contract.assert.ts +17 -8
- package/{src/types → types}/api.d.ts +110 -9
- package/{src/types → types}/base.d.ts +40 -4
- package/types/build.d.ts +53 -0
- package/types/codemod.d.ts +166 -0
- package/{src/types → types}/component.d.ts +1 -1
- package/{src/types → types}/discover.d.ts +1 -1
- package/{src/types → types}/docs.d.ts +1 -4
- package/{src/types → types}/hook.d.ts +1 -1
- package/{src/types → types}/index.d.ts +1 -0
- package/types/jscodeshift.d.ts +19 -0
- package/types/layout.d.ts +74 -0
- package/{src/types → types}/swizzle.d.ts +4 -0
- package/{src/types → types}/template-api.d.ts +4 -1
- package/types/theme.d.ts +53 -0
- package/types/upgrade.d.ts +108 -0
- package/utils/package-manager.mjs +178 -0
- package/utils/package-manager.test.mjs +220 -0
- package/{src/utils → utils}/path-safety.mjs +0 -18
- package/{src/utils → utils}/paths.mjs +4 -1
- package/{src/utils → utils}/update-check.mjs +5 -4
- package/{src/utils → utils}/update-check.test.mjs +3 -3
- package/docs/integration-authoring.md +0 -105
- package/src/commands/build.mjs +0 -196
- package/src/commands/init.mjs +0 -288
- package/src/commands/interactive-guard.test.mjs +0 -69
- package/src/commands/swizzle.mjs +0 -440
- package/src/commands/upgrade.test.mjs +0 -160
- package/src/types/codemod.d.ts +0 -81
- package/src/types/theme.d.ts +0 -23
- package/src/types/upgrade.d.ts +0 -64
- package/src/utils/interactive.mjs +0 -76
- package/src/utils/interactive.test.mjs +0 -70
- package/src/utils/package-manager.mjs +0 -74
- package/src/utils/package-manager.test.mjs +0 -113
- /package/{src/api → api/docs}/docOverlays.test.mjs +0 -0
- /package/{src/api → api/integration}/integration-block-exports.test.mjs +0 -0
- /package/{src/api → api/template}/template.test.mjs +0 -0
- /package/{src → authoring}/codemod.test.mjs +0 -0
- /package/{src → authoring}/config.mjs +0 -0
- /package/{src → authoring}/integration.mjs +0 -0
- /package/{src → authoring}/template.test.mjs +0 -0
- /package/{src → cli}/cli-exit-codes.test.mjs +0 -0
- /package/{src → cli}/commands/build-theme.color-scheme.test.mjs +0 -0
- /package/{src → cli}/commands/build-theme.import-path.test.mjs +0 -0
- /package/{src → cli}/commands/build-theme.path-safety.test.mjs +0 -0
- /package/{src → cli}/commands/build-theme.prose.test.mjs +0 -0
- /package/{src → cli}/commands/build-theme.variants.test.mjs +0 -0
- /package/{src → cli}/commands/build-theme.watch.test.mjs +0 -0
- /package/{src → cli}/commands/component.test.mjs +0 -0
- /package/{src → cli}/commands/detail-levels.test.mjs +0 -0
- /package/{src → cli}/commands/swizzle.path-safety.test.mjs +0 -0
- /package/{src → cli}/commands/swizzle.routing.test.mjs +0 -0
- /package/{src → cli}/commands/template.test.mjs +0 -0
- /package/{src → cli}/commands/upgrade.config-ordering.test.mjs +0 -0
- /package/{src → cli}/commands/validate-integration.test.mjs +0 -0
- /package/{src → cli}/update-hint-commands.test.mjs +0 -0
- /package/{src/codemods → codemods}/__tests__/rename-imperative-ref-to-handleRef.test.mjs +0 -0
- /package/{src/codemods → codemods}/__tests__/rename-isStreaming-to-isStopShown.test.mjs +0 -0
- /package/{src/codemods → codemods}/__tests__/rename-section-wash-to-muted.test.mjs +0 -0
- /package/{src/codemods → codemods}/__tests__/runner.test.mjs +0 -0
- /package/{src/codemods → codemods}/__tests__/toolbar-density-to-size.test.mjs +0 -0
- /package/{src/codemods → codemods}/__tests__/validation.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.10/__tests__/remove-size-props.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.10/index.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.12/__tests__/add-is-icon-only.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.12/index.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.13/__tests__/icon-name-deprecations.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.13/__tests__/rename-attachments-to-drawer.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.13/index.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.14/__tests__/rename-action-props.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.14/__tests__/rename-status-variants.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.14/index.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.15/__tests__/migrate-item-children-to-endcontent.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.15/__tests__/migrate-selector-children-to-render-option.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.15/__tests__/migrate-theme-selectors-to-data-attrs.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.15/__tests__/rename-date-picker-to-input.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.15/__tests__/rename-stack-element-to-as.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.15/index.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/migrate-badge-dot-to-statusdot.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/migrate-gap-to-numeric.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/migrate-isFullBleed-to-padding.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/migrate-useXDSIcon-to-getIcon.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/rename-banner-endButton-to-endContent.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/rename-form-tooltip-startIcon.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/rename-isShown-to-isOpen.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/rename-selector-items-to-options.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/rename-sidenav-header-to-heading.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/rename-topnav-title-to-heading.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/unify-uncontrolled-to-defaultX.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/unify-visibility-to-onOpenChange.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.2/index.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.6/__tests__/migrate-collapse-to-collapsible.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.6/__tests__/migrate-radius-tokens.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.6/__tests__/migrate-shadow-tokens.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.6/__tests__/migrate-skeleton-radius.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.6/__tests__/migrate-token-names.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.6/index.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.7/__tests__/rename-banner-variant-to-container.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.7/index.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.8/__tests__/migrate-token-renames.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.8/__tests__/rename-endslot-to-endcontent.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.8/index.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.1.0/__tests__/migrate-xds-css-surfaces.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.1.0/__tests__/migrate-xds-declare-module.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.1.0/__tests__/v0.1.0-ordering.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.1.0/index.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.1.2/__tests__/rename-text-color-active-to-accent.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.1.2/index.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.1.3/__tests__/migrate-layout-components-to-experimental.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.1.3/index.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.1.5/__tests__/rename-switch-label-spacing-default-to-hug.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.1.5/index.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.1.7/__tests__/migrate-table-tableprops-to-direct-props.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.1.7/__tests__/rename-table-renderprops-styles-to-xstyle.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.1.7/index.mjs +0 -0
- /package/{src/lib → lib}/cli-error.test.mjs +0 -0
- /package/{src/lib → lib}/component-discovery.importpath.test.mjs +0 -0
- /package/{src/lib → lib}/component-format.test.mjs +0 -0
- /package/{src/lib → lib}/component-loader.test.mjs +0 -0
- /package/{src/lib → lib}/config-cache.mjs +0 -0
- /package/{src/lib → lib}/config-cache.test.mjs +0 -0
- /package/{src/lib → lib}/config-schema.mjs +0 -0
- /package/{src/lib → lib}/error-codes.mjs +0 -0
- /package/{src/lib → lib}/integration-warnings.test.mjs +0 -0
- /package/{src/lib → lib}/module-loader.test.mjs +0 -0
- /package/{src/lib → lib}/node-version.mjs +0 -0
- /package/{src/lib → lib}/node-version.test.mjs +0 -0
- /package/{src/lib → lib}/parse.mjs +0 -0
- /package/{src/lib → lib}/site.mjs +0 -0
- /package/{src/lib → lib}/xle/browser.d.ts +0 -0
- /package/{src/lib → lib}/xle/xle.test.mjs +0 -0
- /package/{src/schemas → schemas}/doc-schema.mjs +0 -0
- /package/{src/schemas → schemas}/template-schema.mjs +0 -0
- /package/{src/types → types}/config.d.ts +0 -0
- /package/{src/types → types}/doc.d.ts +0 -0
- /package/{src/types → types}/doctor.d.ts +0 -0
- /package/{src/types → types}/error-codes.d.ts +0 -0
- /package/{src/types → types}/integration.d.ts +0 -0
- /package/{src/types → types}/manifest.d.ts +0 -0
- /package/{src/types → types}/search.d.ts +0 -0
- /package/{src/types → types}/template.d.ts +0 -0
- /package/{src/types → types}/validate-integration.d.ts +0 -0
- /package/{src/utils → utils}/github.mjs +0 -0
- /package/{src/utils → utils}/path-safety.test.mjs +0 -0
- /package/{src/utils → utils}/paths.test.mjs +0 -0
- /package/{src/utils → utils}/semver.mjs +0 -0
- /package/{src/utils → utils}/semver.test.mjs +0 -0
package/src/types/theme.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Theme build command JSON responses.
|
|
5
|
-
*
|
|
6
|
-
* Invocation -> type discriminator
|
|
7
|
-
* ------------------------------------------------------------------
|
|
8
|
-
* xds --json theme build <file> -> theme.build
|
|
9
|
-
* (file not found / parse error) -> CLIError
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
/** xds --json theme build <file> */
|
|
13
|
-
export interface ThemeBuildResponse {
|
|
14
|
-
type: 'theme.build';
|
|
15
|
-
data: {
|
|
16
|
-
name: string;
|
|
17
|
-
tokenCount: number;
|
|
18
|
-
componentCount: number;
|
|
19
|
-
sizeKB: number;
|
|
20
|
-
outputs: {css: string; js: string; dts: string; variantsDts?: string};
|
|
21
|
-
warnings: string[];
|
|
22
|
-
};
|
|
23
|
-
}
|
package/src/types/upgrade.d.ts
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Upgrade command JSON responses.
|
|
5
|
-
*
|
|
6
|
-
* Invocation -> type discriminator
|
|
7
|
-
* ------------------------------------------------------------------
|
|
8
|
-
* xds --json upgrade --list -> upgrade.list
|
|
9
|
-
* xds --json upgrade [--apply] -> upgrade.run
|
|
10
|
-
* xds --json upgrade (status short-circuit) -> upgrade.status
|
|
11
|
-
* (version detection failure) -> CLIError
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
/** xds --json upgrade --list */
|
|
15
|
-
export interface UpgradeListResponse {
|
|
16
|
-
type: 'upgrade.list';
|
|
17
|
-
data: UpgradeListEntry[];
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export interface UpgradeListEntry {
|
|
21
|
-
name: string;
|
|
22
|
-
title: string;
|
|
23
|
-
version: string;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/** xds --json upgrade [--apply] */
|
|
27
|
-
export interface UpgradeRunResponse {
|
|
28
|
-
type: 'upgrade.run';
|
|
29
|
-
data: {
|
|
30
|
-
from: string;
|
|
31
|
-
to: string;
|
|
32
|
-
codemods: number;
|
|
33
|
-
depsUpdated: string[];
|
|
34
|
-
agentDocsRefreshed: boolean;
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* xds --json upgrade — short-circuit status results.
|
|
40
|
-
*
|
|
41
|
-
* - `up_to_date`: `--from` is >= installed target and `--force` was not passed.
|
|
42
|
-
* - `no_codemods`: no codemods (core or integration) apply to the range.
|
|
43
|
-
* - `config_fixable`: DRY-RUN ONLY. The consumer's astryx.config currently
|
|
44
|
-
* fails strict validation, but a pending core CONFIG codemod (in the selected
|
|
45
|
-
* range) would repair it. The dry run previews the fix without writing and
|
|
46
|
-
* reports the exact command to apply it; integrations are skipped for the
|
|
47
|
-
* preview (they will be processed on the `--apply` run).
|
|
48
|
-
*/
|
|
49
|
-
export interface UpgradeStatusResponse {
|
|
50
|
-
type: 'upgrade.status';
|
|
51
|
-
data:
|
|
52
|
-
| {status: 'up_to_date'; from: string; to: string}
|
|
53
|
-
| {status: 'no_codemods'; from: string; to: string}
|
|
54
|
-
| {
|
|
55
|
-
status: 'config_fixable';
|
|
56
|
-
from: string;
|
|
57
|
-
to: string;
|
|
58
|
-
configError: string;
|
|
59
|
-
configCodemods: string[];
|
|
60
|
-
suggestedCommand: string;
|
|
61
|
-
message: string;
|
|
62
|
-
note: string;
|
|
63
|
-
};
|
|
64
|
-
}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @file Interactivity contract for the CLI.
|
|
5
|
-
*
|
|
6
|
-
* A single source of truth for "can this process prompt the user?". Several
|
|
7
|
-
* commands launch @clack/prompts wizards; in a non-interactive context (CI,
|
|
8
|
-
* piped stdin/stdout, no TTY) those prompts block forever. Historically each
|
|
9
|
-
* command answered this question differently — some checked `stdout.isTTY`,
|
|
10
|
-
* one checked `stdin.isTTY`, one added `!process.env.CI`, and some had no
|
|
11
|
-
* guard at all. This module centralizes the check so every command behaves
|
|
12
|
-
* identically.
|
|
13
|
-
*
|
|
14
|
-
* Two entry points, for two situations:
|
|
15
|
-
*
|
|
16
|
-
* - `requireInteractive()` — for commands whose prompt IS the work
|
|
17
|
-
* (e.g. `astryx init`, `astryx theme`). With no TTY there is nothing to do, so
|
|
18
|
-
* fail fast (exit 1) with actionable, non-interactive guidance.
|
|
19
|
-
*
|
|
20
|
-
* - `isInteractive()` — for commands with an OPTIONAL secondary prompt
|
|
21
|
-
* that runs after the primary work has already succeeded; callers use
|
|
22
|
-
* this to skip the prompt gracefully in non-interactive contexts.
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* True when the process can safely run an interactive prompt.
|
|
27
|
-
*
|
|
28
|
-
* Requires BOTH stdin and stdout to be TTYs (clack reads stdin and renders to
|
|
29
|
-
* stdout) and that we are not in a CI environment. A CI runner may allocate a
|
|
30
|
-
* pseudo-TTY, so `process.env.CI` is an explicit override: never prompt in CI.
|
|
31
|
-
*
|
|
32
|
-
* @param {object} [env] - Override hook for tests.
|
|
33
|
-
* @param {boolean} [env.stdinTTY=process.stdin.isTTY]
|
|
34
|
-
* @param {boolean} [env.stdoutTTY=process.stdout.isTTY]
|
|
35
|
-
* @param {boolean} [env.ci=Boolean(process.env.CI)]
|
|
36
|
-
* @returns {boolean}
|
|
37
|
-
*/
|
|
38
|
-
export function isInteractive({
|
|
39
|
-
stdinTTY = Boolean(process.stdin && process.stdin.isTTY),
|
|
40
|
-
stdoutTTY = Boolean(process.stdout && process.stdout.isTTY),
|
|
41
|
-
ci = Boolean(process.env.CI),
|
|
42
|
-
} = {}) {
|
|
43
|
-
if (ci) return false;
|
|
44
|
-
return stdinTTY && stdoutTTY;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Guard for commands whose primary action is an interactive wizard. When the
|
|
49
|
-
* process is non-interactive, prints an actionable error and exits 1 instead
|
|
50
|
-
* of hanging on a prompt that will never receive input.
|
|
51
|
-
*
|
|
52
|
-
* @param {object} options
|
|
53
|
-
* @param {string} options.command - Command name for the message, e.g. 'init'.
|
|
54
|
-
* @param {string} options.hint - Concrete non-interactive invocation, e.g.
|
|
55
|
-
* '`pnpm astryx init --all` or `--features agents,theme,template`'.
|
|
56
|
-
* @param {boolean} [options.json=false] - When true, the command does not
|
|
57
|
-
* support --json; we still exit 1 but skip the human-formatted guidance.
|
|
58
|
-
* @param {object} [env] - Forwarded to isInteractive (test hook).
|
|
59
|
-
* @returns {void} Returns when interactive; otherwise calls process.exit(1).
|
|
60
|
-
*/
|
|
61
|
-
export function requireInteractive({command, hint, json = false} = {}, env) {
|
|
62
|
-
if (isInteractive(env)) return;
|
|
63
|
-
const name = command ? `astryx ${command}` : 'this command';
|
|
64
|
-
console.error(
|
|
65
|
-
`Error: \`${name}\` with no flags is interactive and requires a TTY.`,
|
|
66
|
-
);
|
|
67
|
-
if (hint) {
|
|
68
|
-
console.error(`Run non-interactively with: ${hint}`);
|
|
69
|
-
}
|
|
70
|
-
if (!json) {
|
|
71
|
-
console.error(
|
|
72
|
-
'Detected a non-interactive environment (no TTY, piped I/O, or CI=1).',
|
|
73
|
-
);
|
|
74
|
-
}
|
|
75
|
-
process.exit(1);
|
|
76
|
-
}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @file Unit tests for the interactivity contract.
|
|
5
|
-
*
|
|
6
|
-
* isInteractive() is pure given its injected env, so these are fast unit
|
|
7
|
-
* tests. The "does the command actually fail fast instead of hanging" proof
|
|
8
|
-
* lives in the per-command subprocess tests (init/theme non-interactive).
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import {describe, it, expect, vi, afterEach} from 'vitest';
|
|
12
|
-
import {isInteractive, requireInteractive} from './interactive.mjs';
|
|
13
|
-
|
|
14
|
-
describe('isInteractive', () => {
|
|
15
|
-
it('is true only when stdin AND stdout are TTYs and not CI', () => {
|
|
16
|
-
expect(isInteractive({stdinTTY: true, stdoutTTY: true, ci: false})).toBe(true);
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
it('is false when stdin is not a TTY (piped input)', () => {
|
|
20
|
-
expect(isInteractive({stdinTTY: false, stdoutTTY: true, ci: false})).toBe(false);
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
it('is false when stdout is not a TTY (piped output)', () => {
|
|
24
|
-
expect(isInteractive({stdinTTY: true, stdoutTTY: false, ci: false})).toBe(false);
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
it('is false in CI even with a pseudo-TTY on both streams', () => {
|
|
28
|
-
expect(isInteractive({stdinTTY: true, stdoutTTY: true, ci: true})).toBe(false);
|
|
29
|
-
});
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
describe('requireInteractive', () => {
|
|
33
|
-
afterEach(() => {
|
|
34
|
-
vi.restoreAllMocks();
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
it('returns (does not exit) when interactive', () => {
|
|
38
|
-
const exit = vi.spyOn(process, 'exit').mockImplementation(() => {
|
|
39
|
-
throw new Error('exit should not be called');
|
|
40
|
-
});
|
|
41
|
-
expect(() =>
|
|
42
|
-
requireInteractive(
|
|
43
|
-
{command: 'init', hint: '`astryx init --all`'},
|
|
44
|
-
{stdinTTY: true, stdoutTTY: true, ci: false},
|
|
45
|
-
),
|
|
46
|
-
).not.toThrow();
|
|
47
|
-
expect(exit).not.toHaveBeenCalled();
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
it('exits 1 with actionable guidance when non-interactive', () => {
|
|
51
|
-
const exit = vi
|
|
52
|
-
.spyOn(process, 'exit')
|
|
53
|
-
.mockImplementation(() => {
|
|
54
|
-
throw new Error('__exit__');
|
|
55
|
-
});
|
|
56
|
-
const err = vi.spyOn(console, 'error').mockImplementation(() => {});
|
|
57
|
-
expect(() =>
|
|
58
|
-
requireInteractive(
|
|
59
|
-
{command: 'theme', hint: '`astryx theme <preset>`'},
|
|
60
|
-
{stdinTTY: false, stdoutTTY: false, ci: false},
|
|
61
|
-
),
|
|
62
|
-
).toThrow('__exit__');
|
|
63
|
-
expect(exit).toHaveBeenCalledWith(1);
|
|
64
|
-
const output = err.mock.calls.map(c => c.join(' ')).join('\n');
|
|
65
|
-
expect(output).toMatch(/requires a TTY/i);
|
|
66
|
-
expect(output).toMatch(/astryx theme <preset>/);
|
|
67
|
-
expect(output).toMatch(/`astryx theme`/);
|
|
68
|
-
expect(output).not.toMatch(/\bxds\b/);
|
|
69
|
-
});
|
|
70
|
-
});
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @file Detect the project's package manager from lockfiles.
|
|
5
|
-
*
|
|
6
|
-
* Returns the correct command prefix for running package binaries
|
|
7
|
-
* (e.g. 'npx astryx', 'yarn astryx', 'pnpm exec astryx').
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import * as fs from 'node:fs';
|
|
11
|
-
import * as path from 'node:path';
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Detect the package manager used in a project directory.
|
|
15
|
-
* Walks up from targetDir looking for lockfiles.
|
|
16
|
-
*
|
|
17
|
-
* @param {string} [targetDir=process.cwd()]
|
|
18
|
-
* @returns {'yarn'|'pnpm'|'bun'|'npm'}
|
|
19
|
-
*/
|
|
20
|
-
export function detectPackageManager(targetDir = process.cwd()) {
|
|
21
|
-
const KNOWN_PMS = new Set(['yarn', 'pnpm', 'bun', 'npm']);
|
|
22
|
-
let dir = path.resolve(targetDir);
|
|
23
|
-
const root = path.parse(dir).root;
|
|
24
|
-
|
|
25
|
-
while (dir !== root) {
|
|
26
|
-
// 1. Lockfiles (highest priority)
|
|
27
|
-
if (fs.existsSync(path.join(dir, 'yarn.lock'))) return 'yarn';
|
|
28
|
-
if (fs.existsSync(path.join(dir, 'pnpm-lock.yaml'))) return 'pnpm';
|
|
29
|
-
if (fs.existsSync(path.join(dir, 'bun.lockb')) || fs.existsSync(path.join(dir, 'bun.lock'))) return 'bun';
|
|
30
|
-
if (fs.existsSync(path.join(dir, 'package-lock.json'))) return 'npm';
|
|
31
|
-
|
|
32
|
-
// 2. packageManager field in package.json
|
|
33
|
-
const pkgPath = path.join(dir, 'package.json');
|
|
34
|
-
if (fs.existsSync(pkgPath)) {
|
|
35
|
-
try {
|
|
36
|
-
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'));
|
|
37
|
-
if (pkg.packageManager) {
|
|
38
|
-
const name = pkg.packageManager.split('@')[0];
|
|
39
|
-
if (KNOWN_PMS.has(name)) return name;
|
|
40
|
-
}
|
|
41
|
-
} catch {
|
|
42
|
-
// Best-effort: unreadable/invalid package.json — keep walking up.
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
dir = path.dirname(dir);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// 3. npm_config_user_agent env var (set by all PMs when running scripts)
|
|
50
|
-
const ua = process.env.npm_config_user_agent;
|
|
51
|
-
if (ua) {
|
|
52
|
-
const name = ua.split('/')[0];
|
|
53
|
-
if (KNOWN_PMS.has(name)) return name;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
return 'npx';
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Get the command prefix for running a package binary.
|
|
61
|
-
*
|
|
62
|
-
* @param {string} [targetDir]
|
|
63
|
-
* @returns {string} e.g. 'npx', 'yarn', 'pnpm exec', 'bunx'
|
|
64
|
-
*/
|
|
65
|
-
export function getRunPrefix(targetDir) {
|
|
66
|
-
const pm = detectPackageManager(targetDir);
|
|
67
|
-
switch (pm) {
|
|
68
|
-
case 'yarn': return 'yarn';
|
|
69
|
-
case 'pnpm': return 'pnpm exec';
|
|
70
|
-
case 'bun': return 'bunx';
|
|
71
|
-
case 'npm':
|
|
72
|
-
default: return 'npx';
|
|
73
|
-
}
|
|
74
|
-
}
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
|
|
3
|
-
import {describe, it, expect, afterEach, vi} from 'vitest';
|
|
4
|
-
import * as fs from 'node:fs';
|
|
5
|
-
import * as path from 'node:path';
|
|
6
|
-
import * as os from 'node:os';
|
|
7
|
-
import {detectPackageManager} from './package-manager.mjs';
|
|
8
|
-
|
|
9
|
-
let tmpDir;
|
|
10
|
-
|
|
11
|
-
afterEach(() => {
|
|
12
|
-
if (tmpDir) {
|
|
13
|
-
fs.rmSync(tmpDir, {recursive: true, force: true});
|
|
14
|
-
tmpDir = null;
|
|
15
|
-
}
|
|
16
|
-
vi.restoreAllMocks();
|
|
17
|
-
delete process.env.npm_config_user_agent;
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
function makeTmpDir() {
|
|
21
|
-
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'astryx-pm-test-'));
|
|
22
|
-
return tmpDir;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
describe('detectPackageManager', () => {
|
|
26
|
-
it('detects yarn from yarn.lock', () => {
|
|
27
|
-
const dir = makeTmpDir();
|
|
28
|
-
fs.writeFileSync(path.join(dir, 'yarn.lock'), '');
|
|
29
|
-
expect(detectPackageManager(dir)).toBe('yarn');
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
it('detects pnpm from pnpm-lock.yaml', () => {
|
|
33
|
-
const dir = makeTmpDir();
|
|
34
|
-
fs.writeFileSync(path.join(dir, 'pnpm-lock.yaml'), '');
|
|
35
|
-
expect(detectPackageManager(dir)).toBe('pnpm');
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
it('detects npm from package-lock.json', () => {
|
|
39
|
-
const dir = makeTmpDir();
|
|
40
|
-
fs.writeFileSync(path.join(dir, 'package-lock.json'), '{}');
|
|
41
|
-
expect(detectPackageManager(dir)).toBe('npm');
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
it('detects bun from bun.lockb', () => {
|
|
45
|
-
const dir = makeTmpDir();
|
|
46
|
-
fs.writeFileSync(path.join(dir, 'bun.lockb'), '');
|
|
47
|
-
expect(detectPackageManager(dir)).toBe('bun');
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
it('detects from packageManager field in package.json (no lockfile)', () => {
|
|
51
|
-
const dir = makeTmpDir();
|
|
52
|
-
fs.writeFileSync(
|
|
53
|
-
path.join(dir, 'package.json'),
|
|
54
|
-
JSON.stringify({packageManager: 'yarn@4.1.0'}),
|
|
55
|
-
);
|
|
56
|
-
expect(detectPackageManager(dir)).toBe('yarn');
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
it('detects pnpm from packageManager field', () => {
|
|
60
|
-
const dir = makeTmpDir();
|
|
61
|
-
fs.writeFileSync(
|
|
62
|
-
path.join(dir, 'package.json'),
|
|
63
|
-
JSON.stringify({packageManager: 'pnpm@8.0.0'}),
|
|
64
|
-
);
|
|
65
|
-
expect(detectPackageManager(dir)).toBe('pnpm');
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
it('ignores unknown packageManager values', () => {
|
|
69
|
-
const dir = makeTmpDir();
|
|
70
|
-
fs.writeFileSync(
|
|
71
|
-
path.join(dir, 'package.json'),
|
|
72
|
-
JSON.stringify({packageManager: 'unknown@1.0.0'}),
|
|
73
|
-
);
|
|
74
|
-
expect(detectPackageManager(dir)).toBe('npx');
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
it('lockfile takes priority over packageManager field', () => {
|
|
78
|
-
const dir = makeTmpDir();
|
|
79
|
-
fs.writeFileSync(path.join(dir, 'yarn.lock'), '');
|
|
80
|
-
fs.writeFileSync(
|
|
81
|
-
path.join(dir, 'package.json'),
|
|
82
|
-
JSON.stringify({packageManager: 'pnpm@8.0.0'}),
|
|
83
|
-
);
|
|
84
|
-
expect(detectPackageManager(dir)).toBe('yarn');
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
it('detects from npm_config_user_agent env var', () => {
|
|
88
|
-
const dir = makeTmpDir();
|
|
89
|
-
process.env.npm_config_user_agent = 'yarn/1.22.22 node/v20.0.0';
|
|
90
|
-
expect(detectPackageManager(dir)).toBe('yarn');
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
it('detects pnpm from npm_config_user_agent env var', () => {
|
|
94
|
-
const dir = makeTmpDir();
|
|
95
|
-
process.env.npm_config_user_agent = 'pnpm/8.15.0 node/v20.0.0';
|
|
96
|
-
expect(detectPackageManager(dir)).toBe('pnpm');
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
it('falls back to npx when no signals present', () => {
|
|
100
|
-
const dir = makeTmpDir();
|
|
101
|
-
expect(detectPackageManager(dir)).toBe('npx');
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
it('packageManager field takes priority over npm_config_user_agent', () => {
|
|
105
|
-
const dir = makeTmpDir();
|
|
106
|
-
fs.writeFileSync(
|
|
107
|
-
path.join(dir, 'package.json'),
|
|
108
|
-
JSON.stringify({packageManager: 'bun@1.0.0'}),
|
|
109
|
-
);
|
|
110
|
-
process.env.npm_config_user_agent = 'npm/10.0.0 node/v20.0.0';
|
|
111
|
-
expect(detectPackageManager(dir)).toBe('bun');
|
|
112
|
-
});
|
|
113
|
-
});
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/{src/codemods → codemods}/transforms/v0.0.13/__tests__/icon-name-deprecations.test.mjs
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/{src/codemods → codemods}/transforms/v0.0.14/__tests__/rename-action-props.test.mjs
RENAMED
|
File without changes
|
/package/{src/codemods → codemods}/transforms/v0.0.14/__tests__/rename-status-variants.test.mjs
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/{src/codemods → codemods}/transforms/v0.0.15/__tests__/rename-date-picker-to-input.test.mjs
RENAMED
|
File without changes
|
/package/{src/codemods → codemods}/transforms/v0.0.15/__tests__/rename-stack-element-to-as.test.mjs
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/migrate-gap-to-numeric.test.mjs
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/rename-isShown-to-isOpen.test.mjs
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/{src/codemods → codemods}/transforms/v0.0.6/__tests__/migrate-radius-tokens.test.mjs
RENAMED
|
File without changes
|
/package/{src/codemods → codemods}/transforms/v0.0.6/__tests__/migrate-shadow-tokens.test.mjs
RENAMED
|
File without changes
|
/package/{src/codemods → codemods}/transforms/v0.0.6/__tests__/migrate-skeleton-radius.test.mjs
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/{src/codemods → codemods}/transforms/v0.0.8/__tests__/migrate-token-renames.test.mjs
RENAMED
|
File without changes
|
/package/{src/codemods → codemods}/transforms/v0.0.8/__tests__/rename-endslot-to-endcontent.test.mjs
RENAMED
|
File without changes
|
|
File without changes
|
/package/{src/codemods → codemods}/transforms/v0.1.0/__tests__/migrate-xds-css-surfaces.test.mjs
RENAMED
|
File without changes
|
/package/{src/codemods → codemods}/transforms/v0.1.0/__tests__/migrate-xds-declare-module.test.mjs
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|