Skip to content

Commit

Permalink
chore(react-text): migrate to new package structure (microsoft#25231)
Browse files Browse the repository at this point in the history
  • Loading branch information
TristanWatanabe authored and NotWoods committed Nov 18, 2022
1 parent d384599 commit 38ce3be
Show file tree
Hide file tree
Showing 37 changed files with 47 additions and 32 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "chore: Migrate to new package structure.",
"packageName": "@fluentui/react-text",
"email": "tristan.watanabe@gmail.com",
"dependentChangeType": "patch"
}
5 changes: 3 additions & 2 deletions packages/react-components/react-text/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
bundle-size/
config/
coverage/
e2e/
docs/
etc/
node_modules/
src/
stories/
dist/types/
temp/
__fixtures__
Expand All @@ -16,7 +17,7 @@ __tests__
*.api.json
*.log
*.spec.*
*.stories.*
*.cy.*
*.test.*
*.yml

Expand Down
2 changes: 1 addition & 1 deletion packages/react-components/react-text/.storybook/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const rootMain = require('../../../../.storybook/main');

module.exports = /** @type {Omit<import('../../../../.storybook/main'), 'typescript'|'babel'>} */ ({
...rootMain,
stories: [...rootMain.stories, '../src/**/*.stories.mdx', '../src/**/index.stories.@(ts|tsx)'],
stories: [...rootMain.stories, '../stories/**/*.stories.mdx', '../stories/**/index.stories.@(ts|tsx)'],
addons: [...rootMain.addons],
webpackFinal: (config, options) => {
const localConfig = { ...rootMain.webpackFinal(config, options) };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
"checkJs": true,
"types": ["static-assets", "environment", "storybook__addons"]
},
"include": ["../src/**/*.stories.ts", "../src/**/*.stories.tsx", "*.js"]
"include": ["../stories/**/*.stories.ts", "../stories/**/*.stories.tsx", "*.js"]
}
2 changes: 1 addition & 1 deletion packages/react-components/react-text/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const App = () => (

## Typography wrappers

![List of typography variants by sorted descending by size](./assets/typography-examples.gif 'Typography wrapper list')
![List of typography variants by sorted descending by size](./docs/assets/typography-examples.gif 'Typography wrapper list')

Wrappers offer an easy way to use text according to the Fluent Design System while also providing semantic code readability.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
"extends": "@fluentui/scripts/api-extractor/api-extractor.common.v-next.json",
"mainEntryPointFilePath": "<projectFolder>/dist/types/index.d.ts"
"dtsRollup": {
"enabled": true,
"untrimmedFilePath": "",
"publicTrimmedFilePath": "<projectFolder>/dist/index.d.ts"
}
}

This file was deleted.

12 changes: 6 additions & 6 deletions packages/react-components/react-text/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Text is a typography and styling abstraction component that can be used to ensure the consistency of all text across your application.",
"main": "lib-commonjs/index.js",
"module": "lib/index.js",
"typings": "dist/index.d.ts",
"typings": "./dist/index.d.ts",
"sideEffects": false,
"repository": {
"type": "git",
Expand All @@ -20,10 +20,9 @@
"lint": "just-scripts lint",
"start": "yarn storybook",
"test": "jest --passWithNoTests",
"docs": "api-extractor run --config=config/api-extractor.local.json --local",
"build:local": "tsc -p ./tsconfig.lib.json --module esnext --emitDeclarationOnly && node ../../../scripts/typescript/normalize-import --output ./dist/types/packages/react-components/react-text/src && yarn docs",
"storybook": "start-storybook",
"type-check": "tsc -b tsconfig.json"
"type-check": "tsc -b tsconfig.json",
"generate-api": "tsc -p ./tsconfig.lib.json --emitDeclarationOnly && just-scripts api-extractor"
},
"devDependencies": {
"@fluentui/eslint-plugin": "*",
Expand Down Expand Up @@ -51,9 +50,10 @@
},
"exports": {
".": {
"types": "./lib/index.d.ts",
"types": "./dist/index.d.ts",
"import": "./lib/index.js",
"require": "./lib-commonjs/index.js"
}
},
"./package.json": "./package.json"
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import { render } from '@testing-library/react';
import { Body1 } from './Body1';
import { isConformant } from '../../common/isConformant';
import { isConformant } from '../../testing/isConformant';

describe('Body1', () => {
isConformant({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import { render } from '@testing-library/react';
import { Caption1 } from './Caption1';
import { isConformant } from '../../common/isConformant';
import { isConformant } from '../../testing/isConformant';

describe('Caption1', () => {
isConformant({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import { render } from '@testing-library/react';
import { Caption2 } from './Caption2';
import { isConformant } from '../../common/isConformant';
import { isConformant } from '../../testing/isConformant';

describe('Caption2', () => {
isConformant({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import { render } from '@testing-library/react';
import { Display } from './Display';
import { isConformant } from '../../common/isConformant';
import { isConformant } from '../../testing/isConformant';

describe('Display', () => {
isConformant({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import { render } from '@testing-library/react';
import { LargeTitle } from './LargeTitle';
import { isConformant } from '../../common/isConformant';
import { isConformant } from '../../testing/isConformant';

describe('LargeTitle', () => {
isConformant({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import { render } from '@testing-library/react';
import { Subtitle1 } from './Subtitle1';
import { isConformant } from '../../common/isConformant';
import { isConformant } from '../../testing/isConformant';

describe('Subtitle1', () => {
isConformant({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import { render } from '@testing-library/react';
import { Subtitle2 } from './Subtitle2';
import { isConformant } from '../../common/isConformant';
import { isConformant } from '../../testing/isConformant';

describe('Subtitle2', () => {
isConformant({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import { render } from '@testing-library/react';
import { Text } from './Text';
import { isConformant } from '../../common/isConformant';
import { isConformant } from '../../testing/isConformant';
import { TextProps } from './Text.types';

describe('Text', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import { render } from '@testing-library/react';
import { Title1 } from './Title1';
import { isConformant } from '../../common/isConformant';
import { isConformant } from '../../testing/isConformant';

describe('Title1', () => {
isConformant({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import { render } from '@testing-library/react';
import { Title2 } from './Title2';
import { isConformant } from '../../common/isConformant';
import { isConformant } from '../../testing/isConformant';

describe('Title2', () => {
isConformant({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import { render } from '@testing-library/react';
import { Title3 } from './Title3';
import { isConformant } from '../../common/isConformant';
import { isConformant } from '../../testing/isConformant';

describe('Title3', () => {
isConformant({
Expand Down
6 changes: 3 additions & 3 deletions packages/react-components/react-text/tsconfig.lib.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
"compilerOptions": {
"noEmit": false,
"lib": ["ES2019", "dom"],
"outDir": "dist",
"declaration": true,
"declarationDir": "dist/types",
"declarationDir": "../../../dist/out-tsc/types",
"outDir": "../../../dist/out-tsc",
"inlineSources": true,
"types": ["static-assets", "environment"]
},
"exclude": [
"./src/common/**",
"./src/testing/**",
"**/*.spec.ts",
"**/*.spec.tsx",
"**/*.test.ts",
Expand Down
10 changes: 9 additions & 1 deletion packages/react-components/react-text/tsconfig.spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,13 @@
"outDir": "dist",
"types": ["jest", "node", "@testing-library/jest-dom"]
},
"include": ["**/*.spec.ts", "**/*.spec.tsx", "**/*.test.ts", "**/*.test.tsx", "**/*.d.ts"]
"include": [
"**/*.spec.ts",
"**/*.spec.tsx",
"**/*.test.ts",
"**/*.test.tsx",
"**/*.d.ts",
"./src/testing/**/*.ts",
"./src/testing/**/*.tsx"
]
}

0 comments on commit 38ce3be

Please sign in to comment.