From 6932a9fb0b89f64d59bdabd6cd3ca7b8fb460592 Mon Sep 17 00:00:00 2001 From: Reid Barber Date: Wed, 14 Aug 2024 23:00:17 -0500 Subject: [PATCH] docs: S2 migration docs and codemod setup (#6828) * initialize migration docs * more docs for Item updates * move upgrade-cli to codemods package * improve rendered diffs * setup codemod entry * update yarn.lock * fix component index path resolving * update package.json * update yarn.lock * move to src * update component index path * update lock file * fix ts * update command in docs * fix --components option for providing a subset of components to upgrade * update docs to not collapse manual guide * update index to use parseArgs and pass args into codemod functions * just rely on require.resolve to get S2 index path * remove commander dep * move use-monopackages codemod into new package * update @react-spectrum/s2 dep * update yarn.lock * fix types and update use-monopackages readme * try removing main from package.json * use path module * use moduleResolution in tsconfig * remove module.exports * try renaming transformer functions * Revert "try renaming transformer functions" This reverts commit b2177f7621a8067a2539b8bdcc13ab717da38e42. * try targets: main: false in package.json * move to packages/dev * update docs * add anchor links * update yarn.lock * fix anchor links in built docs --------- Co-authored-by: Robert Snow --- .storybook-s2/docs/Migrating.jsx | 779 ++++++++++++++++++ .storybook-s2/docs/Migrating.mdx | 4 + .storybook-s2/docs/typography.js | 37 +- .../upgrade-cli => dev/codemods}/package.json | 14 +- packages/dev/codemods/src/index.ts | 100 +++ .../codemods/src/s1-to-s2}/README.md | 2 +- .../codemods/src/s1-to-s2}/UPGRADE.md | 3 +- .../__snapshots__/actionbutton.test.ts.snap | 0 .../__snapshots__/actionmenu.test.ts.snap | 0 .../__snapshots__/avatar.test.ts.snap | 0 .../__snapshots__/badge.test.ts.snap | 0 .../__snapshots__/breadcrumbs.test.ts.snap | 0 .../__snapshots__/button.test.ts.snap | 0 .../__snapshots__/buttongroup.test.ts.snap | 0 .../__snapshots__/calendar.test.ts.snap | 0 .../__snapshots__/checkbox.test.ts.snap | 0 .../__snapshots__/checkboxgroup.test.ts.snap | 0 .../__snapshots__/colorarea.test.ts.snap | 0 .../__snapshots__/colorfield.test.ts.snap | 0 .../__snapshots__/colorslider.test.ts.snap | 0 .../__snapshots__/colorswatch.test.ts.snap | 0 .../__snapshots__/colorwheel.test.ts.snap | 0 .../__snapshots__/combobox.test.ts.snap | 4 +- .../__snapshots__/contextualhelp.test.ts.snap | 0 .../__snapshots__/datefield.test.ts.snap | 0 .../__snapshots__/datepicker.test.ts.snap | 0 .../daterangepicker.test.ts.snap | 0 .../__snapshots__/dialog.test.ts.snap | 0 .../dialogcontainer.test.ts.snap | 0 .../__snapshots__/divider.test.ts.snap | 0 .../__snapshots__/dropzone.test.ts.snap | 0 .../__tests__/__snapshots__/form.test.ts.snap | 0 .../__tests__/__snapshots__/icon.test.ts.snap | 0 .../illustratedmessage.test.ts.snap | 0 .../__snapshots__/imports.test.ts.snap | 0 .../__snapshots__/inlinealert.test.ts.snap | 0 .../__tests__/__snapshots__/link.test.ts.snap | 0 .../__snapshots__/listbox.test.ts.snap | 0 .../__tests__/__snapshots__/menu.test.ts.snap | 0 .../__snapshots__/meter.test.ts.snap | 0 .../multi-collection.test.ts.snap | 0 .../__snapshots__/picker.test.ts.snap | 0 .../__snapshots__/progressbar.test.ts.snap | 0 .../__snapshots__/progresscircle.test.ts.snap | 0 .../__snapshots__/provider.test.ts.snap | 0 .../__snapshots__/radio.test.ts.snap | 0 .../__snapshots__/radiogroup.test.ts.snap | 0 .../__snapshots__/rangeslider.test.ts.snap | 0 .../__snapshots__/searchfield.test.ts.snap | 0 .../__snapshots__/slider.test.ts.snap | 0 .../__snapshots__/statuslight.test.ts.snap | 0 .../__snapshots__/styleProps.test.ts.snap | 0 .../__snapshots__/subset.test.ts.snap | 33 + .../__snapshots__/switch.test.ts.snap | 0 .../__snapshots__/table.test.ts.snap | 0 .../__tests__/__snapshots__/tabs.test.ts.snap | 0 .../__snapshots__/taggroup.test.ts.snap | 0 .../__snapshots__/textarea.test.ts.snap | 0 .../__snapshots__/textfield.test.ts.snap | 0 .../__snapshots__/timefield.test.ts.snap | 0 .../__snapshots__/togglebutton.test.ts.snap | 0 .../__snapshots__/toolbar.test.ts.snap | 0 .../__snapshots__/tooltip.test.ts.snap | 0 .../s1-to-s2}/__tests__/actionbutton.test.ts | 0 .../s1-to-s2}/__tests__/actionmenu.test.ts | 0 .../src/s1-to-s2}/__tests__/avatar.test.ts | 0 .../src/s1-to-s2}/__tests__/badge.test.ts | 0 .../s1-to-s2}/__tests__/breadcrumbs.test.ts | 0 .../src/s1-to-s2}/__tests__/button.test.ts | 0 .../s1-to-s2}/__tests__/buttongroup.test.ts | 0 .../src/s1-to-s2}/__tests__/calendar.test.ts | 0 .../src/s1-to-s2}/__tests__/checkbox.test.ts | 0 .../s1-to-s2}/__tests__/checkboxgroup.test.ts | 0 .../src/s1-to-s2}/__tests__/colorarea.test.ts | 0 .../s1-to-s2}/__tests__/colorfield.test.ts | 0 .../s1-to-s2}/__tests__/colorslider.test.ts | 0 .../s1-to-s2}/__tests__/colorswatch.test.ts | 0 .../s1-to-s2}/__tests__/colorwheel.test.ts | 0 .../src/s1-to-s2}/__tests__/combobox.test.ts | 4 +- .../__tests__/contextualhelp.test.ts | 0 .../src/s1-to-s2}/__tests__/datefield.test.ts | 0 .../s1-to-s2}/__tests__/datepicker.test.ts | 0 .../__tests__/daterangepicker.test.ts | 0 .../src/s1-to-s2}/__tests__/dialog.test.ts | 0 .../__tests__/dialogcontainer.test.ts | 0 .../src/s1-to-s2}/__tests__/divider.test.ts | 0 .../src/s1-to-s2}/__tests__/dropzone.test.ts | 0 .../src/s1-to-s2}/__tests__/form.test.ts | 0 .../src/s1-to-s2}/__tests__/icon.test.ts | 0 .../__tests__/illustratedmessage.test.ts | 0 .../src/s1-to-s2}/__tests__/imports.test.ts | 0 .../s1-to-s2}/__tests__/inlinealert.test.ts | 0 .../src/s1-to-s2}/__tests__/link.test.ts | 0 .../src/s1-to-s2}/__tests__/listbox.test.ts | 0 .../src/s1-to-s2}/__tests__/menu.test.ts | 0 .../src/s1-to-s2}/__tests__/meter.test.ts | 0 .../__tests__/multi-collection.test.ts | 0 .../src/s1-to-s2}/__tests__/picker.test.ts | 0 .../s1-to-s2}/__tests__/progressbar.test.ts | 0 .../__tests__/progresscircle.test.ts | 0 .../src/s1-to-s2}/__tests__/provider.test.ts | 0 .../src/s1-to-s2}/__tests__/radio.test.ts | 0 .../s1-to-s2}/__tests__/radiogroup.test.ts | 0 .../s1-to-s2}/__tests__/rangeslider.test.ts | 0 .../s1-to-s2}/__tests__/searchfield.test.ts | 0 .../src/s1-to-s2}/__tests__/slider.test.ts | 0 .../s1-to-s2}/__tests__/statuslight.test.ts | 0 .../s1-to-s2}/__tests__/styleProps.test.ts | 0 .../src/s1-to-s2/__tests__/subset.test.ts | 37 + .../src/s1-to-s2}/__tests__/switch.test.ts | 0 .../src/s1-to-s2}/__tests__/table.test.ts | 0 .../src/s1-to-s2}/__tests__/tabs.test.ts | 0 .../src/s1-to-s2}/__tests__/taggroup.test.ts | 0 .../src/s1-to-s2}/__tests__/textarea.test.ts | 0 .../src/s1-to-s2}/__tests__/textfield.test.ts | 0 .../src/s1-to-s2}/__tests__/timefield.test.ts | 0 .../s1-to-s2}/__tests__/togglebutton.test.ts | 0 .../src/s1-to-s2}/__tests__/toolbar.test.ts | 0 .../src/s1-to-s2}/__tests__/tooltip.test.ts | 0 .../s1-to-s2}/src/__mocks__/getComponents.ts | 0 .../src/s1-to-s2}/src/codemods/button.ts | 0 .../src/s1-to-s2}/src/codemods/changes.ts | 0 .../src/s1-to-s2}/src/codemods/codemod.ts | 0 .../src/s1-to-s2}/src/codemods/colors.ts | 0 .../src/s1-to-s2}/src/codemods/dialog.ts | 0 .../src/s1-to-s2}/src/codemods/dimensions.ts | 0 .../src/s1-to-s2}/src/codemods/styleProps.ts | 2 +- .../src/s1-to-s2}/src/codemods/transforms.ts | 0 .../src/s1-to-s2}/src/codemods/unsafeStyle.ts | 0 .../src/s1-to-s2}/src/codemods/utils.ts | 0 .../src/s1-to-s2}/src/getComponents.ts | 10 +- .../codemods/src/s1-to-s2}/src/index.ts | 64 +- .../codemods/src/s1-to-s2}/src/transform.ts | 12 +- .../s1-to-s2}/src/utils/addMacroSupport.ts | 0 .../src/s1-to-s2}/src/utils/installPackage.ts | 0 .../src/s1-to-s2}/src/utils/logger.ts | 0 .../s1-to-s2}/src/utils/waitForKeypress.ts | 0 .../codemods/src/use-monopackages/README.md | 25 + .../src/use-monopackages/src/codemod.ts | 44 +- .../src/use-monopackages/src/index.ts | 14 + packages/dev/codemods/tsconfig.json | 12 + scripts/lint-packages.js | 2 +- tsconfig.json | 2 +- yarn.config.cjs | 28 +- yarn.lock | 59 +- 145 files changed, 1128 insertions(+), 163 deletions(-) create mode 100644 .storybook-s2/docs/Migrating.jsx create mode 100644 .storybook-s2/docs/Migrating.mdx rename packages/{@react-spectrum/upgrade-cli => dev/codemods}/package.json (81%) create mode 100644 packages/dev/codemods/src/index.ts rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/README.md (83%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/UPGRADE.md (99%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/__snapshots__/actionbutton.test.ts.snap (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/__snapshots__/actionmenu.test.ts.snap (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/__snapshots__/avatar.test.ts.snap (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/__snapshots__/badge.test.ts.snap (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/__snapshots__/breadcrumbs.test.ts.snap (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/__snapshots__/button.test.ts.snap (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/__snapshots__/buttongroup.test.ts.snap (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/__snapshots__/calendar.test.ts.snap (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/__snapshots__/checkbox.test.ts.snap (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/__snapshots__/checkboxgroup.test.ts.snap (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/__snapshots__/colorarea.test.ts.snap (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/__snapshots__/colorfield.test.ts.snap (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/__snapshots__/colorslider.test.ts.snap (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/__snapshots__/colorswatch.test.ts.snap (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/__snapshots__/colorwheel.test.ts.snap (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/__snapshots__/combobox.test.ts.snap (98%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/__snapshots__/contextualhelp.test.ts.snap (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/__snapshots__/datefield.test.ts.snap (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/__snapshots__/datepicker.test.ts.snap (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/__snapshots__/daterangepicker.test.ts.snap (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/__snapshots__/dialog.test.ts.snap (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/__snapshots__/dialogcontainer.test.ts.snap (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/__snapshots__/divider.test.ts.snap (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/__snapshots__/dropzone.test.ts.snap (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/__snapshots__/form.test.ts.snap (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/__snapshots__/icon.test.ts.snap (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/__snapshots__/illustratedmessage.test.ts.snap (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/__snapshots__/imports.test.ts.snap (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/__snapshots__/inlinealert.test.ts.snap (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/__snapshots__/link.test.ts.snap (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/__snapshots__/listbox.test.ts.snap (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/__snapshots__/menu.test.ts.snap (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/__snapshots__/meter.test.ts.snap (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/__snapshots__/multi-collection.test.ts.snap (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/__snapshots__/picker.test.ts.snap (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/__snapshots__/progressbar.test.ts.snap (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/__snapshots__/progresscircle.test.ts.snap (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/__snapshots__/provider.test.ts.snap (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/__snapshots__/radio.test.ts.snap (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/__snapshots__/radiogroup.test.ts.snap (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/__snapshots__/rangeslider.test.ts.snap (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/__snapshots__/searchfield.test.ts.snap (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/__snapshots__/slider.test.ts.snap (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/__snapshots__/statuslight.test.ts.snap (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/__snapshots__/styleProps.test.ts.snap (100%) create mode 100644 packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/subset.test.ts.snap rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/__snapshots__/switch.test.ts.snap (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/__snapshots__/table.test.ts.snap (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/__snapshots__/tabs.test.ts.snap (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/__snapshots__/taggroup.test.ts.snap (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/__snapshots__/textarea.test.ts.snap (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/__snapshots__/textfield.test.ts.snap (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/__snapshots__/timefield.test.ts.snap (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/__snapshots__/togglebutton.test.ts.snap (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/__snapshots__/toolbar.test.ts.snap (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/__snapshots__/tooltip.test.ts.snap (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/actionbutton.test.ts (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/actionmenu.test.ts (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/avatar.test.ts (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/badge.test.ts (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/breadcrumbs.test.ts (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/button.test.ts (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/buttongroup.test.ts (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/calendar.test.ts (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/checkbox.test.ts (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/checkboxgroup.test.ts (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/colorarea.test.ts (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/colorfield.test.ts (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/colorslider.test.ts (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/colorswatch.test.ts (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/colorwheel.test.ts (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/combobox.test.ts (98%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/contextualhelp.test.ts (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/datefield.test.ts (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/datepicker.test.ts (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/daterangepicker.test.ts (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/dialog.test.ts (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/dialogcontainer.test.ts (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/divider.test.ts (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/dropzone.test.ts (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/form.test.ts (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/icon.test.ts (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/illustratedmessage.test.ts (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/imports.test.ts (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/inlinealert.test.ts (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/link.test.ts (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/listbox.test.ts (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/menu.test.ts (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/meter.test.ts (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/multi-collection.test.ts (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/picker.test.ts (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/progressbar.test.ts (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/progresscircle.test.ts (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/provider.test.ts (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/radio.test.ts (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/radiogroup.test.ts (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/rangeslider.test.ts (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/searchfield.test.ts (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/slider.test.ts (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/statuslight.test.ts (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/styleProps.test.ts (100%) create mode 100644 packages/dev/codemods/src/s1-to-s2/__tests__/subset.test.ts rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/switch.test.ts (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/table.test.ts (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/tabs.test.ts (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/taggroup.test.ts (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/textarea.test.ts (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/textfield.test.ts (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/timefield.test.ts (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/togglebutton.test.ts (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/toolbar.test.ts (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/__tests__/tooltip.test.ts (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/src/__mocks__/getComponents.ts (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/src/codemods/button.ts (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/src/codemods/changes.ts (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/src/codemods/codemod.ts (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/src/codemods/colors.ts (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/src/codemods/dialog.ts (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/src/codemods/dimensions.ts (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/src/codemods/styleProps.ts (99%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/src/codemods/transforms.ts (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/src/codemods/unsafeStyle.ts (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/src/codemods/utils.ts (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/src/getComponents.ts (59%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/src/index.ts (73%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/src/transform.ts (57%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/src/utils/addMacroSupport.ts (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/src/utils/installPackage.ts (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/src/utils/logger.ts (100%) rename packages/{@react-spectrum/upgrade-cli => dev/codemods/src/s1-to-s2}/src/utils/waitForKeypress.ts (100%) create mode 100644 packages/dev/codemods/src/use-monopackages/README.md rename codemods/use-monopackages/use-monopackages.ts => packages/dev/codemods/src/use-monopackages/src/codemod.ts (79%) create mode 100644 packages/dev/codemods/src/use-monopackages/src/index.ts create mode 100644 packages/dev/codemods/tsconfig.json diff --git a/.storybook-s2/docs/Migrating.jsx b/.storybook-s2/docs/Migrating.jsx new file mode 100644 index 00000000000..a695e930146 --- /dev/null +++ b/.storybook-s2/docs/Migrating.jsx @@ -0,0 +1,779 @@ +import { style } from '../../packages/@react-spectrum/s2/style/spectrum-theme' with {type: 'macro'}; +import {Link} from '@react-spectrum/s2'; +import {P, Code, Pre, H3, H2} from './typography'; + +export function Migrating() { + return ( +
+
+

+ Migrating to Spectrum 2 +

+

An automated upgrade assistant is available by running the following command in the project you want to upgrade:

+
npx @react-spectrum/codemods s1-to-s2
+ +

For cases that the upgrade assistant doesn't handle automatically or where you'd rather upgrade some components manually, use the guide below.

+ +

Note that [PENDING] indicates that future changes will occur before the final release, and the current solution should be considered temporary.

+ +

Components

+

All components

+
    +
  • Update imports to use the @react-spectrum/s2 package instead of @adobe/react-spectrum or individual packages like @react-spectrum/button
  • +
  • Update style props to use the style macro instead. See the 'Style props' section below
  • +
+ +

ActionButton

+

No updates needed.

+ +

ActionMenu

+
    +
  • [PENDING] Comment out closeOnSelect (it has not been implemented yet)
  • +
  • [PENDING] Comment out trigger (it has not been implemented yet)
  • +
  • Update Item to be a MenuItem
  • +
+ +

Avatar

+
    +
  • [PENDING] Comment out isDisabled (it has not been implemented yet)
  • +
  • Remove size and instead provide a size via the style macro (i.e. {`styles={style({size: 20})}`})
  • +
+ +

Breadcrumbs

+
    +
  • [PENDING] Comment out showRoot (it has not been implemented yet)
  • +
  • [PENDING] Comment out isMultiline (it has not been implemented yet)
  • +
  • [PENDING] Comment out autoFocusCurrent (it has not been implemented yet)
  • +
  • Remove size="S" (Small is no longer a supported size in Spectrum 2)
  • +
  • Update Item to be a Breadcrumb
  • +
+ +

Button

+
    +
  • Change variant=“cta” to variant="accent"
  • +
  • Change variant=“overBackground” to variant=“primary” staticColor=“white”
  • +
  • Change style to fillStyle
  • +
  • [PENDING] Comment out isPending (it has not been implemented yet)
  • +
  • Remove isQuiet (it is no longer supported in Spectrum 2)
  • +
  • If href is present, the Button should be converted to a LinkButton
  • +
  • Remove elementType (it is no longer supported in Spectrum 2)
  • +
+ +

ButtonGroup

+

No updates needed.

+ +

Checkbox

+

No updates needed.

+ +

CheckboxGroup

+
    +
  • Remove showErrorIcon (it has been removed due to accessibility issues)
  • +
+ +

ColorArea

+
    +
  • Remove size and instead provide a size via the style macro (i.e. {`styles={style({size: 20})}`})
  • +
+ +

ColorField

+
    +
  • Remove isQuiet (it is no longer supported in Spectrum 2)
  • +
  • Remove placeholder (it has been removed due to accessibility issues)
  • +
  • Change validationState=“invalid” to isInvalid
  • +
  • Remove validationState=“valid” (it is no longer supported in Spectrum 2)
  • +
+ +

ColorSlider

+
    +
  • Remove showValueLabel (it has been removed due to accessibility issues)
  • +
+ +

ColorSwatch

+

No updates needed.

+ +

ColorWheel

+
    +
  • Remove size and instead provide a size via the style macro (i.e. {`styles={style({size: 20})}`})
  • +
+ +

ComboBox

+
    +
  • Change menuWidth value from a DimensionValue to a pixel value
  • +
  • Remove isQuiet (it is no longer supported in Spectrum 2)
  • +
  • [PENDING] Comment out loadingState (it has not been implemented yet)
  • +
  • Remove placeholder (it is no longer supported in Spectrum 2)
  • +
  • Change validationState=“invalid” to isInvalid
  • +
  • Remove validationState=“valid” (it is no longer supported in Spectrum 2)
  • +
  • [PENDING] Comment out onLoadMore (it has not been implemented yet)
  • +
  • Update Item to be a ComboBoxItem
  • +
+ +

Dialog

+
    +
  • Update children to move render props from being the second child of DialogTrigger to being a child of Dialog
  • +
  • Remove onDismiss and use onOpenChange on the DialogTrigger, or onDismiss on the DialogContainer instead
  • +
+ +

DialogTrigger

+
    +
  • [PENDING] Comment out type=“tray” (Tray has not been implemented yet)
  • +
  • [PENDING] Comment out mobileType=“tray” (Tray has not been implemented yet)
  • +
  • Remove targetRef (it is no longer supported in Spectrum 2)
  • +
  • Update children to remove render props usage, and note that the close function was moved from DialogTrigger to Dialog
  • +
+ +

Divider

+
    +
  • Remove Divider component if within a Dialog (Updated design for Dialog in Spectrum 2)
  • +
+ +

Flex

+
    +
  • Update Flex to be a div and apply flex styles using the style macro (i.e. {`
    `})
  • +
+ +

Form

+
    +
  • Remove isQuiet (it is no longer supported in Spectrum 2)
  • +
  • Remove isReadOnly (it is no longer supported in Spectrum 2)
  • +
  • Remove validationState (it is no longer supported in Spectrum 2)
  • +
  • Remove validationBehavior (it is no longer supported in Spectrum 2)
  • +
+ +

Grid

+
    +
  • Update Grid to be a div and apply grid styles using the style macro (i.e. {`
    `})
  • +
+ +

IllustratedMessage

+

No updates needed.

+ +

InlineAlert

+
    +
  • Change variant=“info” to variant=“informative”
  • +
+ +

Item

+
    +
  • If within Menu: Update Item to be a MenuItem
  • +
  • If within ActionMenu: Update Item to be a MenuItem
  • +
  • If within TagGroup: Update Item to be a Tag
  • +
  • If within Breadcrumbs: Update Item to be a Breadcrumb
  • +
  • If within Picker: Update Item to be a PickerItem
  • +
  • If within ComboBox: Update Item to be a ComboBoxItem
  • +
  • If within ListBox: Update Item to be a ListBoxItem
  • +
  • If within TabList: Update Item to be a Tab
  • +
  • If within TabPanels: Update Item to be a TabPanel and remove surrounding TabPanels
  • +
  • Update key to be id (and keep key if rendered inside array.map)
  • +
+ +

Link

+
    +
  • Change variant=“overBackground” to staticColor=“white”
  • +
+ +

ListBox

+
    +
  • Update Item to be a ListBoxItem
  • +
+ +

Menu

+
    +
  • Update Item to be a MenuItem
  • +
+ +

MenuTrigger

+
    +
  • [PENDING] Comment out closeOnSelect (it has not been implemented yet)
  • +
+ +

Picker

+
    +
  • Change menuWidth value from a DimensionValue to a pixel value
  • +
  • Remove isQuiet (it is no longer supported in Spectrum 2)
  • +
  • Change validationState=“invalid” to isInvalid
  • +
  • Remove validationState=“valid” (it is no longer supported in Spectrum 2)
  • +
  • [PENDING] Comment out isLoading (it has not been implemented yet)
  • +
  • [PENDING] Comment out onLoadMore (it has not been implemented yet)
  • +
  • Update Item to be a PickerItem
  • +
+ +

ProgressBar

+
    +
  • Change variant=“overBackground” to staticColor=“white”
  • +
  • [PENDING] Comment out labelPosition (it has not been implemented yet)
  • +
  • [PENDING] Comment out showValueLabel (it has not been implemented yet)
  • +
+ +

ProgressCircle

+
    +
  • Change variant=“overBackground” to staticColor=“white”
  • +
+ +

Radio

+

No updates needed.

+ +

RadioGroup

+
    +
  • Change validationState=“invalid” to isInvalid
  • +
  • Remove validationState=“valid” (it is no longer supported in Spectrum 2)
  • +
  • Remove showErrorIcon (it has been removed due to accessibility issues)
  • +
+ +

RangeSlider

+
    +
  • Remove showValueLabel (it has been removed due to accessibility issues)
  • +
  • [PENDING] Comment out getValueLabel (it has not been implemented yet)
  • +
  • [PENDING] Comment out orientation (it has not been implemented yet)
  • +
+ +

SearchField

+
    +
  • Remove placeholder (it has been removed due to accessibility issues)
  • +
  • [PENDING] Comment out icon (it has not been implemented yet)
  • +
  • Remove isQuiet (it is no longer supported in Spectrum 2)
  • +
  • Change validationState=“invalid” to isInvalid
  • +
  • Remove validationState=“valid” (it is no longer supported in Spectrum 2)
  • +
+ +

Section

+
    +
  • If within Menu: Update Section to be a MenuSection
  • +
  • If within Picker: Update Section to be a PickerSection
  • +
+ +

Slider

+
    +
  • Remove isFilled (Slider is always filled in Spectrum 2)
  • +
  • Remove trackGradient (Not supported in S2 design)
  • +
  • Remove showValueLabel (it has been removed due to accessibility issues)
  • +
  • [PENDING] Comment out getValueLabel (it has not been implemented yet)
  • +
  • [PENDING] Comment out orientation (it has not been implemented yet)
  • +
+ +

StatusLight

+
    +
  • Remove isDisabled (it is no longer supported in Spectrum 2)
  • +
  • Change variant=“info” to variant="informative"
  • +
+ +

SubmenuTrigger

+

No updates needed.

+ +

Switch

+

No updates needed.

+ +

Tabs

+
    +
  • Inside TabList: Update Item to be Tab
  • +
  • Inside TabPanels: Update Item to be a TabPanel and remove the surrounding TabPanels
  • +
+ +

TagGroup

+
    +
  • [PENDING] Comment out actionLabel (it has not been implemented yet)
  • +
  • [PENDING] Comment out onAction (it has not been implemented yet)
  • +
  • [PENDING] Comment out maxRows (it has not been implemented yet)
  • +
  • [PENDING] Comment out errorMessage (it has not been implemented yet)
  • +
  • [PENDING] Comment out isInvalid (it has not been implemented yet)
  • +
  • [PENDING] Comment out validationState (isInvalid should be used when it becomes available)
  • +
  • Update Item to be Tag
  • +
+ +

TextArea

+
    +
  • [PENDING] Comment out icon (it has not been implemented yet)
  • +
  • Remove isQuiet (it is no longer supported in Spectrum 2)
  • +
  • Remove placeholder (it has been removed due to accessibility issues)
  • +
  • Change validationState=“invalid” to isInvalid
  • +
  • Remove validationState=“valid” (it is no longer supported in Spectrum 2)
  • +
+ +

TextField

+
    +
  • [PENDING] Comment out icon (it has not been implemented yet)
  • +
  • Remove isQuiet (it is no longer supported in Spectrum 2)
  • +
  • Remove placeholder (it has been removed due to accessibility issues)
  • +
  • Change validationState=“invalid” to isInvalid
  • +
  • Remove validationState=“valid” (it is no longer supported in Spectrum 2)
  • +
+ +

ToggleButton

+

No updates needed.

+ +

Tooltip

+
    +
  • Remove variant (it is no longer supported in Spectrum 2)
  • +
  • Remove placement and add to the parent TooltipTrigger instead
  • +
  • Remove showIcon (it is no longer supported in Spectrum 2)
  • +
  • Remove isOpen and add to the parent TooltipTrigger instead
  • +
+ +

TooltipTrigger

+
    +
  • Update placement prop to be have one value (i.e. Update placement="bottom left" to be placement=“bottom”)
  • +
+ +

View

+
    +
  • Update View to be a div and apply styles using the style macro
  • +
+ +

Style props

+

React Spectrum v3 supported a limited set of style props for layout and positioning using Spectrum-defined values. Usage of these should be updated to instead use the style macro.

+

Example:

+
+          
{`- import {ActionButton} from '@adobe/react-spectrum';`}
+
{`+ import {ActionButton} from '@react-spectrum/s2';`}
+
{`+ import {style} from '@react-spectrum/s2/style' with {type: 'macro'};`}
+
{'\n'}
+
{`- `}
+
{`+ `}
+
{` Edit`}
+
{` `}
+
+ +

Border width

+

Affected style props: borderWidth, borderStartWidth, borderEndWidth, borderTopWidth, borderBottomWidth, borderXWidth, borderYWidth.

+

Example:

+
+          
{`- `}
+
{`+
`}
+
+

Border widths should be updated to use pixel values. Use the following mappings:

+ + + + + + + + + + + + + + + + + + + + + + + + + +
Spectrum 1Spectrum 2
'none'0
'thin'1
'thick'2
'thicker'4
'thickest''[8px]'
+ +

Border radius

+

Affected style props: borderRadius, borderTopStartRadius, borderTopEndRadius, borderBottomStartRadius, borderBottomEndRadius.

+

Example:

+
+          
{`- `}
+
{`+
`}
+
+

Border radius values should be updated to use pixel values. Use the following mappings:

+ + + + + + + + + + + + + + + + + + + + + + + + + +
Spectrum 1Spectrum 2
'xsmall''[1px]'
'small''sm'
'regular''default'
'medium''lg'
'large''xl'
+ +

Dimension values

+

Affected style props: width, minWidth, maxWidth, height, minHeight, maxHeight, margin, marginStart, marginEnd, marginTop, marginBottom, marginX, marginY, top, bottom, left, right, start, end, flexBasis, gap, columnGap, rowGap, padding, paddingX, paddingY, paddingStart, paddingEnd, paddingTop, paddingBottom.

+

Example:

+
+          
{`- `}
+
{`+ `}
+
{` Edit`}
+
{` `}
+
+

Dimension values should be converted to pixel values. Use the following mappings:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Spectrum 1Spectrum 2
'size-0'0
'size-10'1
'size-25'2
'size-40'3
'size-50'4
'size-65'5
'size-75'6
'size-85'7
'size-100'8
'size-115'9
'size-125'10
'size-130'11
'size-150'12
'size-160'13
'size-175'14
'size-200'16
'size-225'18
'size-250'20
'size-275'22
'size-300'24
'size-325'26
'size-350'28
'size-400'32
'size-450'36
'size-500'40
'size-550'44
'size-600'48
'size-675'54
'size-700'56
'size-800'64
'size-900'72
'size-1000'80
'size-1200'96
'size-1250'100
'size-1600'128
'size-1700'136
'size-2000'160
'size-2400'192
'size-3000'240
'size-3400'272
'size-3600'288
'size-4600'368
'size-5000'400
'size-6000'480
'static-size-0'0
'static-size-10'1
'static-size-25'2
'static-size-40'3
'static-size-50'4
'static-size-65'5
'static-size-100'8
'static-size-115'9
'static-size-125'10
'static-size-130'11
'static-size-150'12
'static-size-160'13
'static-size-175'14
'static-size-200'16
'static-size-225'18
'static-size-250'20
'static-size-300'24
'static-size-400'32
'static-size-450'36
'static-size-500'40
'static-size-550'44
'static-size-600'48
'static-size-700'56
'static-size-800'64
'static-size-900'72
'static-size-1000'80
'static-size-1200'96
'static-size-1700'136
'static-size-2400'192
'static-size-2600'208
'static-size-3400'272
'static-size-3600'288
'static-size-4600'368
'static-size-5000'400
'static-size-6000'480
'single-line-height'32
'single-line-width'192
+ +

Break points

+

Break points previously used in style props can be used in the style macro with updated keys. Use the following mappings:

+ + + + + + + + + + + + + + + + + + + + + +
Spectrum 1Spectrum 2
basedefault
Ssm
Mmd
Llg
+

Example:

+
+          
{`- `}
+
{`+
`}
+
+
+
+ ); +} diff --git a/.storybook-s2/docs/Migrating.mdx b/.storybook-s2/docs/Migrating.mdx new file mode 100644 index 00000000000..16fdc003ea0 --- /dev/null +++ b/.storybook-s2/docs/Migrating.mdx @@ -0,0 +1,4 @@ +import {Migrating} from './Migrating.jsx'; +import {H3} from './typography'; + + diff --git a/.storybook-s2/docs/typography.js b/.storybook-s2/docs/typography.js index 64e3f183764..be02b53ebeb 100644 --- a/.storybook-s2/docs/typography.js +++ b/.storybook-s2/docs/typography.js @@ -1,19 +1,48 @@ import { style } from '../../packages/@react-spectrum/s2/style/spectrum-theme' with {type: 'macro'}; import {Link} from '@react-spectrum/s2'; +import {useFocusRing, useHover} from 'react-aria'; + +function AnchorLink({id, isHovered}) { + let { isFocusVisible, focusProps } = useFocusRing({within: true}); + const url = `${location.origin}${location.pathname.replace('iframe', 'index')}${location.search.replace('viewMode=docs&id=', 'path=/docs/')}#${id}`; + return ( + + # + + ); +} export function H2({children}) { let id = anchorId(children); - return

{children}

+ let {hoverProps, isHovered} = useHover({}); + return ( +

+ {children} + +

+ ) } export function H3({children}) { let id = anchorId(children); - return

{children}

+ let {hoverProps, isHovered} = useHover({}); + return ( +

+ {children} + +

+ ); } export function H4({children}) { let id = anchorId(children); - return

{children}

+ let {hoverProps, isHovered} = useHover({}); + return ( +

+ {children} + +

+ ); } export function P({children}) { @@ -21,7 +50,7 @@ export function P({children}) { } export function Code({children}) { - return {children}; + return {children}; } export function Strong({children}) { diff --git a/packages/@react-spectrum/upgrade-cli/package.json b/packages/dev/codemods/package.json similarity index 81% rename from packages/@react-spectrum/upgrade-cli/package.json rename to packages/dev/codemods/package.json index e0a08448450..a15f67aa76c 100644 --- a/packages/@react-spectrum/upgrade-cli/package.json +++ b/packages/dev/codemods/package.json @@ -1,14 +1,16 @@ { - "name": "@react-spectrum/upgrade-cli", + "name": "@react-spectrum/codemods", "version": "0.0.1", "private": true, - "source": "src/index.ts", "main": "dist/index.js", - "bin": { - "upgrade-react-spectrum": "./dist/index.js" + "source": "src/index.ts", + "bin": "dist/index.js", + "targets": { + "main": false }, "scripts": { - "start": "node --loader=ts-node/esm src/index.ts" + "build": "tsc", + "prepublishOnly": "yarn build" }, "files": [ "dist" @@ -23,12 +25,12 @@ "@babel/parser": "^7.24.5", "@babel/traverse": "^7.24.5", "@babel/types": "^7.24.5", + "@react-spectrum/s2": "^0.2.0", "@react-types/shared": "^3.24.0", "@types/node": "^20", "boxen": "^5.1.2", "build": "^0.1.4", "chalk": "^4.0.0", - "commander": "^12.0.0", "execa": "^5.1.1", "jscodeshift": "^0.15.2", "ts-node": "^10.9.2", diff --git a/packages/dev/codemods/src/index.ts b/packages/dev/codemods/src/index.ts new file mode 100644 index 00000000000..f5397efbc2e --- /dev/null +++ b/packages/dev/codemods/src/index.ts @@ -0,0 +1,100 @@ +const {parseArgs} = require('node:util'); +import {s1_to_s2} from './s1-to-s2/src'; +import {use_monopackages} from './use-monopackages/src'; + +interface JSCodeshiftOptions { + /** + * The parser for jscodeshift to use for parsing the source files: https://github.com/facebook/jscodeshift?tab=readme-ov-file#parser. + * + * @default 'tsx' + */ + parser?: 'babel' | 'babylon' | 'flow' | 'ts' |' tsx', + /** + * A glob pattern of files to ignore: https://github.com/facebook/jscodeshift?tab=readme-ov-file#ignoring-files-and-directories. + * + * @default '*\*\/node_modules/*\*\' + */ + ignorePattern?: string, + /** + * Whether to run the codemod in dry mode, which will not write any changes to disk. + * + * @default false + */ + dry?: boolean, + /** + * The path to the directory to run the codemod in. + * + * @default '.' + */ + path?: string +} + +export interface S1ToS2CodemodOptions extends JSCodeshiftOptions { + /** + * An optional subset of components to have the s1-to-s2 codemod apply to. + * Provide a comma-separated list of component names. + */ + components?: string +} + +export interface UseMonopackagesCodemodOptions extends JSCodeshiftOptions { + /** + * The packages to apply the use-monopackages codemod to. + */ + packages?: string +} + +const codemods: Record void> = { + 's1-to-s2': s1_to_s2, + 'use-monopackages': use_monopackages +}; + +// https://github.com/facebook/jscodeshift?tab=readme-ov-file#usage-cli +const options = { + 'parser': { + type: 'string' + }, + 'ignore-pattern': { + type: 'string' + }, + 'dry': { + type: 'boolean', + short: 'd' + }, + 'path': { + type: 'string' + }, + 'components': { + type: 'string' + } +}; + +const {values, positionals} = parseArgs({ + options, + allowPositionals: true +}); + +if (positionals.length < 1) { + console.error('Please specify a codemod to run. Available codemods: ', Object.keys(codemods).join(', ')); + process.exit(1); +} + +const codemodName = positionals[0]; +const codemodFunction = codemods[codemodName]; + +if (!codemodFunction) { + console.error(`Unknown codemod: ${codemodName}, available codemods: ${Object.keys(codemods).join(', ')}`); + process.exit(1); +} + +try { + codemodFunction({ + parser: 'tsx', + ignorePattern: '**/node_modules/**', + path: '.', + ...values + }); +} catch (error) { + console.error(`Error running codemod: ${error}`); + process.exit(1); +} diff --git a/packages/@react-spectrum/upgrade-cli/README.md b/packages/dev/codemods/src/s1-to-s2/README.md similarity index 83% rename from packages/@react-spectrum/upgrade-cli/README.md rename to packages/dev/codemods/src/s1-to-s2/README.md index fae0ec4a682..c2db857dd15 100644 --- a/packages/@react-spectrum/upgrade-cli/README.md +++ b/packages/dev/codemods/src/s1-to-s2/README.md @@ -4,7 +4,7 @@ A CLI tool for upgrading React Spectrum components to Spectrum 2. ## Usage -Run `npx @react-spectrum/upgrade-cli` from the directory you want to upgrade. +Run `npx @react-spectrum/codemods s1-to-s2` from the directory you want to upgrade. ### Options diff --git a/packages/@react-spectrum/upgrade-cli/UPGRADE.md b/packages/dev/codemods/src/s1-to-s2/UPGRADE.md similarity index 99% rename from packages/@react-spectrum/upgrade-cli/UPGRADE.md rename to packages/dev/codemods/src/s1-to-s2/UPGRADE.md index aa503d5cc6c..362b916d7bf 100644 --- a/packages/@react-spectrum/upgrade-cli/UPGRADE.md +++ b/packages/dev/codemods/src/s1-to-s2/UPGRADE.md @@ -85,7 +85,6 @@ Note that `[PENDING]` indicates that future changes will occur before the final - Remove `isReadOnly` (it is no longer supported) - Remove `validationState` (it is no longer supported) - Remove `validationBehavior` (it is no longer supported) -- TODO: Clarify/verify the above ## Grid - Update `Grid` to be a `div` and apply grid styles using the style macro @@ -357,8 +356,8 @@ Dimension values should be converted to pixel values. Use the following mappings | `'static-size-0'` | `0` | | `'static-size-10'` | `1` | | `'static-size-25'` | `2` | -| `'static-size-50'` | `4` | | `'static-size-40'` | `3` | +| `'static-size-50'` | `4` | | `'static-size-65'` | `5` | | `'static-size-100'` | `8` | | `'static-size-115'` | `9` | diff --git a/packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/actionbutton.test.ts.snap b/packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/actionbutton.test.ts.snap similarity index 100% rename from packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/actionbutton.test.ts.snap rename to packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/actionbutton.test.ts.snap diff --git a/packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/actionmenu.test.ts.snap b/packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/actionmenu.test.ts.snap similarity index 100% rename from packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/actionmenu.test.ts.snap rename to packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/actionmenu.test.ts.snap diff --git a/packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/avatar.test.ts.snap b/packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/avatar.test.ts.snap similarity index 100% rename from packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/avatar.test.ts.snap rename to packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/avatar.test.ts.snap diff --git a/packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/badge.test.ts.snap b/packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/badge.test.ts.snap similarity index 100% rename from packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/badge.test.ts.snap rename to packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/badge.test.ts.snap diff --git a/packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/breadcrumbs.test.ts.snap b/packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/breadcrumbs.test.ts.snap similarity index 100% rename from packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/breadcrumbs.test.ts.snap rename to packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/breadcrumbs.test.ts.snap diff --git a/packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/button.test.ts.snap b/packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/button.test.ts.snap similarity index 100% rename from packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/button.test.ts.snap rename to packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/button.test.ts.snap diff --git a/packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/buttongroup.test.ts.snap b/packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/buttongroup.test.ts.snap similarity index 100% rename from packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/buttongroup.test.ts.snap rename to packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/buttongroup.test.ts.snap diff --git a/packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/calendar.test.ts.snap b/packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/calendar.test.ts.snap similarity index 100% rename from packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/calendar.test.ts.snap rename to packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/calendar.test.ts.snap diff --git a/packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/checkbox.test.ts.snap b/packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/checkbox.test.ts.snap similarity index 100% rename from packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/checkbox.test.ts.snap rename to packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/checkbox.test.ts.snap diff --git a/packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/checkboxgroup.test.ts.snap b/packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/checkboxgroup.test.ts.snap similarity index 100% rename from packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/checkboxgroup.test.ts.snap rename to packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/checkboxgroup.test.ts.snap diff --git a/packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/colorarea.test.ts.snap b/packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/colorarea.test.ts.snap similarity index 100% rename from packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/colorarea.test.ts.snap rename to packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/colorarea.test.ts.snap diff --git a/packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/colorfield.test.ts.snap b/packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/colorfield.test.ts.snap similarity index 100% rename from packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/colorfield.test.ts.snap rename to packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/colorfield.test.ts.snap diff --git a/packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/colorslider.test.ts.snap b/packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/colorslider.test.ts.snap similarity index 100% rename from packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/colorslider.test.ts.snap rename to packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/colorslider.test.ts.snap diff --git a/packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/colorswatch.test.ts.snap b/packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/colorswatch.test.ts.snap similarity index 100% rename from packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/colorswatch.test.ts.snap rename to packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/colorswatch.test.ts.snap diff --git a/packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/colorwheel.test.ts.snap b/packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/colorwheel.test.ts.snap similarity index 100% rename from packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/colorwheel.test.ts.snap rename to packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/colorwheel.test.ts.snap diff --git a/packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/combobox.test.ts.snap b/packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/combobox.test.ts.snap similarity index 98% rename from packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/combobox.test.ts.snap rename to packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/combobox.test.ts.snap index ad88016c19b..580806b80eb 100644 --- a/packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/combobox.test.ts.snap +++ b/packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/combobox.test.ts.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`Dynamic - Renames Item to ComboboxItem 1`] = ` +exports[`Dynamic - Renames Item to ComboBoxItem 1`] = ` "import { ComboBoxItem, ComboBox } from "@react-spectrum/s2"; import { Item } from '@adobe/react-spectrum'; let options = [ @@ -140,7 +140,7 @@ let props = {menuWidth: 'size-10'}; " `; -exports[`Static - Renames Item to ComboboxItem 1`] = ` +exports[`Static - Renames Item to ComboBoxItem 1`] = ` "import { ComboBoxItem, ComboBox } from "@react-spectrum/s2"; import { Item } from '@adobe/react-spectrum';
diff --git a/packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/contextualhelp.test.ts.snap b/packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/contextualhelp.test.ts.snap similarity index 100% rename from packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/contextualhelp.test.ts.snap rename to packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/contextualhelp.test.ts.snap diff --git a/packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/datefield.test.ts.snap b/packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/datefield.test.ts.snap similarity index 100% rename from packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/datefield.test.ts.snap rename to packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/datefield.test.ts.snap diff --git a/packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/datepicker.test.ts.snap b/packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/datepicker.test.ts.snap similarity index 100% rename from packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/datepicker.test.ts.snap rename to packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/datepicker.test.ts.snap diff --git a/packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/daterangepicker.test.ts.snap b/packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/daterangepicker.test.ts.snap similarity index 100% rename from packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/daterangepicker.test.ts.snap rename to packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/daterangepicker.test.ts.snap diff --git a/packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/dialog.test.ts.snap b/packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/dialog.test.ts.snap similarity index 100% rename from packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/dialog.test.ts.snap rename to packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/dialog.test.ts.snap diff --git a/packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/dialogcontainer.test.ts.snap b/packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/dialogcontainer.test.ts.snap similarity index 100% rename from packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/dialogcontainer.test.ts.snap rename to packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/dialogcontainer.test.ts.snap diff --git a/packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/divider.test.ts.snap b/packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/divider.test.ts.snap similarity index 100% rename from packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/divider.test.ts.snap rename to packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/divider.test.ts.snap diff --git a/packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/dropzone.test.ts.snap b/packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/dropzone.test.ts.snap similarity index 100% rename from packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/dropzone.test.ts.snap rename to packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/dropzone.test.ts.snap diff --git a/packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/form.test.ts.snap b/packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/form.test.ts.snap similarity index 100% rename from packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/form.test.ts.snap rename to packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/form.test.ts.snap diff --git a/packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/icon.test.ts.snap b/packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/icon.test.ts.snap similarity index 100% rename from packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/icon.test.ts.snap rename to packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/icon.test.ts.snap diff --git a/packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/illustratedmessage.test.ts.snap b/packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/illustratedmessage.test.ts.snap similarity index 100% rename from packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/illustratedmessage.test.ts.snap rename to packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/illustratedmessage.test.ts.snap diff --git a/packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/imports.test.ts.snap b/packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/imports.test.ts.snap similarity index 100% rename from packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/imports.test.ts.snap rename to packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/imports.test.ts.snap diff --git a/packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/inlinealert.test.ts.snap b/packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/inlinealert.test.ts.snap similarity index 100% rename from packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/inlinealert.test.ts.snap rename to packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/inlinealert.test.ts.snap diff --git a/packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/link.test.ts.snap b/packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/link.test.ts.snap similarity index 100% rename from packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/link.test.ts.snap rename to packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/link.test.ts.snap diff --git a/packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/listbox.test.ts.snap b/packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/listbox.test.ts.snap similarity index 100% rename from packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/listbox.test.ts.snap rename to packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/listbox.test.ts.snap diff --git a/packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/menu.test.ts.snap b/packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/menu.test.ts.snap similarity index 100% rename from packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/menu.test.ts.snap rename to packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/menu.test.ts.snap diff --git a/packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/meter.test.ts.snap b/packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/meter.test.ts.snap similarity index 100% rename from packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/meter.test.ts.snap rename to packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/meter.test.ts.snap diff --git a/packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/multi-collection.test.ts.snap b/packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/multi-collection.test.ts.snap similarity index 100% rename from packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/multi-collection.test.ts.snap rename to packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/multi-collection.test.ts.snap diff --git a/packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/picker.test.ts.snap b/packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/picker.test.ts.snap similarity index 100% rename from packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/picker.test.ts.snap rename to packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/picker.test.ts.snap diff --git a/packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/progressbar.test.ts.snap b/packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/progressbar.test.ts.snap similarity index 100% rename from packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/progressbar.test.ts.snap rename to packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/progressbar.test.ts.snap diff --git a/packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/progresscircle.test.ts.snap b/packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/progresscircle.test.ts.snap similarity index 100% rename from packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/progresscircle.test.ts.snap rename to packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/progresscircle.test.ts.snap diff --git a/packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/provider.test.ts.snap b/packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/provider.test.ts.snap similarity index 100% rename from packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/provider.test.ts.snap rename to packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/provider.test.ts.snap diff --git a/packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/radio.test.ts.snap b/packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/radio.test.ts.snap similarity index 100% rename from packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/radio.test.ts.snap rename to packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/radio.test.ts.snap diff --git a/packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/radiogroup.test.ts.snap b/packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/radiogroup.test.ts.snap similarity index 100% rename from packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/radiogroup.test.ts.snap rename to packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/radiogroup.test.ts.snap diff --git a/packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/rangeslider.test.ts.snap b/packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/rangeslider.test.ts.snap similarity index 100% rename from packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/rangeslider.test.ts.snap rename to packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/rangeslider.test.ts.snap diff --git a/packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/searchfield.test.ts.snap b/packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/searchfield.test.ts.snap similarity index 100% rename from packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/searchfield.test.ts.snap rename to packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/searchfield.test.ts.snap diff --git a/packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/slider.test.ts.snap b/packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/slider.test.ts.snap similarity index 100% rename from packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/slider.test.ts.snap rename to packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/slider.test.ts.snap diff --git a/packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/statuslight.test.ts.snap b/packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/statuslight.test.ts.snap similarity index 100% rename from packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/statuslight.test.ts.snap rename to packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/statuslight.test.ts.snap diff --git a/packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/styleProps.test.ts.snap b/packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/styleProps.test.ts.snap similarity index 100% rename from packages/@react-spectrum/upgrade-cli/__tests__/__snapshots__/styleProps.test.ts.snap rename to packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/styleProps.test.ts.snap diff --git a/packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/subset.test.ts.snap b/packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/subset.test.ts.snap new file mode 100644 index 00000000000..4d313138b30 --- /dev/null +++ b/packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/subset.test.ts.snap @@ -0,0 +1,33 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Should not update components that are not provided to --components option 1`] = ` +"import {Button, TextArea} from '@adobe/react-spectrum'; + +
+ + +