Skip to content

Commit

Permalink
react-label - Migration to new DX (#18656)
Browse files Browse the repository at this point in the history
* Migrate to new DX

* Change files

* Migrate to new DX

* Change files

* Removed react-link dependency from react-examples

* Fixed issues
  • Loading branch information
tringakrasniqi authored Jun 25, 2021
1 parent edb153e commit 5a6dd90
Show file tree
Hide file tree
Showing 15 changed files with 89 additions and 30 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "none",
"comment": "Migrate to new DX",
"packageName": "@fluentui/react-examples",
"email": "[email protected]",
"dependentChangeType": "none"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "none",
"comment": "Migrate to new DX",
"packageName": "@fluentui/react-label",
"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 @@ -12,5 +12,6 @@ module.exports = {
'<rootDir>/packages/react-popover',
'<rootDir>/packages/react-link',
'<rootDir>/packages/react-divider',
'<rootDir>/packages/react-label',
],
};
2 changes: 1 addition & 1 deletion nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@
"@fluentui/web-components": { "implicitDependencies": [] },
"@fluentui/webpack-utilities": { "implicitDependencies": [] },
"@fluentui/scripts": { "implicitDependencies": [] },
"@fluentui/react-label": { "tags": ["vNext", "platform:web"], "implicitDependencies": [] },
"@fluentui/react-popover": { "tags": ["vNext", "platform:web"], "implicitDependencies": [] },
"@fluentui/react-label": { "implicitDependencies": [] },
"nx-workspace-tools": { "tags": [] },
"@fluentui/react-aria": { "tags": ["vNext"], "implicitDependencies": [] }
}
Expand Down
2 changes: 0 additions & 2 deletions packages/react-examples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@
"@fluentui/react-focus": "^8.1.4",
"@fluentui/react-hooks": "^8.2.2",
"@fluentui/react-icons-mdl2": "^1.1.3",
"@fluentui/react-label": "^9.0.0-alpha.9",
"@fluentui/react-link": "^9.0.0-alpha.48",
"@fluentui/react-make-styles": "^9.0.0-alpha.42",
"@fluentui/react-menu": "^9.0.0-alpha.40",
"@fluentui/react-provider": "^9.0.0-alpha.47",
Expand Down
11 changes: 11 additions & 0 deletions packages/react-label/.storybook/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const rootMain = require('../../../.storybook/main');

module.exports = /** @type {Pick<import('../../../.storybook/main').StorybookConfig,'addons'|'stories'|'webpackFinal'>} */ ({
stories: [...rootMain.stories, '../src/**/*.stories.mdx', '../src/**/*.stories.@(ts|tsx)'],
addons: [...rootMain.addons],
webpackFinal: (config, options) => {
const localConfig = { ...rootMain.webpackFinal(config, options) };

return localConfig;
},
});
3 changes: 3 additions & 0 deletions packages/react-label/.storybook/preview.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import * as rootPreview from '../../../.storybook/preview';

export const decorators = [...rootPreview.decorators];
9 changes: 9 additions & 0 deletions packages/react-label/.storybook/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"allowJs": true,
"checkJs": true
},
"exclude": ["../**/*.test.ts", "../**/*.test.js", "../**/*.test.tsx", "../**/*.test.jsx"],
"include": ["../src/**/*", "*.js"]
}
5 changes: 5 additions & 0 deletions packages/react-label/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"
}
26 changes: 19 additions & 7 deletions packages/react-label/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
const { createConfig } = require('@fluentui/scripts/jest/jest-resources');
const path = require('path');
// @ts-check

const config = createConfig({
setupFiles: [path.resolve(path.join(__dirname, 'config', 'tests.js'))],
/**
* @type {jest.InitialOptions}
*/
module.exports = {
displayName: 'react-label',
preset: '../../jest.preset.js',
globals: {
'ts-jest': {
tsConfig: '<rootDir>/tsconfig.json',
diagnostics: false,
},
},
transform: {
'^.+\\.tsx?$': 'ts-jest',
},
coverageDirectory: './coverage',
setupFilesAfterEnv: ['./config/tests.js'],
snapshotSerializers: ['@fluentui/jest-serializer-make-styles'],
});

module.exports = config;
};
9 changes: 5 additions & 4 deletions packages/react-label/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@
"code-style": "just-scripts code-style",
"just": "just-scripts",
"lint": "just-scripts lint",
"start": "just-scripts dev:storybook",
"start-test": "just-scripts jest-watch",
"test": "just-scripts test",
"update-snapshots": "just-scripts jest -u"
"start": "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-label/src && yarn docs",
"storybook": "start-storybook"
},
"devDependencies": {
"@fluentui/eslint-plugin": "^1.3.1",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { Label, LabelProps } from '@fluentui/react-label';
import { Label, LabelProps } from './index';
import { makeStyles } from '@fluentui/react-make-styles';

const useStyles = makeStyles({
Expand Down Expand Up @@ -159,3 +159,8 @@ export const CustomizableLabelExample = () => {
</div>
);
};

export default {
title: 'Components/Label',
component: Label,
};
21 changes: 8 additions & 13 deletions packages/react-label/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
{
"extends": "../../tsconfig.base.json",
"include": ["src"],
"compilerOptions": {
"baseUrl": ".",
"target": "ES5",
"module": "CommonJS",
"lib": ["es5", "dom"],
"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", "dom"],
"skipLibCheck": true,
"typeRoots": ["../../node_modules/@types", "../../typings"],
"types": ["jest", "custom-global"]
},
"include": ["src"]
"types": ["jest", "custom-global", "inline-style-expand-shorthand"]
}
}
3 changes: 2 additions & 1 deletion tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
"@fluentui/react-aria": ["packages/react-aria/src/index.ts"],
"@fluentui/react-link": ["packages/react-link/src/index.ts"],
"@fluentui/react-image": ["packages/react-image/src/index.ts"],
"@fluentui/react-divider": ["packages/react-divider/src/index.ts"]
"@fluentui/react-divider": ["packages/react-divider/src/index.ts"],
"@fluentui/react-label": ["packages/react-label/src/index.ts"]
}
},
"exclude": ["node_modules"]
Expand Down
6 changes: 5 additions & 1 deletion workspace.json
Original file line number Diff line number Diff line change
Expand Up @@ -177,12 +177,16 @@
"@fluentui/web-components": { "root": "packages/web-components", "projectType": "library" },
"@fluentui/webpack-utilities": { "root": "packages/webpack-utilities", "projectType": "library" },
"@fluentui/scripts": { "root": "scripts", "projectType": "library" },
"@fluentui/react-label": {
"root": "packages/react-label",
"projectType": "library",
"sourceRoot": "packages/react-label/src"
},
"@fluentui/react-popover": {
"root": "packages/react-popover",
"projectType": "library",
"sourceRoot": "packages/react-popover/src"
},
"@fluentui/react-label": { "root": "packages/react-label", "projectType": "library" },
"nx-workspace-tools": {
"root": "tools",
"sourceRoot": "tools",
Expand Down

0 comments on commit 5a6dd90

Please sign in to comment.