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(react-menu): migrate to new package structure #25015

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
34fa55d
migrate-converged: move stories to root
TristanWatanabe Aug 10, 2022
d861740
migrate-converged: update tests
TristanWatanabe Aug 10, 2022
c0c0ca0
migrate-converged:npmignore docs & stories folders
TristanWatanabe Aug 10, 2022
e812659
migrate-converged: move docs to docs subfolder
TristanWatanabe Aug 10, 2022
fb00d26
Merge branch 'master' into update-migrate-converged-to-move-stories-t…
TristanWatanabe Aug 22, 2022
b80675f
fix missing import
TristanWatanabe Aug 22, 2022
503956f
fix: ensure doc file is .md
TristanWatanabe Aug 22, 2022
3c50e6f
Remove unintentional format change
TristanWatanabe Aug 22, 2022
240795d
fix: update sb TS config to point to new stories folder for compilation
TristanWatanabe Aug 23, 2022
2611f71
update test
TristanWatanabe Aug 23, 2022
d31acbb
fix: linting now re-enabled for stories that live in new stories/ folder
TristanWatanabe Aug 26, 2022
4df11ac
feedback: add stories to paths and utilize it
TristanWatanabe Aug 26, 2022
d24f98b
Merge branch 'master' into update-migrate-converged-to-move-stories-t…
TristanWatanabe Sep 28, 2022
41a5a60
migrateE2eSetupToCypress function added, renames instances of e2e fun…
TristanWatanabe Sep 28, 2022
4da5509
Add migrateCommonFolderToTesting function, add clarifying comments, a…
TristanWatanabe Sep 28, 2022
0ce56a8
update removeTsIgnorePragmas func to reflect new stories location
TristanWatanabe Sep 28, 2022
30f3926
Remove unintended prettier changes after merge
TristanWatanabe Sep 28, 2022
18d094a
Remove unintended prettier changes
TristanWatanabe Sep 28, 2022
2b42693
add tests
TristanWatanabe Sep 29, 2022
a07041d
Make 'stories' a constant
TristanWatanabe Sep 29, 2022
30e2c77
add *.cy.tsx in cypress config spec pattern
TristanWatanabe Sep 29, 2022
a24291e
fix: turn off no-extraneous-dependencies lint rule for cypress test f…
TristanWatanabe Sep 29, 2022
ec892f0
Change file
TristanWatanabe Sep 29, 2022
67b03dd
fix glob pattern
TristanWatanabe Sep 29, 2022
a31151f
fix: use correct condition for moveDocsToSubfolder
TristanWatanabe Sep 29, 2022
bb27ff9
Update instances of the common folder to testing
TristanWatanabe Sep 29, 2022
2ba123c
fix bug in moveDocsSubfolder
TristanWatanabe Sep 29, 2022
3c016a1
fix tests to replace instances of common/ with testing/
TristanWatanabe Sep 29, 2022
73e09d0
Include new testing/ in tsconfig.spec.json & exclude cypress test fil…
TristanWatanabe Sep 29, 2022
297d34b
ensure that after each file in common/ is moved, files that import th…
TristanWatanabe Sep 29, 2022
ed37360
perform common folder migration before running tsconfig updates
TristanWatanabe Sep 29, 2022
7133bc3
fix: migrateCommonFolderToTesting now uses correct treepath when upda…
TristanWatanabe Sep 29, 2022
c047234
migrate menu
TristanWatanabe Sep 29, 2022
5181c0f
Change file
TristanWatanabe Sep 29, 2022
71889cf
disable eslint violations
TristanWatanabe Sep 29, 2022
7a5a1dd
add tests for migrateCommonFolderToTesting function
TristanWatanabe Sep 29, 2022
eae0266
nit: dont have stories as constant
TristanWatanabe Oct 1, 2022
21ba097
Move cypress file exclusion to setup Cypress and add test
TristanWatanabe Oct 1, 2022
0c3d328
nit: use new tree.read API
TristanWatanabe Oct 1, 2022
63d49b8
nit: rename test suite
TristanWatanabe Oct 1, 2022
a290a8f
nit: add TODOs
TristanWatanabe Oct 1, 2022
468a1fc
nit: remove if/else in favor of early returns
TristanWatanabe Oct 1, 2022
5438fb7
Merge branch 'master' into update-migrate-converged-to-move-stories-t…
TristanWatanabe Oct 1, 2022
9c4c8b7
Merge branch 'update-migrate-converged-to-move-stories-to-root' into …
TristanWatanabe Oct 1, 2022
a6eb297
update pkg json
TristanWatanabe Oct 1, 2022
b701d2f
Merge branch 'master' into menu-migrate-to-new-package-structure
TristanWatanabe Oct 1, 2022
7ea67c8
remove unintended prettier change
TristanWatanabe Oct 3, 2022
5d001f0
nit: use shorthand for files
TristanWatanabe Oct 1, 2022
d90505c
Remove unintended prettier changes caused by ...
TristanWatanabe Oct 4, 2022
d0eddb7
Merge branch 'master' into menu-migrate-to-new-package-structure
TristanWatanabe Oct 1, 2022
c873ba3
Remove unintended prettier change
TristanWatanabe Oct 5, 2022
3a72446
Merge branch 'master' into menu-migrate-to-new-package-structure
TristanWatanabe Oct 12, 2022
53b591e
Change file
TristanWatanabe Oct 12, 2022
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": "patch",
"comment": "chore: Migrate to new package structure",
"packageName": "@fluentui/react-menu",
"email": "[email protected]",
"dependentChangeType": "patch"
}
5 changes: 3 additions & 2 deletions packages/react-components/react-menu/.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-menu/.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"]
}
7 changes: 4 additions & 3 deletions packages/react-components/react-menu/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Fluent UI menu component",
"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 Down Expand Up @@ -61,9 +61,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
Expand Up @@ -10,7 +10,7 @@ import {
menuTriggerSelector,
menuItemSelector,
menuSelector,
} from './selectors';
} from '../../testing/selectors';

