diff --git a/change/@fluentui-react-switch-45eb6678-84a2-411b-83ba-48b7cdc5a753.json b/change/@fluentui-react-switch-45eb6678-84a2-411b-83ba-48b7cdc5a753.json new file mode 100644 index 0000000000000..59d2ca6ea36b9 --- /dev/null +++ b/change/@fluentui-react-switch-45eb6678-84a2-411b-83ba-48b7cdc5a753.json @@ -0,0 +1,7 @@ +{ + "type": "patch", + "comment": "chore: Migrate to new package structure.", + "packageName": "@fluentui/react-switch", + "email": "tristan.watanabe@gmail.com", + "dependentChangeType": "patch" +} diff --git a/packages/react-components/react-switch/.npmignore b/packages/react-components/react-switch/.npmignore index 52d2a7273a151..f7ce568a6dbf7 100644 --- a/packages/react-components/react-switch/.npmignore +++ b/packages/react-components/react-switch/.npmignore @@ -3,10 +3,11 @@ bundle-size/ config/ coverage/ -e2e/ +docs/ etc/ node_modules/ src/ +stories/ dist/types/ temp/ __fixtures__ @@ -16,7 +17,7 @@ __tests__ *.api.json *.log *.spec.* -*.stories.* +*.cy.* *.test.* *.yml diff --git a/packages/react-components/react-switch/.storybook/main.js b/packages/react-components/react-switch/.storybook/main.js index f57cfd09509e7..26536b61b387f 100644 --- a/packages/react-components/react-switch/.storybook/main.js +++ b/packages/react-components/react-switch/.storybook/main.js @@ -2,7 +2,7 @@ const rootMain = require('../../../../.storybook/main'); module.exports = /** @type {Omit} */ ({ ...rootMain, - stories: [...rootMain.stories, '../src/**/*.stories.mdx', '../src/**/index.stories.@(ts|tsx)'], + stories: [...rootMain.stories, '../stories/**/*.stories.mdx', '../stories/**/index.stories.@(ts|tsx)'], addons: [...rootMain.addons], webpackFinal: (config, options) => { const localConfig = { ...rootMain.webpackFinal(config, options) }; diff --git a/packages/react-components/react-switch/.storybook/tsconfig.json b/packages/react-components/react-switch/.storybook/tsconfig.json index f9f60e1234ed4..ea89218a3d916 100644 --- a/packages/react-components/react-switch/.storybook/tsconfig.json +++ b/packages/react-components/react-switch/.storybook/tsconfig.json @@ -6,5 +6,5 @@ "checkJs": true, "types": ["static-assets", "environment", "storybook__addons"] }, - "include": ["../src/**/*.stories.ts", "../src/**/*.stories.tsx", "*.js"] + "include": ["../stories/**/*.stories.ts", "../stories/**/*.stories.tsx", "*.js"] } diff --git a/packages/react-components/react-switch/MIGRATION.md b/packages/react-components/react-switch/docs/MIGRATION.md similarity index 100% rename from packages/react-components/react-switch/MIGRATION.md rename to packages/react-components/react-switch/docs/MIGRATION.md diff --git a/packages/react-components/react-switch/Spec.md b/packages/react-components/react-switch/docs/Spec.md similarity index 100% rename from packages/react-components/react-switch/Spec.md rename to packages/react-components/react-switch/docs/Spec.md diff --git a/packages/react-components/react-switch/src/components/Switch/Switch.test.tsx b/packages/react-components/react-switch/src/components/Switch/Switch.test.tsx index 3f83e10a21074..44af9ed2daeb7 100644 --- a/packages/react-components/react-switch/src/components/Switch/Switch.test.tsx +++ b/packages/react-components/react-switch/src/components/Switch/Switch.test.tsx @@ -1,7 +1,7 @@ import * as React from 'react'; import { render } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; -import { isConformant } from '../../common/isConformant'; +import { isConformant } from '../../testing/isConformant'; import { Switch } from './Switch'; import type { SwitchOnChangeData } from './Switch.types'; diff --git a/packages/react-components/react-switch/src/components/SwitchField/SwitchField.test.tsx b/packages/react-components/react-switch/src/components/SwitchField/SwitchField.test.tsx index 624e647345aed..e3ab81bfc42d1 100644 --- a/packages/react-components/react-switch/src/components/SwitchField/SwitchField.test.tsx +++ b/packages/react-components/react-switch/src/components/SwitchField/SwitchField.test.tsx @@ -1,4 +1,4 @@ -import { isConformant } from '../../common/isConformant'; +import { isConformant } from '../../testing/isConformant'; import { SwitchField } from './SwitchField'; describe('SwitchField', () => { diff --git a/packages/react-components/react-switch/src/common/isConformant.ts b/packages/react-components/react-switch/src/testing/isConformant.ts similarity index 100% rename from packages/react-components/react-switch/src/common/isConformant.ts rename to packages/react-components/react-switch/src/testing/isConformant.ts diff --git a/packages/react-components/react-switch/src/stories/Switch/SwitchBestPractices.md b/packages/react-components/react-switch/stories/Switch/SwitchBestPractices.md similarity index 100% rename from packages/react-components/react-switch/src/stories/Switch/SwitchBestPractices.md rename to packages/react-components/react-switch/stories/Switch/SwitchBestPractices.md diff --git a/packages/react-components/react-switch/src/stories/Switch/SwitchChecked.stories.tsx b/packages/react-components/react-switch/stories/Switch/SwitchChecked.stories.tsx similarity index 100% rename from packages/react-components/react-switch/src/stories/Switch/SwitchChecked.stories.tsx rename to packages/react-components/react-switch/stories/Switch/SwitchChecked.stories.tsx diff --git a/packages/react-components/react-switch/src/stories/Switch/SwitchDefault.stories.tsx b/packages/react-components/react-switch/stories/Switch/SwitchDefault.stories.tsx similarity index 100% rename from packages/react-components/react-switch/src/stories/Switch/SwitchDefault.stories.tsx rename to packages/react-components/react-switch/stories/Switch/SwitchDefault.stories.tsx diff --git a/packages/react-components/react-switch/src/stories/Switch/SwitchDescription.md b/packages/react-components/react-switch/stories/Switch/SwitchDescription.md similarity index 100% rename from packages/react-components/react-switch/src/stories/Switch/SwitchDescription.md rename to packages/react-components/react-switch/stories/Switch/SwitchDescription.md diff --git a/packages/react-components/react-switch/src/stories/Switch/SwitchDisabled.stories.tsx b/packages/react-components/react-switch/stories/Switch/SwitchDisabled.stories.tsx similarity index 100% rename from packages/react-components/react-switch/src/stories/Switch/SwitchDisabled.stories.tsx rename to packages/react-components/react-switch/stories/Switch/SwitchDisabled.stories.tsx diff --git a/packages/react-components/react-switch/src/stories/Switch/SwitchLabel.stories.tsx b/packages/react-components/react-switch/stories/Switch/SwitchLabel.stories.tsx similarity index 100% rename from packages/react-components/react-switch/src/stories/Switch/SwitchLabel.stories.tsx rename to packages/react-components/react-switch/stories/Switch/SwitchLabel.stories.tsx diff --git a/packages/react-components/react-switch/src/stories/Switch/SwitchLabelWrapping.stories.tsx b/packages/react-components/react-switch/stories/Switch/SwitchLabelWrapping.stories.tsx similarity index 100% rename from packages/react-components/react-switch/src/stories/Switch/SwitchLabelWrapping.stories.tsx rename to packages/react-components/react-switch/stories/Switch/SwitchLabelWrapping.stories.tsx diff --git a/packages/react-components/react-switch/src/stories/Switch/SwitchRequired.stories.tsx b/packages/react-components/react-switch/stories/Switch/SwitchRequired.stories.tsx similarity index 100% rename from packages/react-components/react-switch/src/stories/Switch/SwitchRequired.stories.tsx rename to packages/react-components/react-switch/stories/Switch/SwitchRequired.stories.tsx diff --git a/packages/react-components/react-switch/src/stories/Switch/index.stories.tsx b/packages/react-components/react-switch/stories/Switch/index.stories.tsx similarity index 100% rename from packages/react-components/react-switch/src/stories/Switch/index.stories.tsx rename to packages/react-components/react-switch/stories/Switch/index.stories.tsx diff --git a/packages/react-components/react-switch/src/stories/SwitchField/SwitchFieldDefault.stories.tsx b/packages/react-components/react-switch/stories/SwitchField/SwitchFieldDefault.stories.tsx similarity index 100% rename from packages/react-components/react-switch/src/stories/SwitchField/SwitchFieldDefault.stories.tsx rename to packages/react-components/react-switch/stories/SwitchField/SwitchFieldDefault.stories.tsx diff --git a/packages/react-components/react-switch/src/stories/SwitchField/SwitchFieldDescription.md b/packages/react-components/react-switch/stories/SwitchField/SwitchFieldDescription.md similarity index 100% rename from packages/react-components/react-switch/src/stories/SwitchField/SwitchFieldDescription.md rename to packages/react-components/react-switch/stories/SwitchField/SwitchFieldDescription.md diff --git a/packages/react-components/react-switch/src/stories/SwitchField/index.stories.tsx b/packages/react-components/react-switch/stories/SwitchField/index.stories.tsx similarity index 100% rename from packages/react-components/react-switch/src/stories/SwitchField/index.stories.tsx rename to packages/react-components/react-switch/stories/SwitchField/index.stories.tsx diff --git a/packages/react-components/react-switch/tsconfig.lib.json b/packages/react-components/react-switch/tsconfig.lib.json index 7f94e04299ed8..6f90cf95c005b 100644 --- a/packages/react-components/react-switch/tsconfig.lib.json +++ b/packages/react-components/react-switch/tsconfig.lib.json @@ -10,7 +10,7 @@ "types": ["static-assets", "environment"] }, "exclude": [ - "./src/common/**", + "./src/testing/**", "**/*.spec.ts", "**/*.spec.tsx", "**/*.test.ts", diff --git a/packages/react-components/react-switch/tsconfig.spec.json b/packages/react-components/react-switch/tsconfig.spec.json index 469fcba4d7ba7..911456fe4b4d9 100644 --- a/packages/react-components/react-switch/tsconfig.spec.json +++ b/packages/react-components/react-switch/tsconfig.spec.json @@ -5,5 +5,13 @@ "outDir": "dist", "types": ["jest", "node"] }, - "include": ["**/*.spec.ts", "**/*.spec.tsx", "**/*.test.ts", "**/*.test.tsx", "**/*.d.ts"] + "include": [ + "**/*.spec.ts", + "**/*.spec.tsx", + "**/*.test.ts", + "**/*.test.tsx", + "**/*.d.ts", + "./src/testing/**/*.ts", + "./src/testing/**/*.tsx" + ] }