From 3198af953e515531d3abe2a9dd6a7046c15af722 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Dias?= Date: Tue, 30 Nov 2021 17:14:02 +0100 Subject: [PATCH 1/2] Migrate package --- packages/react-tooltip/.npmignore | 1 - packages/react-tooltip/.storybook/main.js | 6 ++-- .../react-tooltip/.storybook/tsconfig.json | 7 +++-- .../config/api-extractor.local.json | 2 +- packages/react-tooltip/jest.config.js | 2 +- packages/react-tooltip/package.json | 7 +++-- packages/react-tooltip/tsconfig.json | 29 ++++++++++++------- packages/react-tooltip/tsconfig.lib.json | 20 +++++++++++++ packages/react-tooltip/tsconfig.spec.json | 9 ++++++ 9 files changed, 61 insertions(+), 22 deletions(-) create mode 100644 packages/react-tooltip/tsconfig.lib.json create mode 100644 packages/react-tooltip/tsconfig.spec.json diff --git a/packages/react-tooltip/.npmignore b/packages/react-tooltip/.npmignore index fa2d3a7f5111c..e719afb921bc9 100644 --- a/packages/react-tooltip/.npmignore +++ b/packages/react-tooltip/.npmignore @@ -1,4 +1,3 @@ -.cache/ .storybook/ .vscode/ bundle-size/ diff --git a/packages/react-tooltip/.storybook/main.js b/packages/react-tooltip/.storybook/main.js index ec377d98606fa..18a60b265c2cf 100644 --- a/packages/react-tooltip/.storybook/main.js +++ b/packages/react-tooltip/.storybook/main.js @@ -1,12 +1,14 @@ const rootMain = require('../../../.storybook/main'); -module.exports = /** @type {Pick} */ ({ +module.exports = /** @type {Omit} */ ({ + ...rootMain, stories: [...rootMain.stories, '../src/**/*.stories.mdx', '../src/**/*.stories.@(ts|tsx)'], addons: [...rootMain.addons], webpackFinal: (config, options) => { const localConfig = { ...rootMain.webpackFinal(config, options) }; + // add your own webpack tweaks if needed + return localConfig; }, - previewHead: rootMain.previewHead, }); diff --git a/packages/react-tooltip/.storybook/tsconfig.json b/packages/react-tooltip/.storybook/tsconfig.json index 3bd9adcd2ee05..29aa16f2f178f 100644 --- a/packages/react-tooltip/.storybook/tsconfig.json +++ b/packages/react-tooltip/.storybook/tsconfig.json @@ -1,9 +1,10 @@ { "extends": "../tsconfig.json", "compilerOptions": { + "outDir": "", "allowJs": true, - "checkJs": true + "checkJs": true, + "types": ["static-assets", "environment", "inline-style-expand-shorthand", "storybook__addons"] }, - "exclude": ["../**/*.test.ts", "../**/*.test.js", "../**/*.test.tsx", "../**/*.test.jsx"], - "include": ["../src/**/*", "*.js"] + "include": ["../src/**/*.stories.ts", "../src/**/*.stories.tsx", "*.js"] } diff --git a/packages/react-tooltip/config/api-extractor.local.json b/packages/react-tooltip/config/api-extractor.local.json index c2ea401c1c368..7974a129e8a33 100644 --- a/packages/react-tooltip/config/api-extractor.local.json +++ b/packages/react-tooltip/config/api-extractor.local.json @@ -1,5 +1,5 @@ { "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", "extends": "./api-extractor.json", - "mainEntryPointFilePath": "/dist//src/index.d.ts" + "mainEntryPointFilePath": "/dist/packages//src/index.d.ts" } diff --git a/packages/react-tooltip/jest.config.js b/packages/react-tooltip/jest.config.js index b588701ac9b21..1db2e6088338b 100644 --- a/packages/react-tooltip/jest.config.js +++ b/packages/react-tooltip/jest.config.js @@ -8,7 +8,7 @@ module.exports = { preset: '../../jest.preset.js', globals: { 'ts-jest': { - tsConfig: '/tsconfig.json', + tsConfig: '/tsconfig.spec.json', diagnostics: false, }, }, diff --git a/packages/react-tooltip/package.json b/packages/react-tooltip/package.json index 4a4cf8dc0f0ec..097e461284ee4 100644 --- a/packages/react-tooltip/package.json +++ b/packages/react-tooltip/package.json @@ -19,10 +19,11 @@ "just": "just-scripts", "lint": "just-scripts lint", "start": "yarn storybook", - "test": "jest", + "test": "jest --passWithNoTests", "docs": "api-extractor run --config=config/api-extractor.local.json --local", - "build:local": "tsc -p . --module esnext --emitDeclarationOnly && node ../../scripts/typescript/normalize-import --output dist/react-tooltip/src && yarn docs", - "storybook": "start-storybook" + "build:local": "tsc -p ./tsconfig.lib.json --module esnext --emitDeclarationOnly && node ../../scripts/typescript/normalize-import --output ./dist/packages/react-tooltip/src && yarn docs", + "storybook": "start-storybook", + "type-check": "tsc -b tsconfig.json" }, "devDependencies": { "@fluentui/babel-make-styles": "9.0.0-beta.4", diff --git a/packages/react-tooltip/tsconfig.json b/packages/react-tooltip/tsconfig.json index 8087c91da47a6..affceae1828ae 100644 --- a/packages/react-tooltip/tsconfig.json +++ b/packages/react-tooltip/tsconfig.json @@ -1,18 +1,25 @@ { "extends": "../../tsconfig.base.json", - "include": ["src"], "compilerOptions": { "target": "ES2019", - "module": "CommonJS", - "lib": ["ES2019", "DOM"], - "outDir": "dist", - "jsx": "react", - "declaration": true, - "experimentalDecorators": true, + "noEmit": true, + "isolatedModules": true, "importHelpers": true, + "jsx": "react", "noUnusedLocals": true, - "preserveConstEnums": true, - "types": ["jest", "custom-global", "inline-style-expand-shorthand", "storybook__addons"], - "isolatedModules": true - } + "preserveConstEnums": true + }, + "include": [], + "files": [], + "references": [ + { + "path": "./tsconfig.lib.json" + }, + { + "path": "./tsconfig.spec.json" + }, + { + "path": "./.storybook/tsconfig.json" + } + ] } diff --git a/packages/react-tooltip/tsconfig.lib.json b/packages/react-tooltip/tsconfig.lib.json new file mode 100644 index 0000000000000..b83999c31f8a3 --- /dev/null +++ b/packages/react-tooltip/tsconfig.lib.json @@ -0,0 +1,20 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "noEmit": false, + "lib": ["ES2019", "dom"], + "outDir": "dist", + "declaration": true, + "types": ["static-assets", "environment", "inline-style-expand-shorthand"] + }, + "exclude": [ + "./src/common/**", + "**/*.spec.ts", + "**/*.spec.tsx", + "**/*.test.ts", + "**/*.test.tsx", + "**/*.stories.ts", + "**/*.stories.tsx" + ], + "include": ["./src/**/*.ts", "./src/**/*.tsx"] +} diff --git a/packages/react-tooltip/tsconfig.spec.json b/packages/react-tooltip/tsconfig.spec.json new file mode 100644 index 0000000000000..28fa5226de420 --- /dev/null +++ b/packages/react-tooltip/tsconfig.spec.json @@ -0,0 +1,9 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "module": "CommonJS", + "outDir": "dist", + "types": ["jest", "node", "inline-style-expand-shorthand"] + }, + "include": ["**/*.spec.ts", "**/*.spec.tsx", "**/*.test.ts", "**/*.test.tsx", "**/*.d.ts"] +} From 32b74ddca2d5e1d3ce336761a5804125bf4d038b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Dias?= Date: Tue, 30 Nov 2021 17:14:54 +0100 Subject: [PATCH 2/2] Change files --- ...react-tooltip-9b2e7c58-b7c8-4dd3-ae0f-0284872b2bc6.json | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 change/@fluentui-react-tooltip-9b2e7c58-b7c8-4dd3-ae0f-0284872b2bc6.json diff --git a/change/@fluentui-react-tooltip-9b2e7c58-b7c8-4dd3-ae0f-0284872b2bc6.json b/change/@fluentui-react-tooltip-9b2e7c58-b7c8-4dd3-ae0f-0284872b2bc6.json new file mode 100644 index 0000000000000..aa89900123aa0 --- /dev/null +++ b/change/@fluentui-react-tooltip-9b2e7c58-b7c8-4dd3-ae0f-0284872b2bc6.json @@ -0,0 +1,7 @@ +{ + "type": "none", + "comment": "Migrate package to use solution tsconfigs", + "packageName": "@fluentui/react-tooltip", + "email": "andredias@microsoft.com", + "dependentChangeType": "none" +}