diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index ae6513fc..6750fe82 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -12,6 +12,7 @@ packages/react-headless-provider/ @microsoft/teams-prg packages/react-resize-handler/ @microsoft/teams-prg packages/stylelint-plugin/ @microsoft/teams-prg packages/react-themeless-provider/ @spmonahan +packages/azure-theme/ @microsoft/azure-ux-design-engineering # <%= NX-CODEOWNER-PLACEHOLDER %> #### Build/Infra diff --git a/package.json b/package.json index 1e3aa37d..13cee756 100644 --- a/package.json +++ b/package.json @@ -68,7 +68,6 @@ "@typescript-eslint/eslint-plugin": "6.20.0", "@typescript-eslint/parser": "6.20.0", "beachball": "^2.33.2", - "core-js": "^3.6.5", "eslint": "8.48.0", "eslint-config-prettier": "9.1.0", "eslint-plugin-import": "^2.27.5", diff --git a/packages/azure-theme/.babelrc b/packages/azure-theme/.babelrc new file mode 100644 index 00000000..ac08da0a --- /dev/null +++ b/packages/azure-theme/.babelrc @@ -0,0 +1,3 @@ +{ + "extends": "../../babel.config.json" +} diff --git a/packages/azure-theme/.eslintrc.json b/packages/azure-theme/.eslintrc.json new file mode 100644 index 00000000..5f831ca3 --- /dev/null +++ b/packages/azure-theme/.eslintrc.json @@ -0,0 +1,24 @@ +{ + "extends": ["../../.eslintrc.json"], + "ignorePatterns": ["!**/*"], + "overrides": [ + { + "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], + "rules": {} + }, + { + "files": ["*.ts", "*.tsx"], + "rules": {} + }, + { + "files": ["*.js", "*.jsx"], + "rules": {} + }, + { + "files": ["stories/**/*.tsx", "stories/**/*.ts"], + "rules": { + "@nx/enforce-module-boundaries": "off" + } + } + ] +} diff --git a/packages/azure-theme/.storybook/main.ts b/packages/azure-theme/.storybook/main.ts new file mode 100644 index 00000000..52bf5e00 --- /dev/null +++ b/packages/azure-theme/.storybook/main.ts @@ -0,0 +1,26 @@ +import type { StorybookConfig } from '@storybook/react-webpack5'; + +const config: StorybookConfig = { + stories: ['../stories/**/index.stories.@(js|jsx|ts|tsx|mdx)'], + addons: [ + '@nx/react/plugins/storybook', + { + name: '@storybook/addon-storysource', + options: { + loaderOptions: { + injectStoryParameters: true, + }, + }, + }, + ], + framework: { + name: '@storybook/react-webpack5', + options: {}, + }, +}; + +export default config; + +// To customize your webpack configuration you can use the webpackFinal field. +// Check https://storybook.js.org/docs/react/builders/webpack#extending-storybooks-webpack-config +// and https://nx.dev/packages/storybook/documents/custom-builder-configs diff --git a/packages/azure-theme/.storybook/preview.tsx b/packages/azure-theme/.storybook/preview.tsx new file mode 100644 index 00000000..5f63e651 --- /dev/null +++ b/packages/azure-theme/.storybook/preview.tsx @@ -0,0 +1,17 @@ +import * as React from 'react'; + +import { Preview } from '@storybook/react'; + +import { FluentProvider, webLightTheme } from '@fluentui/react-components'; + +const preview: Preview = { + decorators: [ + (Story) => ( + + + + ), + ], +}; + +export default preview; diff --git a/packages/azure-theme/.storybook/tsconfig.json b/packages/azure-theme/.storybook/tsconfig.json new file mode 100644 index 00000000..6fa15c2f --- /dev/null +++ b/packages/azure-theme/.storybook/tsconfig.json @@ -0,0 +1,27 @@ +{ + "extends": "../tsconfig.json", + "compilerOptions": { + "emitDecoratorMetadata": true, + "outDir": "" + }, + "files": [ + "../../../node_modules/@nx/react/typings/styled-jsx.d.ts", + "../../../node_modules/@nx/react/typings/cssmodule.d.ts", + "../../../node_modules/@nx/react/typings/image.d.ts" + ], + "exclude": [ + "../**/*.spec.ts", + "../**/*.spec.js", + "../**/*.spec.tsx", + "../**/*.spec.jsx" + ], + "include": [ + "../stories/**/*.stories.ts", + "../stories/**/*.stories.js", + "../stories/**/*.stories.jsx", + "../stories/**/*.stories.tsx", + "../stories/**/*.stories.mdx", + "*.ts", + "*.js" + ] +} diff --git a/packages/azure-theme/.swcrc b/packages/azure-theme/.swcrc new file mode 100644 index 00000000..0f4746f4 --- /dev/null +++ b/packages/azure-theme/.swcrc @@ -0,0 +1,30 @@ +{ + "jsc": { + "target": "es2019", + "parser": { + "syntax": "typescript", + "tsx": true, + "decorators": false, + "dynamicImport": false + }, + "transform": { + "react": { + "runtime": "classic", + "useSpread": true + } + }, + "keepClassNames": true, + "externalHelpers": true, + "loose": true + }, + "sourceMaps": true, + "exclude": [ + "jest.config.ts", + ".*\\.spec.tsx?$", + ".*\\.test.tsx?$", + "./src/jest-setup.ts$", + "./**/jest-setup.ts$", + ".*.js$" + ], + "$schema": "https://json.schemastore.org/swcrc" +} diff --git a/packages/azure-theme/README.md b/packages/azure-theme/README.md new file mode 100644 index 00000000..181d8dfc --- /dev/null +++ b/packages/azure-theme/README.md @@ -0,0 +1,11 @@ +# azure-theme + +This library was generated with [Nx](https://nx.dev). + +## Building + +Run `nx build azure-theme` to build the library. + +## Running unit tests + +Run `nx test azure-theme` to execute the unit tests via [Jest](https://jestjs.io). diff --git a/packages/azure-theme/jest.config.ts b/packages/azure-theme/jest.config.ts new file mode 100644 index 00000000..053995da --- /dev/null +++ b/packages/azure-theme/jest.config.ts @@ -0,0 +1,30 @@ +/* eslint-disable */ +import { readFileSync } from 'fs'; + +// Reading the SWC compilation config and remove the "exclude" +// for the test files to be compiled by SWC +const { exclude: _, ...swcJestConfig } = JSON.parse( + readFileSync(`${__dirname}/.swcrc`, 'utf-8') +); + +// disable .swcrc look-up by SWC core because we're passing in swcJestConfig ourselves. +// If we do not disable this, SWC Core will read .swcrc and won't transform our test files due to "exclude" +if (swcJestConfig.swcrc === undefined) { + swcJestConfig.swcrc = false; +} + +// Uncomment if using global setup/teardown files being transformed via swc +// https://nx.dev/packages/jest/documents/overview#global-setup/teardown-with-nx-libraries +// jest needs EsModule Interop to find the default exported setup/teardown functions +// swcJestConfig.module.noInterop = false; + +export default { + displayName: 'azure-theme', + preset: '../../jest.preset.js', + transform: { + '^.+\\.[tj]s$': ['@swc/jest', swcJestConfig], + }, + moduleFileExtensions: ['ts', 'js', 'html'], + testEnvironment: 'jsdom', + coverageDirectory: '../../coverage/packages/azure-theme', +}; diff --git a/packages/azure-theme/package.json b/packages/azure-theme/package.json new file mode 100644 index 00000000..0552ec1b --- /dev/null +++ b/packages/azure-theme/package.json @@ -0,0 +1,17 @@ +{ + "name": "@fluentui-contrib/azure-theme", + "version": "0.0.1", + "dependencies": { + "@swc/helpers": "~0.5.2" + }, + "main": "./src/index.js", + "typings": "./src/index.d.ts", + "private": true, + "peerDependencies": { + "@fluentui/react-components": ">=9.46.3 <10.0.0", + "@types/react": ">=16.8.0 <19.0.0", + "@types/react-dom": ">=16.8.0 <19.0.0", + "react": ">=16.8.0 <19.0.0", + "react-dom": ">=16.8.0 <19.0.0" + } +} diff --git a/packages/azure-theme/project.json b/packages/azure-theme/project.json new file mode 100644 index 00000000..2fa218b4 --- /dev/null +++ b/packages/azure-theme/project.json @@ -0,0 +1,61 @@ +{ + "name": "azure-theme", + "$schema": "../../node_modules/nx/schemas/project-schema.json", + "sourceRoot": "packages/azure-theme/src", + "projectType": "library", + "targets": { + "build": { + "executor": "@fluentui-contrib/nx-plugin:build" + }, + "publish": { + "command": "node tools/scripts/publish.mjs azure-theme {args.ver} {args.tag}", + "dependsOn": ["build"] + }, + "lint": { + "executor": "@nx/eslint:lint", + "options": { + "lintFilePatterns": [ + "packages/azure-theme/**/*.ts", + "packages/azure-theme/**/*.tsx" + ] + } + }, + "test": { + "executor": "@nx/jest:jest", + "outputs": ["{workspaceRoot}/coverage/{projectRoot}"], + "options": { + "jestConfig": "packages/azure-theme/jest.config.ts", + "passWithNoTests": true + } + }, + "type-check": { + "executor": "@fluentui-contrib/nx-plugin:type-check" + }, + "storybook": { + "executor": "@nx/storybook:storybook", + "options": { + "port": 4400, + "configDir": "packages/azure-theme/.storybook" + }, + "configurations": { + "ci": { + "quiet": true + } + } + }, + "build-storybook": { + "executor": "@nx/storybook:build", + "outputs": ["{options.outputDir}"], + "options": { + "outputDir": "dist/storybook/azure-theme", + "configDir": "packages/azure-theme/.storybook" + }, + "configurations": { + "ci": { + "quiet": true + } + } + } + }, + "tags": [] +} diff --git a/packages/azure-theme/src/index.ts b/packages/azure-theme/src/index.ts new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/packages/azure-theme/src/index.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/azure-theme/stories/.gitkeep b/packages/azure-theme/stories/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/packages/azure-theme/tsconfig.json b/packages/azure-theme/tsconfig.json new file mode 100644 index 00000000..15d0c1ca --- /dev/null +++ b/packages/azure-theme/tsconfig.json @@ -0,0 +1,19 @@ +{ + "extends": "../../tsconfig.base.json", + "files": [], + "compilerOptions": { + "jsx": "react" + }, + "include": [], + "references": [ + { + "path": "./tsconfig.lib.json" + }, + { + "path": "./tsconfig.spec.json" + }, + { + "path": "./.storybook/tsconfig.json" + } + ] +} diff --git a/packages/azure-theme/tsconfig.lib.json b/packages/azure-theme/tsconfig.lib.json new file mode 100644 index 00000000..590b0063 --- /dev/null +++ b/packages/azure-theme/tsconfig.lib.json @@ -0,0 +1,18 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "declaration": true + }, + "include": ["src/**/*.ts"], + "exclude": [ + "jest.config.ts", + "src/**/*.test.ts", + "src/**/*.test.tsx", + "files/**", + "**/*.stories.ts", + "**/*.stories.js", + "**/*.stories.jsx", + "**/*.stories.tsx" + ] +} diff --git a/packages/azure-theme/tsconfig.spec.json b/packages/azure-theme/tsconfig.spec.json new file mode 100644 index 00000000..361fd5a7 --- /dev/null +++ b/packages/azure-theme/tsconfig.spec.json @@ -0,0 +1,14 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "module": "commonjs", + "types": ["jest", "node"] + }, + "include": [ + "jest.config.ts", + "src/**/*.test.ts", + "src/**/*.test.tsx", + "src/**/*.d.ts" + ] +} diff --git a/tsconfig.base.json b/tsconfig.base.json index 61bd7bc1..c479ce68 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -19,6 +19,7 @@ "@fluentui-contrib/accessible-chat": [ "packages/accessible-chat/src/index.ts" ], + "@fluentui-contrib/azure-theme": ["packages/azure-theme/src/index.ts"], "@fluentui-contrib/houdini-utils": [ "packages/houdini-utils/src/index.ts" ], diff --git a/yarn.lock b/yarn.lock index 4941393d..b19a9462 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6704,7 +6704,7 @@ core-js-pure@^3.23.3: resolved "https://registry.yarnpkg.com/core-js-pure/-/core-js-pure-3.30.2.tgz#005a82551f4af3250dcfb46ed360fad32ced114e" integrity sha512-p/npFUJXXBkCCTIlEGBdghofn00jWG6ZOtdoIXSJmAu2QBvN0IqpZXWweOytcwE6cfx8ZvVUy1vw8zxhe4Y2vg== -core-js@3.30.2, core-js@^3.6.5: +core-js@3.30.2: version "3.30.2" resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.30.2.tgz#6528abfda65e5ad728143ea23f7a14f0dcf503fc" integrity sha512-uBJiDmwqsbJCWHAwjrx3cvjbMXP7xD72Dmsn5LOJpiRmE3WbBbN5rCqQ2Qh6Ek6/eOrjlWngEynBWo4VxerQhg== @@ -13347,16 +13347,7 @@ string-length@^5.0.1: char-regex "^2.0.0" strip-ansi "^7.0.1" -"string-width-cjs@npm:string-width@^4.2.0": - version "4.2.3" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" - integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== - dependencies: - emoji-regex "^8.0.0" - is-fullwidth-code-point "^3.0.0" - strip-ansi "^6.0.1" - -string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: +"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -13430,14 +13421,7 @@ string_decoder@~1.1.1: dependencies: safe-buffer "~5.1.0" -"strip-ansi-cjs@npm:strip-ansi@^6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" - integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== - dependencies: - ansi-regex "^5.0.1" - -strip-ansi@^6.0.0, strip-ansi@^6.0.1: +"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== @@ -14788,7 +14772,7 @@ workspace-tools@^0.34.2: js-yaml "^4.1.0" micromatch "^4.0.0" -"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": +"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== @@ -14806,15 +14790,6 @@ wrap-ansi@^6.2.0: string-width "^4.1.0" strip-ansi "^6.0.0" -wrap-ansi@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" - integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== - dependencies: - ansi-styles "^4.0.0" - string-width "^4.1.0" - strip-ansi "^6.0.0" - wrap-ansi@^8.1.0: version "8.1.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214"