From 417c05fda16452e6078b78f8b70cba0d38a12fc2 Mon Sep 17 00:00:00 2001 From: Tristan Watanabe Date: Wed, 12 Oct 2022 13:10:05 -0700 Subject: [PATCH 1/3] chore: run workspace-generator --- packages/react-components/react-alert/.npmignore | 5 +++-- .../react-alert/.storybook/main.js | 2 +- .../react-alert/.storybook/tsconfig.json | 2 +- .../react-alert/config/api-extractor.json | 6 +++++- .../react-alert/config/api-extractor.local.json | 5 ----- .../react-alert/{ => docs}/Migration.md | 0 .../react-alert/{ => docs}/Spec.md | 0 .../react-components/react-alert/package.json | 15 +++++++++++---- .../src/components/Alert/Alert.test.tsx | 2 +- .../src/{common => testing}/isConformant.ts | 0 .../stories/Alert/AlertAction.stories.tsx | 0 .../stories/Alert/AlertAppearance.stories.tsx | 0 .../stories/Alert/AlertAvatar.stories.tsx | 0 .../stories/Alert/AlertDefault.stories.tsx | 0 .../{src => }/stories/Alert/AlertDescription.md | 0 .../{src => }/stories/Alert/AlertIcon.stories.tsx | 0 .../stories/Alert/AlertIntent.stories.tsx | 0 .../{src => }/stories/Alert/index.stories.tsx | 0 .../react-alert/tsconfig.lib.json | 6 +++--- .../react-alert/tsconfig.spec.json | 10 +++++++++- 20 files changed, 34 insertions(+), 19 deletions(-) delete mode 100644 packages/react-components/react-alert/config/api-extractor.local.json rename packages/react-components/react-alert/{ => docs}/Migration.md (100%) rename packages/react-components/react-alert/{ => docs}/Spec.md (100%) rename packages/react-components/react-alert/src/{common => testing}/isConformant.ts (100%) rename packages/react-components/react-alert/{src => }/stories/Alert/AlertAction.stories.tsx (100%) rename packages/react-components/react-alert/{src => }/stories/Alert/AlertAppearance.stories.tsx (100%) rename packages/react-components/react-alert/{src => }/stories/Alert/AlertAvatar.stories.tsx (100%) rename packages/react-components/react-alert/{src => }/stories/Alert/AlertDefault.stories.tsx (100%) rename packages/react-components/react-alert/{src => }/stories/Alert/AlertDescription.md (100%) rename packages/react-components/react-alert/{src => }/stories/Alert/AlertIcon.stories.tsx (100%) rename packages/react-components/react-alert/{src => }/stories/Alert/AlertIntent.stories.tsx (100%) rename packages/react-components/react-alert/{src => }/stories/Alert/index.stories.tsx (100%) diff --git a/packages/react-components/react-alert/.npmignore b/packages/react-components/react-alert/.npmignore index 52d2a7273a151d..f7ce568a6dbf7c 100644 --- a/packages/react-components/react-alert/.npmignore +++ b/packages/react-components/react-alert/.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-alert/.storybook/main.js b/packages/react-components/react-alert/.storybook/main.js index f57cfd09509e78..26536b61b387f6 100644 --- a/packages/react-components/react-alert/.storybook/main.js +++ b/packages/react-components/react-alert/.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-alert/.storybook/tsconfig.json b/packages/react-components/react-alert/.storybook/tsconfig.json index f9f60e1234ed49..ea89218a3d916f 100644 --- a/packages/react-components/react-alert/.storybook/tsconfig.json +++ b/packages/react-components/react-alert/.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-alert/config/api-extractor.json b/packages/react-components/react-alert/config/api-extractor.json index eee94ff6de902d..637d9797ae3e6e 100644 --- a/packages/react-components/react-alert/config/api-extractor.json +++ b/packages/react-components/react-alert/config/api-extractor.json @@ -1,5 +1,9 @@ { "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", "extends": "@fluentui/scripts/api-extractor/api-extractor.common.v-next.json", - "mainEntryPointFilePath": "/dist/types/index.d.ts" + "dtsRollup": { + "enabled": true, + "untrimmedFilePath": "", + "publicTrimmedFilePath": "/dist/index.d.ts" + } } diff --git a/packages/react-components/react-alert/config/api-extractor.local.json b/packages/react-components/react-alert/config/api-extractor.local.json deleted file mode 100644 index 69e764bce3a592..00000000000000 --- a/packages/react-components/react-alert/config/api-extractor.local.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", - "extends": "./api-extractor.json", - "mainEntryPointFilePath": "/dist/types/packages/react-components//src/index.d.ts" -} diff --git a/packages/react-components/react-alert/Migration.md b/packages/react-components/react-alert/docs/Migration.md similarity index 100% rename from packages/react-components/react-alert/Migration.md rename to packages/react-components/react-alert/docs/Migration.md diff --git a/packages/react-components/react-alert/Spec.md b/packages/react-components/react-alert/docs/Spec.md similarity index 100% rename from packages/react-components/react-alert/Spec.md rename to packages/react-components/react-alert/docs/Spec.md diff --git a/packages/react-components/react-alert/package.json b/packages/react-components/react-alert/package.json index 56d11832f01306..0385b857a90eae 100644 --- a/packages/react-components/react-alert/package.json +++ b/packages/react-components/react-alert/package.json @@ -4,7 +4,7 @@ "description": "An alert component to display brief messages", "main": "lib-commonjs/index.js", "module": "lib/index.js", - "typings": "dist/index.d.ts", + "typings": "./dist/index.d.ts", "sideEffects": false, "repository": { "type": "git", @@ -20,10 +20,9 @@ "lint": "just-scripts lint", "start": "yarn storybook", "test": "jest --passWithNoTests", - "docs": "api-extractor run --config=config/api-extractor.local.json --local", - "build:local": "tsc -p ./tsconfig.lib.json --module esnext --emitDeclarationOnly && node ../../../scripts/typescript/normalize-import --output ./dist/types/packages/react-components/react-alert/src && yarn docs", "storybook": "start-storybook", - "type-check": "tsc -b tsconfig.json" + "type-check": "tsc -b tsconfig.json", + "generate-api": "tsc -p ./tsconfig.lib.json --emitDeclarationOnly && just-scripts api-extractor" }, "devDependencies": { "@fluentui/eslint-plugin": "*", @@ -52,5 +51,13 @@ "minor", "patch" ] + }, + "exports": { + ".": { + "types": "./dist/index.d.ts", + "import": "./lib/index.js", + "require": "./lib-commonjs/index.js" + }, + "./package.json": "./package.json" } } diff --git a/packages/react-components/react-alert/src/components/Alert/Alert.test.tsx b/packages/react-components/react-alert/src/components/Alert/Alert.test.tsx index 8db10c06886dae..67357cb0e2ba6f 100644 --- a/packages/react-components/react-alert/src/components/Alert/Alert.test.tsx +++ b/packages/react-components/react-alert/src/components/Alert/Alert.test.tsx @@ -2,7 +2,7 @@ import * as React from 'react'; import { render, screen } from '@testing-library/react'; -import { isConformant } from '../../common/isConformant'; +import { isConformant } from '../../testing/isConformant'; import { Alert } from './Alert'; import { alertClassNames } from './useAlertStyles'; diff --git a/packages/react-components/react-alert/src/common/isConformant.ts b/packages/react-components/react-alert/src/testing/isConformant.ts similarity index 100% rename from packages/react-components/react-alert/src/common/isConformant.ts rename to packages/react-components/react-alert/src/testing/isConformant.ts diff --git a/packages/react-components/react-alert/src/stories/Alert/AlertAction.stories.tsx b/packages/react-components/react-alert/stories/Alert/AlertAction.stories.tsx similarity index 100% rename from packages/react-components/react-alert/src/stories/Alert/AlertAction.stories.tsx rename to packages/react-components/react-alert/stories/Alert/AlertAction.stories.tsx diff --git a/packages/react-components/react-alert/src/stories/Alert/AlertAppearance.stories.tsx b/packages/react-components/react-alert/stories/Alert/AlertAppearance.stories.tsx similarity index 100% rename from packages/react-components/react-alert/src/stories/Alert/AlertAppearance.stories.tsx rename to packages/react-components/react-alert/stories/Alert/AlertAppearance.stories.tsx diff --git a/packages/react-components/react-alert/src/stories/Alert/AlertAvatar.stories.tsx b/packages/react-components/react-alert/stories/Alert/AlertAvatar.stories.tsx similarity index 100% rename from packages/react-components/react-alert/src/stories/Alert/AlertAvatar.stories.tsx rename to packages/react-components/react-alert/stories/Alert/AlertAvatar.stories.tsx diff --git a/packages/react-components/react-alert/src/stories/Alert/AlertDefault.stories.tsx b/packages/react-components/react-alert/stories/Alert/AlertDefault.stories.tsx similarity index 100% rename from packages/react-components/react-alert/src/stories/Alert/AlertDefault.stories.tsx rename to packages/react-components/react-alert/stories/Alert/AlertDefault.stories.tsx diff --git a/packages/react-components/react-alert/src/stories/Alert/AlertDescription.md b/packages/react-components/react-alert/stories/Alert/AlertDescription.md similarity index 100% rename from packages/react-components/react-alert/src/stories/Alert/AlertDescription.md rename to packages/react-components/react-alert/stories/Alert/AlertDescription.md diff --git a/packages/react-components/react-alert/src/stories/Alert/AlertIcon.stories.tsx b/packages/react-components/react-alert/stories/Alert/AlertIcon.stories.tsx similarity index 100% rename from packages/react-components/react-alert/src/stories/Alert/AlertIcon.stories.tsx rename to packages/react-components/react-alert/stories/Alert/AlertIcon.stories.tsx diff --git a/packages/react-components/react-alert/src/stories/Alert/AlertIntent.stories.tsx b/packages/react-components/react-alert/stories/Alert/AlertIntent.stories.tsx similarity index 100% rename from packages/react-components/react-alert/src/stories/Alert/AlertIntent.stories.tsx rename to packages/react-components/react-alert/stories/Alert/AlertIntent.stories.tsx diff --git a/packages/react-components/react-alert/src/stories/Alert/index.stories.tsx b/packages/react-components/react-alert/stories/Alert/index.stories.tsx similarity index 100% rename from packages/react-components/react-alert/src/stories/Alert/index.stories.tsx rename to packages/react-components/react-alert/stories/Alert/index.stories.tsx diff --git a/packages/react-components/react-alert/tsconfig.lib.json b/packages/react-components/react-alert/tsconfig.lib.json index 5d7b14f1e0b70c..6f90cf95c005bd 100644 --- a/packages/react-components/react-alert/tsconfig.lib.json +++ b/packages/react-components/react-alert/tsconfig.lib.json @@ -3,14 +3,14 @@ "compilerOptions": { "noEmit": false, "lib": ["ES2019", "dom"], - "outDir": "dist", "declaration": true, - "declarationDir": "dist/types", + "declarationDir": "../../../dist/out-tsc/types", + "outDir": "../../../dist/out-tsc", "inlineSources": true, "types": ["static-assets", "environment"] }, "exclude": [ - "./src/common/**", + "./src/testing/**", "**/*.spec.ts", "**/*.spec.tsx", "**/*.test.ts", diff --git a/packages/react-components/react-alert/tsconfig.spec.json b/packages/react-components/react-alert/tsconfig.spec.json index 469fcba4d7ba75..911456fe4b4d91 100644 --- a/packages/react-components/react-alert/tsconfig.spec.json +++ b/packages/react-components/react-alert/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 44c6c90b42443c12e4cb5ad4d26e6ab217b6e224 Mon Sep 17 00:00:00 2001 From: Tristan Watanabe Date: Wed, 12 Oct 2022 13:16:00 -0700 Subject: [PATCH 2/3] Change File --- ...i-react-alert-2feaf4a3-05ef-42f5-9e83-0a031fd27e26.json | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 change/@fluentui-react-alert-2feaf4a3-05ef-42f5-9e83-0a031fd27e26.json diff --git a/change/@fluentui-react-alert-2feaf4a3-05ef-42f5-9e83-0a031fd27e26.json b/change/@fluentui-react-alert-2feaf4a3-05ef-42f5-9e83-0a031fd27e26.json new file mode 100644 index 00000000000000..623afb74c28c09 --- /dev/null +++ b/change/@fluentui-react-alert-2feaf4a3-05ef-42f5-9e83-0a031fd27e26.json @@ -0,0 +1,7 @@ +{ + "type": "prerelease", + "comment": "Migrate to new package structure.", + "packageName": "@fluentui/react-alert", + "email": "tristan.watanabe@gmail.com", + "dependentChangeType": "patch" +} From cc28c60b285674d84cb96042e340adfbef071fa1 Mon Sep 17 00:00:00 2001 From: Tristan Watanabe Date: Wed, 12 Oct 2022 13:43:12 -0700 Subject: [PATCH 3/3] Change File --- ...uentui-react-alert-2feaf4a3-05ef-42f5-9e83-0a031fd27e26.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/change/@fluentui-react-alert-2feaf4a3-05ef-42f5-9e83-0a031fd27e26.json b/change/@fluentui-react-alert-2feaf4a3-05ef-42f5-9e83-0a031fd27e26.json index 623afb74c28c09..b5a42f8ea5d644 100644 --- a/change/@fluentui-react-alert-2feaf4a3-05ef-42f5-9e83-0a031fd27e26.json +++ b/change/@fluentui-react-alert-2feaf4a3-05ef-42f5-9e83-0a031fd27e26.json @@ -1,6 +1,6 @@ { "type": "prerelease", - "comment": "Migrate to new package structure.", + "comment": "chore: Migrate to new package structure.", "packageName": "@fluentui/react-alert", "email": "tristan.watanabe@gmail.com", "dependentChangeType": "patch"