Skip to content

Commit

Permalink
Added ts config migration (#20675)
Browse files Browse the repository at this point in the history
  • Loading branch information
tringakrasniqi authored Nov 19, 2021
1 parent 168b934 commit 14fb4cb
Show file tree
Hide file tree
Showing 8 changed files with 81 additions and 13 deletions.
14 changes: 14 additions & 0 deletions packages/react-radio/.storybook/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const rootMain = require('../../../.storybook/main');

module.exports = /** @type {Omit<import('../../../.storybook/main'), 'typescript'|'babel'>} */ ({
...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;
},
});
7 changes: 7 additions & 0 deletions packages/react-radio/.storybook/preview.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import * as rootPreview from '../../../.storybook/preview';

/** @type {typeof rootPreview.decorators} */
export const decorators = [...rootPreview.decorators];

/** @type {typeof rootPreview.parameters} */
export const parameters = { ...rootPreview.parameters };
10 changes: 10 additions & 0 deletions packages/react-radio/.storybook/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "",
"allowJs": true,
"checkJs": true,
"types": ["static-assets", "environment", "inline-style-expand-shorthand", "storybook__addons"]
},
"include": ["../src/**/*.stories.ts", "../src/**/*.stories.tsx", "*.js"]
}
2 changes: 1 addition & 1 deletion packages/react-radio/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = {
preset: '../../jest.preset.js',
globals: {
'ts-jest': {
tsConfig: '<rootDir>/tsconfig.json',
tsConfig: '<rootDir>/tsconfig.spec.json',
diagnostics: false,
},
},
Expand Down
5 changes: 3 additions & 2 deletions packages/react-radio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@
"start": "yarn storybook",
"test": "jest",
"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/packages/react-radio/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-radio/src && yarn docs",
"storybook": "start-storybook",
"type-check": "tsc -b tsconfig.json"
},
"devDependencies": {
"@fluentui/babel-make-styles": "9.0.0-beta.3",
Expand Down
27 changes: 17 additions & 10 deletions packages/react-radio/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
{
"extends": "../../tsconfig.base.json",
"include": ["src"],
"compilerOptions": {
"target": "ES2019",
"noEmit": true,
"isolatedModules": true,
"module": "CommonJS",
"lib": ["ES2019", "dom"],
"outDir": "dist",
"jsx": "react",
"declaration": true,
"experimentalDecorators": true,
"importHelpers": true,
"jsx": "react",
"noUnusedLocals": true,
"preserveConstEnums": true,
"types": ["jest", "custom-global", "inline-style-expand-shorthand"]
}
"preserveConstEnums": true
},
"include": [],
"files": [],
"references": [
{
"path": "./tsconfig.lib.json"
},
{
"path": "./tsconfig.spec.json"
},
{
"path": "./.storybook/tsconfig.json"
}
]
}
20 changes: 20 additions & 0 deletions packages/react-radio/tsconfig.lib.json
Original file line number Diff line number Diff line change
@@ -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"]
}
9 changes: 9 additions & 0 deletions packages/react-radio/tsconfig.spec.json
Original file line number Diff line number Diff line change
@@ -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"]
}

0 comments on commit 14fb4cb

Please sign in to comment.