From 6fee8c267de00f9905cce74cbf4f7b45259c54b8 Mon Sep 17 00:00:00 2001 From: Tristan Watanabe Date: Sun, 20 Nov 2022 10:11:37 -0800 Subject: [PATCH 1/2] chore: Migrate to new package structure. --- packages/react-components/react-switch/.npmignore | 5 +++-- .../react-components/react-switch/.storybook/main.js | 2 +- .../react-switch/.storybook/tsconfig.json | 2 +- .../react-switch/{ => docs}/MIGRATION.md | 0 .../react-components/react-switch/{ => docs}/Spec.md | 0 .../react-switch/src/components/Switch/Switch.test.tsx | 2 +- .../src/components/SwitchField/SwitchField.test.tsx | 2 +- .../src/{common => testing}/isConformant.ts | 0 .../{src => }/stories/Switch/SwitchBestPractices.md | 0 .../{src => }/stories/Switch/SwitchChecked.stories.tsx | 0 .../{src => }/stories/Switch/SwitchDefault.stories.tsx | 0 .../{src => }/stories/Switch/SwitchDescription.md | 0 .../stories/Switch/SwitchDisabled.stories.tsx | 0 .../{src => }/stories/Switch/SwitchLabel.stories.tsx | 0 .../stories/Switch/SwitchLabelWrapping.stories.tsx | 0 .../stories/Switch/SwitchRequired.stories.tsx | 0 .../{src => }/stories/Switch/index.stories.tsx | 0 .../stories/SwitchField/SwitchFieldDefault.stories.tsx | 0 .../stories/SwitchField/SwitchFieldDescription.md | 0 .../{src => }/stories/SwitchField/index.stories.tsx | 0 .../react-components/react-switch/tsconfig.lib.json | 2 +- .../react-components/react-switch/tsconfig.spec.json | 10 +++++++++- 22 files changed, 17 insertions(+), 8 deletions(-) rename packages/react-components/react-switch/{ => docs}/MIGRATION.md (100%) rename packages/react-components/react-switch/{ => docs}/Spec.md (100%) rename packages/react-components/react-switch/src/{common => testing}/isConformant.ts (100%) rename packages/react-components/react-switch/{src => }/stories/Switch/SwitchBestPractices.md (100%) rename packages/react-components/react-switch/{src => }/stories/Switch/SwitchChecked.stories.tsx (100%) rename packages/react-components/react-switch/{src => }/stories/Switch/SwitchDefault.stories.tsx (100%) rename packages/react-components/react-switch/{src => }/stories/Switch/SwitchDescription.md (100%) rename packages/react-components/react-switch/{src => }/stories/Switch/SwitchDisabled.stories.tsx (100%) rename packages/react-components/react-switch/{src => }/stories/Switch/SwitchLabel.stories.tsx (100%) rename packages/react-components/react-switch/{src => }/stories/Switch/SwitchLabelWrapping.stories.tsx (100%) rename packages/react-components/react-switch/{src => }/stories/Switch/SwitchRequired.stories.tsx (100%) rename packages/react-components/react-switch/{src => }/stories/Switch/index.stories.tsx (100%) rename packages/react-components/react-switch/{src => }/stories/SwitchField/SwitchFieldDefault.stories.tsx (100%) rename packages/react-components/react-switch/{src => }/stories/SwitchField/SwitchFieldDescription.md (100%) rename packages/react-components/react-switch/{src => }/stories/SwitchField/index.stories.tsx (100%) 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" + ] } From 61217ccc504acd6464b46b49e214ba5711787da5 Mon Sep 17 00:00:00 2001 From: Tristan Watanabe Date: Sun, 20 Nov 2022 10:13:13 -0800 Subject: [PATCH 2/2] Change File --- ...-react-switch-45eb6678-84a2-411b-83ba-48b7cdc5a753.json | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 change/@fluentui-react-switch-45eb6678-84a2-411b-83ba-48b7cdc5a753.json 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" +}