Skip to content

Commit

Permalink
feat(azure-theme): bootstrap new package (#180)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacqueline-ms committed May 23, 2024
1 parent 348d8fb commit 2125d9f
Show file tree
Hide file tree
Showing 19 changed files with 304 additions and 30 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 3 additions & 0 deletions packages/azure-theme/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "../../babel.config.json"
}
24 changes: 24 additions & 0 deletions packages/azure-theme/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
]
}
26 changes: 26 additions & 0 deletions packages/azure-theme/.storybook/main.ts
Original file line number Diff line number Diff line change
@@ -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
17 changes: 17 additions & 0 deletions packages/azure-theme/.storybook/preview.tsx
Original file line number Diff line number Diff line change
@@ -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) => (
<FluentProvider theme={webLightTheme}>
<Story />
</FluentProvider>
),
],
};

export default preview;
27 changes: 27 additions & 0 deletions packages/azure-theme/.storybook/tsconfig.json
Original file line number Diff line number Diff line change
@@ -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"
]
}
30 changes: 30 additions & 0 deletions packages/azure-theme/.swcrc
Original file line number Diff line number Diff line change
@@ -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"
}
11 changes: 11 additions & 0 deletions packages/azure-theme/README.md
Original file line number Diff line number Diff line change
@@ -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).
30 changes: 30 additions & 0 deletions packages/azure-theme/jest.config.ts
Original file line number Diff line number Diff line change
@@ -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',
};
17 changes: 17 additions & 0 deletions packages/azure-theme/package.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
61 changes: 61 additions & 0 deletions packages/azure-theme/project.json
Original file line number Diff line number Diff line change
@@ -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": []
}
1 change: 1 addition & 0 deletions packages/azure-theme/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
Empty file.
19 changes: 19 additions & 0 deletions packages/azure-theme/tsconfig.json
Original file line number Diff line number Diff line change
@@ -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"
}
]
}
18 changes: 18 additions & 0 deletions packages/azure-theme/tsconfig.lib.json
Original file line number Diff line number Diff line change
@@ -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"
]
}
14 changes: 14 additions & 0 deletions packages/azure-theme/tsconfig.spec.json
Original file line number Diff line number Diff line change
@@ -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"
]
}
1 change: 1 addition & 0 deletions tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
],
Expand Down
Loading

0 comments on commit 2125d9f

Please sign in to comment.