From f21df3a1692462af82b272385495d202c6f03e85 Mon Sep 17 00:00:00 2001 From: Tristan Watanabe Date: Wed, 12 Oct 2022 13:28:07 -0700 Subject: [PATCH 1/9] chore: run generator --- packages/react-components/react-aria/.npmignore | 5 +++-- .../react-components/react-aria/.storybook/main.js | 2 +- .../react-aria/.storybook/tsconfig.json | 2 +- .../react-aria/config/api-extractor.json | 6 +++++- .../react-aria/config/api-extractor.local.json | 5 ----- .../react-components/react-aria/{ => docs}/Spec.md | 0 packages/react-components/react-aria/package.json | 12 ++++++------ .../react-components/react-aria/tsconfig.lib.json | 4 ++-- .../react-components/react-aria/tsconfig.spec.json | 10 +++++++++- 9 files changed, 27 insertions(+), 19 deletions(-) delete mode 100644 packages/react-components/react-aria/config/api-extractor.local.json rename packages/react-components/react-aria/{ => docs}/Spec.md (100%) diff --git a/packages/react-components/react-aria/.npmignore b/packages/react-components/react-aria/.npmignore index 52d2a7273a151..f7ce568a6dbf7 100644 --- a/packages/react-components/react-aria/.npmignore +++ b/packages/react-components/react-aria/.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-aria/.storybook/main.js b/packages/react-components/react-aria/.storybook/main.js index f57cfd09509e7..26536b61b387f 100644 --- a/packages/react-components/react-aria/.storybook/main.js +++ b/packages/react-components/react-aria/.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-aria/.storybook/tsconfig.json b/packages/react-components/react-aria/.storybook/tsconfig.json index f9f60e1234ed4..ea89218a3d916 100644 --- a/packages/react-components/react-aria/.storybook/tsconfig.json +++ b/packages/react-components/react-aria/.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-aria/config/api-extractor.json b/packages/react-components/react-aria/config/api-extractor.json index eee94ff6de902..637d9797ae3e6 100644 --- a/packages/react-components/react-aria/config/api-extractor.json +++ b/packages/react-components/react-aria/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-aria/config/api-extractor.local.json b/packages/react-components/react-aria/config/api-extractor.local.json deleted file mode 100644 index 69e764bce3a59..0000000000000 --- a/packages/react-components/react-aria/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-aria/Spec.md b/packages/react-components/react-aria/docs/Spec.md similarity index 100% rename from packages/react-components/react-aria/Spec.md rename to packages/react-components/react-aria/docs/Spec.md diff --git a/packages/react-components/react-aria/package.json b/packages/react-components/react-aria/package.json index 6525f4090a7d5..9f75f687c35ec 100644 --- a/packages/react-components/react-aria/package.json +++ b/packages/react-components/react-aria/package.json @@ -4,7 +4,7 @@ "description": "React helper to ensure ARIA", "main": "lib-commonjs/index.js", "module": "lib/index.js", - "typings": "dist/index.d.ts", + "typings": "./dist/index.d.ts", "sideEffects": false, "repository": { "type": "git", @@ -19,10 +19,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/types/packages/react-components/react-aria/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": "*", @@ -48,9 +47,10 @@ }, "exports": { ".": { - "types": "./lib/index.d.ts", + "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-aria/tsconfig.lib.json b/packages/react-components/react-aria/tsconfig.lib.json index ef66992c5a174..008c602dc19d2 100644 --- a/packages/react-components/react-aria/tsconfig.lib.json +++ b/packages/react-components/react-aria/tsconfig.lib.json @@ -3,9 +3,9 @@ "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"] }, diff --git a/packages/react-components/react-aria/tsconfig.spec.json b/packages/react-components/react-aria/tsconfig.spec.json index 469fcba4d7ba7..911456fe4b4d9 100644 --- a/packages/react-components/react-aria/tsconfig.spec.json +++ b/packages/react-components/react-aria/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 067876652b87e74b9acb21370702eb09e79d9b1c Mon Sep 17 00:00:00 2001 From: Tristan Watanabe Date: Wed, 12 Oct 2022 13:37:44 -0700 Subject: [PATCH 2/9] manual move of stories --- .../useARIAButton/index.stories.tsx} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename packages/react-components/react-aria/{src/button/useARIAButton.stories.tsx => stories/useARIAButton/index.stories.tsx} (91%) diff --git a/packages/react-components/react-aria/src/button/useARIAButton.stories.tsx b/packages/react-components/react-aria/stories/useARIAButton/index.stories.tsx similarity index 91% rename from packages/react-components/react-aria/src/button/useARIAButton.stories.tsx rename to packages/react-components/react-aria/stories/useARIAButton/index.stories.tsx index bb0f78f392416..2bdd7aff17e83 100644 --- a/packages/react-components/react-aria/src/button/useARIAButton.stories.tsx +++ b/packages/react-components/react-aria/stories/useARIAButton/index.stories.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; -import { useARIAButtonShorthand } from '../button'; -import type { ARIAButtonSlotProps } from '../button'; +import { useARIAButtonShorthand } from '@fluentui/react-aria'; +import type { ARIAButtonSlotProps } from '@fluentui/react-aria'; import { getSlots } from '@fluentui/react-components'; import type { ComponentState, Slot } from '@fluentui/react-components'; From 5e0d477475a1eaa4fd523433dd2a9b54a3c4ed7a Mon Sep 17 00:00:00 2001 From: Tristan Watanabe Date: Wed, 12 Oct 2022 13:38:42 -0700 Subject: [PATCH 3/9] Change File --- ...ui-react-aria-53588dbd-e71a-4ad5-8878-786cf4b0ab8e.json | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 change/@fluentui-react-aria-53588dbd-e71a-4ad5-8878-786cf4b0ab8e.json diff --git a/change/@fluentui-react-aria-53588dbd-e71a-4ad5-8878-786cf4b0ab8e.json b/change/@fluentui-react-aria-53588dbd-e71a-4ad5-8878-786cf4b0ab8e.json new file mode 100644 index 0000000000000..ebef9d0220f3f --- /dev/null +++ b/change/@fluentui-react-aria-53588dbd-e71a-4ad5-8878-786cf4b0ab8e.json @@ -0,0 +1,7 @@ +{ + "type": "patch", + "comment": "chore: Migrate to new package structure.", + "packageName": "@fluentui/react-aria", + "email": "tristan.watanabe@gmail.com", + "dependentChangeType": "patch" +} From cbae8a92336a5cc928254c7a434f244f237c89a2 Mon Sep 17 00:00:00 2001 From: Tristan Watanabe Date: Wed, 12 Oct 2022 14:04:57 -0700 Subject: [PATCH 4/9] Change File --- ...entui-react-aria-53588dbd-e71a-4ad5-8878-786cf4b0ab8e.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/change/@fluentui-react-aria-53588dbd-e71a-4ad5-8878-786cf4b0ab8e.json b/change/@fluentui-react-aria-53588dbd-e71a-4ad5-8878-786cf4b0ab8e.json index ebef9d0220f3f..e0ad3d87e7092 100644 --- a/change/@fluentui-react-aria-53588dbd-e71a-4ad5-8878-786cf4b0ab8e.json +++ b/change/@fluentui-react-aria-53588dbd-e71a-4ad5-8878-786cf4b0ab8e.json @@ -1,7 +1,7 @@ { - "type": "patch", + "type": "none", "comment": "chore: Migrate to new package structure.", "packageName": "@fluentui/react-aria", "email": "tristan.watanabe@gmail.com", - "dependentChangeType": "patch" + "dependentChangeType": "none" } From 7b2382817d2db30155d6553e873d50f074673e13 Mon Sep 17 00:00:00 2001 From: Tristan Watanabe Date: Wed, 12 Oct 2022 18:14:14 -0700 Subject: [PATCH 5/9] use relative import --- .../react-aria/stories/useARIAButton/index.stories.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/react-components/react-aria/stories/useARIAButton/index.stories.tsx b/packages/react-components/react-aria/stories/useARIAButton/index.stories.tsx index 2bdd7aff17e83..1b5cc18a8adf7 100644 --- a/packages/react-components/react-aria/stories/useARIAButton/index.stories.tsx +++ b/packages/react-components/react-aria/stories/useARIAButton/index.stories.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; -import { useARIAButtonShorthand } from '@fluentui/react-aria'; -import type { ARIAButtonSlotProps } from '@fluentui/react-aria'; +import { useARIAButtonShorthand } from '../../src/button'; +import type { ARIAButtonSlotProps } from '../../src/button'; import { getSlots } from '@fluentui/react-components'; import type { ComponentState, Slot } from '@fluentui/react-components'; From 69eead5e2154ee52d85b25e4ebdb1a63f547a354 Mon Sep 17 00:00:00 2001 From: Tristan Watanabe Date: Sun, 16 Oct 2022 18:52:04 -0700 Subject: [PATCH 6/9] revert: remove api stripping and export maps --- .../react-components/react-aria/config/api-extractor.json | 6 +----- .../react-aria/config/api-extractor.local.json | 5 +++++ packages/react-components/react-aria/package.json | 3 ++- packages/react-components/react-aria/tsconfig.lib.json | 4 ++-- 4 files changed, 10 insertions(+), 8 deletions(-) create mode 100644 packages/react-components/react-aria/config/api-extractor.local.json diff --git a/packages/react-components/react-aria/config/api-extractor.json b/packages/react-components/react-aria/config/api-extractor.json index 637d9797ae3e6..eee94ff6de902 100644 --- a/packages/react-components/react-aria/config/api-extractor.json +++ b/packages/react-components/react-aria/config/api-extractor.json @@ -1,9 +1,5 @@ { "$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", - "dtsRollup": { - "enabled": true, - "untrimmedFilePath": "", - "publicTrimmedFilePath": "/dist/index.d.ts" - } + "mainEntryPointFilePath": "/dist/types/index.d.ts" } diff --git a/packages/react-components/react-aria/config/api-extractor.local.json b/packages/react-components/react-aria/config/api-extractor.local.json new file mode 100644 index 0000000000000..69e764bce3a59 --- /dev/null +++ b/packages/react-components/react-aria/config/api-extractor.local.json @@ -0,0 +1,5 @@ +{ + "$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-aria/package.json b/packages/react-components/react-aria/package.json index 9f75f687c35ec..869f073bda6c6 100644 --- a/packages/react-components/react-aria/package.json +++ b/packages/react-components/react-aria/package.json @@ -21,7 +21,8 @@ "test": "jest --passWithNoTests", "storybook": "start-storybook", "type-check": "tsc -b tsconfig.json", - "generate-api": "tsc -p ./tsconfig.lib.json --emitDeclarationOnly && just-scripts api-extractor" + "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-aria/src && yarn docs" }, "devDependencies": { "@fluentui/eslint-plugin": "*", diff --git a/packages/react-components/react-aria/tsconfig.lib.json b/packages/react-components/react-aria/tsconfig.lib.json index 008c602dc19d2..39185ff5c9fe5 100644 --- a/packages/react-components/react-aria/tsconfig.lib.json +++ b/packages/react-components/react-aria/tsconfig.lib.json @@ -4,8 +4,8 @@ "noEmit": false, "lib": ["ES2019", "dom"], "declaration": true, - "declarationDir": "../../../dist/out-tsc/types", - "outDir": "../../../dist/out-tsc", + "declarationDir": "dist/types", + "outDir": "dist", "inlineSources": true, "types": ["static-assets", "environment"] }, From a903ee45b2e14ccfc2ce790de5e70fc517b83561 Mon Sep 17 00:00:00 2001 From: Tristan Watanabe Date: Sun, 16 Oct 2022 18:55:33 -0700 Subject: [PATCH 7/9] nit: reorder --- packages/react-components/react-aria/package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/react-components/react-aria/package.json b/packages/react-components/react-aria/package.json index 869f073bda6c6..dfd5314c05356 100644 --- a/packages/react-components/react-aria/package.json +++ b/packages/react-components/react-aria/package.json @@ -19,10 +19,10 @@ "lint": "just-scripts lint", "start": "yarn storybook", "test": "jest --passWithNoTests", - "storybook": "start-storybook", - "type-check": "tsc -b tsconfig.json", "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-aria/src && yarn docs" + "build:local": "tsc -p ./tsconfig.lib.json --module esnext --emitDeclarationOnly && node ../../../scripts/typescript/normalize-import --output ./dist/types/packages/react-components/react-aria/src && yarn docs", + "storybook": "start-storybook", + "type-check": "tsc -b tsconfig.json" }, "devDependencies": { "@fluentui/eslint-plugin": "*", From 0bd9de77293cbe2b7467857875fb36eb59590b39 Mon Sep 17 00:00:00 2001 From: Tristan Watanabe Date: Sun, 16 Oct 2022 19:09:24 -0700 Subject: [PATCH 8/9] revert miscelaneous changes --- packages/react-components/react-aria/package.json | 2 +- packages/react-components/react-aria/tsconfig.lib.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/react-components/react-aria/package.json b/packages/react-components/react-aria/package.json index 21e132ac8515b..134eaac74c5ef 100644 --- a/packages/react-components/react-aria/package.json +++ b/packages/react-components/react-aria/package.json @@ -20,7 +20,7 @@ "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-aria/src && yarn docs", + "build:local": "tsc -p ./tsconfig.lib.json --module esnext --emitDeclarationOnly && node ../../../scripts/typescript/normalize-import --output ./dist/types/types/packages/react-components/react-aria/src && yarn docs", "storybook": "start-storybook", "type-check": "tsc -b tsconfig.json" }, diff --git a/packages/react-components/react-aria/tsconfig.lib.json b/packages/react-components/react-aria/tsconfig.lib.json index 39185ff5c9fe5..ef66992c5a174 100644 --- a/packages/react-components/react-aria/tsconfig.lib.json +++ b/packages/react-components/react-aria/tsconfig.lib.json @@ -3,9 +3,9 @@ "compilerOptions": { "noEmit": false, "lib": ["ES2019", "dom"], + "outDir": "dist", "declaration": true, "declarationDir": "dist/types", - "outDir": "dist", "inlineSources": true, "types": ["static-assets", "environment"] }, From 58710fa3c5c3bc16ac3265059858b44c7bbe4ac5 Mon Sep 17 00:00:00 2001 From: Tristan Watanabe Date: Sun, 16 Oct 2022 19:13:04 -0700 Subject: [PATCH 9/9] revert package.json --- packages/react-components/react-aria/package.json | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/react-components/react-aria/package.json b/packages/react-components/react-aria/package.json index 134eaac74c5ef..bb0e86d0c96c3 100644 --- a/packages/react-components/react-aria/package.json +++ b/packages/react-components/react-aria/package.json @@ -4,7 +4,7 @@ "description": "React helper to ensure ARIA", "main": "lib-commonjs/index.js", "module": "lib/index.js", - "typings": "./dist/index.d.ts", + "typings": "dist/index.d.ts", "sideEffects": false, "repository": { "type": "git", @@ -48,10 +48,9 @@ }, "exports": { ".": { - "types": "./dist/index.d.ts", + "types": "./lib/index.d.ts", "import": "./lib/index.js", "require": "./lib-commonjs/index.js" - }, - "./package.json": "./package.json" + } } }