Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(make-styles): migrate to new DX #18673

Merged
merged 7 commits into from
Jun 25, 2021
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "none",
"comment": "migrate to new DX",
"packageName": "@fluentui/make-styles",
"email": "[email protected]",
"dependentChangeType": "none"
}
1 change: 1 addition & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ module.exports = {
'<rootDir>/packages/react-positioning',
'<rootDir>/packages/react-link',
'<rootDir>/packages/react-divider',
'<rootDir>/packages/make-styles',
],
};
2 changes: 1 addition & 1 deletion nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"@fluentui/jest-serializer-make-styles": { "implicitDependencies": [] },
"@fluentui/jest-serializer-merge-styles": { "implicitDependencies": [] },
"@fluentui/keyboard-key": { "implicitDependencies": [] },
"@fluentui/make-styles": { "implicitDependencies": [] },
"@fluentui/make-styles": { "tags": ["vNext", "platform:web"], "implicitDependencies": [] },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to double check the context boundary, is this package solely for web platform or it can be used also within node ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a web package, some functionality is related to SSR, but I am not considering this usage as within Node.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kk, for better context

  • platform:web - package used on web
  • platform:node - package used with node
  • platform:any - package that can be used in both

We'll enable lint rule that will respect those contexts and staticly defined rules in the future to prevent for example importing node package into web package

"@fluentui/merge-styles": { "implicitDependencies": [] },
"@fluentui/monaco-editor": { "implicitDependencies": [] },
"@fluentui/public-docsite-setup": { "implicitDependencies": [] },
Expand Down
1 change: 1 addition & 0 deletions packages/make-styles/config/api-extractor.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
"extends": "@fluentui/scripts/api-extractor/api-extractor.common.json"
}
5 changes: 5 additions & 0 deletions packages/make-styles/config/api-extractor.local.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
"extends": "./api-extractor.json",
"mainEntryPointFilePath": "<projectFolder>/dist/<unscopedPackageName>/src/index.d.ts"
}
22 changes: 18 additions & 4 deletions packages/make-styles/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
const { createConfig } = require('@fluentui/scripts/jest/jest-resources');
// @ts-check

const config = createConfig();

module.exports = config;
/**
* @type {jest.InitialOptions}
*/
module.exports = {
displayName: 'make-styles',
preset: '../../jest.preset.js',
globals: {
'ts-jest': {
tsConfig: '<rootDir>/tsconfig.json',
diagnostics: false,
},
},
transform: {
'^.+\\.tsx?$': 'ts-jest',
},
coverageDirectory: './coverage',
};
6 changes: 4 additions & 2 deletions packages/make-styles/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@
"code-style": "just-scripts code-style",
"just": "just-scripts",
"lint": "just-scripts lint",
"test": "just-scripts test",
"test:watch": "just-scripts jest-watch"
"test": "jest",
"test:watch": "just-scripts jest-watch",
"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/make-styles/src && yarn docs"
},
"devDependencies": {
"@fluentui/eslint-plugin": "^1.3.1",
Expand Down
18 changes: 7 additions & 11 deletions packages/make-styles/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
{
"extends": "../../tsconfig.base.json",
"include": ["src"],
"compilerOptions": {
"target": "ES5",
"module": "CommonJS",
"lib": ["es5", "dom", "ES2015.Core", "ES2015.Proxy", "ES2015.Symbol", "ES2015.Symbol.WellKnown"],
"outDir": "dist",
"target": "es5",
"module": "commonjs",
"jsx": "react",
"declaration": true,
"sourceMap": true,
"experimentalDecorators": true,
"importHelpers": true,
"noUnusedLocals": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"moduleResolution": "node",
"preserveConstEnums": true,
"lib": ["ES5", "ES2015.Proxy", "ES2015.Symbol", "ES2015.Symbol.WellKnown", "DOM", "ES2015.Core"],
"typeRoots": ["../../node_modules/@types", "../../typings"],
"types": ["custom-global", "jest", "inline-style-expand-shorthand"]
},
"include": ["src"]
"types": ["jest", "custom-global", "inline-style-expand-shorthand"]
}
}
6 changes: 5 additions & 1 deletion workspace.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,11 @@
"projectType": "library"
},
"@fluentui/keyboard-key": { "root": "packages/keyboard-key", "projectType": "library" },
"@fluentui/make-styles": { "root": "packages/make-styles", "projectType": "library" },
"@fluentui/make-styles": {
"root": "packages/make-styles",
"projectType": "library",
"sourceRoot": "packages/make-styles/src"
},
"@fluentui/merge-styles": { "root": "packages/merge-styles", "projectType": "library" },
"@fluentui/monaco-editor": { "root": "packages/monaco-editor", "projectType": "library" },
"@fluentui/public-docsite-setup": { "root": "packages/public-docsite-setup", "projectType": "library" },
Expand Down