import {
Menu,
Expand Down Expand Up @@ -149,6 +149,7 @@ describe('Custom Trigger', () => {
};

return (
// eslint-disable-next-line react/jsx-no-bind
<Menu open={open} onOpenChange={onOpenChange}>
<MenuTrigger>
<CustomMenuTrigger />
Expand Down Expand Up @@ -692,6 +693,7 @@ describe(`Nested Menus`, () => {
};

return (
// eslint-disable-next-line react/jsx-no-bind
<Menu open={open} onOpenChange={onOpenChange}>
<MenuTrigger>
<MenuItem>Editor Layout</MenuItem>
Expand All @@ -715,6 +717,7 @@ describe(`Nested Menus`, () => {
};

return (
// eslint-disable-next-line react/jsx-no-bind
<Menu open={open} onOpenChange={onOpenChange}>
<MenuTrigger>
<MenuItem>Appearance</MenuItem>
Expand All @@ -739,6 +742,7 @@ describe(`Nested Menus`, () => {
};

return (
// eslint-disable-next-line react/jsx-no-bind
<Menu open={open} onOpenChange={onOpenChange}>
<MenuTrigger>
<MenuItem>Preferences</MenuItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { resetIdsForTests } from '@fluentui/react-utilities';
import * as React from 'react';
import { Menu } from './Menu';
import { render, fireEvent } from '@testing-library/react';
import { isConformant } from '../../common/isConformant';
import { isConformant } from '../../testing/isConformant';
import { MenuTrigger } from '../MenuTrigger/index';
import { MenuList } from '../MenuList/index';
import { MenuItem } from '../MenuItem/index';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import { MenuDivider } from './MenuDivider';
import * as renderer from 'react-test-renderer';
import { isConformant } from '../../common/isConformant';
import { isConformant } from '../../testing/isConformant';

describe('MenuDivider', () => {
isConformant({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as React from 'react';
import { MenuGroup } from './MenuGroup';
import * as renderer from 'react-test-renderer';
import { render } from '@testing-library/react';
import { isConformant } from '../../common/isConformant';
import { isConformant } from '../../testing/isConformant';

describe('MenuGroup', () => {
isConformant({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from 'react';
import { MenuGroupHeader } from './MenuGroupHeader';
import * as renderer from 'react-test-renderer';
import { render } from '@testing-library/react';
import { isConformant } from '../../common/isConformant';
import { isConformant } from '../../testing/isConformant';
import { MenuGroupContextProvider } from '../../contexts/menuGroupContext';

describe('MenuGroupHeader', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import { render, fireEvent, createEvent } from '@testing-library/react';
import { Enter, Space } from '@fluentui/keyboard-keys';
import { MenuItem } from './MenuItem';
import * as renderer from 'react-test-renderer';
import { isConformant } from '../../common/isConformant';
import { isConformant } from '../../testing/isConformant';
import { MenuTriggerContextProvider } from '../../contexts/menuTriggerContext';
import { MenuListProvider } from '../../contexts/menuListContext';
import { mockUseMenuContext } from '../../common/mockUseMenuContext';
import { mockUseMenuContext } from '../../testing/mockUseMenuContext';
import type { MenuItemProps } from './MenuItem.types';

jest.mock('../../contexts/menuContext');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import * as React from 'react';
import * as renderer from 'react-test-renderer';
import { Enter, Space } from '@fluentui/keyboard-keys';
import { render, fireEvent } from '@testing-library/react';
import { isConformant } from '../../common/isConformant';
import { isConformant } from '../../testing/isConformant';
import { MenuItemCheckbox } from './MenuItemCheckbox';
import { MenuListProvider } from '../../contexts/menuListContext';
import { mockUseMenuContext } from '../../common/mockUseMenuContext';
import { mockUseMenuContext } from '../../testing/mockUseMenuContext';
import type { MenuListContextValue } from '../../contexts/menuListContext';
import type { MenuItemCheckboxProps } from './MenuItemCheckbox.types';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as renderer from 'react-test-renderer';
import { Enter, Space } from '@fluentui/keyboard-keys';
import { render, fireEvent } from '@testing-library/react';
import { MenuItemRadio } from './MenuItemRadio';
import { isConformant } from '../../common/isConformant';
import { isConformant } from '../../testing/isConformant';
import { MenuListProvider } from '../../contexts/menuListContext';
import type { MenuListContextValue } from '../../contexts/menuListContext';
import type { MenuItemRadioProps } from './MenuItemRadio.types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { mount as mountBase } from '@cypress/react';
import { FluentProvider } from '@fluentui/react-provider';
import { teamsLightTheme } from '@fluentui/react-theme';

import { menuTriggerSelector, menuItemSelector, menuSelector } from './selectors';
import { menuTriggerSelector, menuItemSelector, menuSelector } from '../../testing/selectors';

import { MenuList, MenuItem, Menu, MenuTrigger, MenuPopover } from '@fluentui/react-menu';
const mount = (element: JSX.Element) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { MenuList } from './MenuList';
import * as renderer from 'react-test-renderer';
import { render } from '@testing-library/react';
import { useHasParentContext } from '@fluentui/react-context-selector';
import { isConformant } from '../../common/isConformant';
import { isConformant } from '../../testing/isConformant';
import { MenuListContext } from '../../contexts/menuListContext';

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

describe('MenuPopover', () => {
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 { MenuSplitGroup } from './MenuSplitGroup';
import { isConformant } from '../../common/isConformant';
import { isConformant } from '../../testing/isConformant';

describe('MenuSplitGroup', () => {
isConformant({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import * as React from 'react';
import { MenuTrigger } from './MenuTrigger';
import * as renderer from 'react-test-renderer';
import { createEvent, fireEvent, render } from '@testing-library/react';
import { isConformant } from '../../common/isConformant';
import { mockUseMenuContext } from '../../common/mockUseMenuContext';
import { isConformant } from '../../testing/isConformant';
import { mockUseMenuContext } from '../../testing/mockUseMenuContext';
import { useMenuTriggerContext_unstable } from '../../contexts/menuTriggerContext';
import { Enter } from '@fluentui/keyboard-keys';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"extends": "../tsconfig.json",
"extends": "./tsconfig.json",
"compilerOptions": {
"isolatedModules": false,
"types": ["node", "cypress", "cypress-storybook/cypress", "cypress-real-events"],
"lib": ["ES2019", "dom"]
},
"include": ["**/*.ts", "**/*.tsx"]
"include": ["**/*.cy.ts", "**/*.cy.tsx"]
}
2 changes: 1 addition & 1 deletion packages/react-components/react-menu/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"path": "./.storybook/tsconfig.json"
},
{
"path": "./e2e/tsconfig.json"
"path": "./tsconfig.cy.json"
}
]
}
6 changes: 4 additions & 2 deletions packages/react-components/react-menu/tsconfig.lib.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@
"types": ["static-assets", "environment"]
},
"exclude": [
"./src/common/**",
"./src/testing/**",
"**/*.spec.ts",
"**/*.spec.tsx",
"**/*.test.ts",
"**/*.test.tsx",
"**/*.stories.ts",
"**/*.stories.tsx"
"**/*.stories.tsx",
"**/*.cy.ts",
"**/*.cy.tsx"
],
"include": ["./src/**/*.ts", "./src/**/*.tsx"]
}
10 changes: 9 additions & 1 deletion packages/react-components/react-menu/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"
]
}