diff --git a/change/@fluentui-keyboard-keys-489ea6dc-51a9-4fa1-8b26-98709142506d.json b/change/@fluentui-keyboard-keys-489ea6dc-51a9-4fa1-8b26-98709142506d.json new file mode 100644 index 00000000000000..d7f7a0eab844c4 --- /dev/null +++ b/change/@fluentui-keyboard-keys-489ea6dc-51a9-4fa1-8b26-98709142506d.json @@ -0,0 +1,7 @@ +{ + "type": "none", + "comment": "update tooling config", + "packageName": "@fluentui/keyboard-keys", + "email": "olfedias@microsoft.com", + "dependentChangeType": "none" +} diff --git a/packages/keyboard-keys/.babelrc.json b/packages/keyboard-keys/.babelrc.json new file mode 100644 index 00000000000000..38bf1f7a945cf8 --- /dev/null +++ b/packages/keyboard-keys/.babelrc.json @@ -0,0 +1,3 @@ +{ + "plugins": ["annotate-pure-calls", "@babel/transform-react-pure-annotations"] +} diff --git a/packages/keyboard-keys/.npmignore b/packages/keyboard-keys/.npmignore index fa2d3a7f5111ca..e719afb921bc93 100644 --- a/packages/keyboard-keys/.npmignore +++ b/packages/keyboard-keys/.npmignore @@ -1,4 +1,3 @@ -.cache/ .storybook/ .vscode/ bundle-size/ diff --git a/packages/keyboard-keys/config/api-extractor.local.json b/packages/keyboard-keys/config/api-extractor.local.json index c2ea401c1c3685..7974a129e8a337 100644 --- a/packages/keyboard-keys/config/api-extractor.local.json +++ b/packages/keyboard-keys/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/keyboard-keys/config/tests.js b/packages/keyboard-keys/config/tests.js new file mode 100644 index 00000000000000..2e211ae9e21420 --- /dev/null +++ b/packages/keyboard-keys/config/tests.js @@ -0,0 +1 @@ +/** Jest test setup file. */ diff --git a/packages/keyboard-keys/jest.config.js b/packages/keyboard-keys/jest.config.js new file mode 100644 index 00000000000000..31e3cab1c6e05c --- /dev/null +++ b/packages/keyboard-keys/jest.config.js @@ -0,0 +1,20 @@ +// @ts-check + +/** + * @type {jest.InitialOptions} + */ +module.exports = { + displayName: 'keyboard-keys', + preset: '../../jest.preset.js', + globals: { + 'ts-jest': { + tsConfig: '/tsconfig.spec.json', + diagnostics: false, + }, + }, + transform: { + '^.+\\.tsx?$': 'ts-jest', + }, + coverageDirectory: './coverage', + setupFilesAfterEnv: ['./config/tests.js'], +}; diff --git a/packages/keyboard-keys/package.json b/packages/keyboard-keys/package.json index a121043649d9fd..94f816db4b4758 100644 --- a/packages/keyboard-keys/package.json +++ b/packages/keyboard-keys/package.json @@ -18,7 +18,9 @@ "just": "just-scripts", "lint": "just-scripts lint", "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/keyboard-keys/src && yarn docs" + "build:local": "tsc -p ./tsconfig.lib.json --module esnext --emitDeclarationOnly && node ../../scripts/typescript/normalize-import --output ./dist/packages/keyboard-keys/src && yarn docs", + "test": "jest --passWithNoTests", + "type-check": "tsc -b tsconfig.json" }, "devDependencies": { "@fluentui/eslint-plugin": "*", diff --git a/packages/keyboard-keys/tsconfig.json b/packages/keyboard-keys/tsconfig.json index 35acdd7315c7fe..8dff38e64b0310 100644 --- a/packages/keyboard-keys/tsconfig.json +++ b/packages/keyboard-keys/tsconfig.json @@ -1,17 +1,22 @@ { "extends": "../../tsconfig.base.json", - "include": ["src"], "compilerOptions": { - "target": "ES5", - "module": "CommonJS", - "lib": ["es5", "dom"], - "outDir": "dist", - "jsx": "react", - "declaration": true, - "experimentalDecorators": true, + "target": "ES2019", + "noEmit": true, + "isolatedModules": true, "importHelpers": true, + "jsx": "react", "noUnusedLocals": true, - "preserveConstEnums": true, - "types": ["custom-global"] - } + "preserveConstEnums": true + }, + "include": [], + "files": [], + "references": [ + { + "path": "./tsconfig.lib.json" + }, + { + "path": "./tsconfig.spec.json" + } + ] } diff --git a/packages/keyboard-keys/tsconfig.lib.json b/packages/keyboard-keys/tsconfig.lib.json new file mode 100644 index 00000000000000..51f5726b71c686 --- /dev/null +++ b/packages/keyboard-keys/tsconfig.lib.json @@ -0,0 +1,12 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "noEmit": false, + "lib": ["ES2019", "dom"], + "outDir": "dist", + "declaration": true, + "types": ["static-assets", "environment", "inline-style-expand-shorthand"] + }, + "exclude": ["**/*.spec.ts", "**/*.spec.tsx", "**/*.test.ts", "**/*.test.tsx", "**/*.stories.ts", "**/*.stories.tsx"], + "include": ["./src/**/*.ts", "./src/**/*.tsx"] +} diff --git a/packages/keyboard-keys/tsconfig.spec.json b/packages/keyboard-keys/tsconfig.spec.json new file mode 100644 index 00000000000000..28fa5226de4204 --- /dev/null +++ b/packages/keyboard-keys/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"] +}