Skip to content

Commit

Permalink
Move test-data to separate package (#3338)
Browse files Browse the repository at this point in the history
  • Loading branch information
chaance authored Jan 22, 2025
1 parent da0088c commit 108ff0a
Show file tree
Hide file tree
Showing 15 changed files with 99 additions and 5 deletions.
8 changes: 8 additions & 0 deletions .yarn/versions/3e3ea0c1.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
declined:
- primitives
- "@repo/test-data"
- "@radix-ui/react-context-menu"
- "@radix-ui/react-dropdown-menu"
- "@radix-ui/react-menu"
- "@radix-ui/react-menubar"
- "@radix-ui/react-select"
41 changes: 41 additions & 0 deletions internal/test-data/foods.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
export const foodGroups: Array<{
label?: string;
foods: Array<{ value: string; label: string; disabled?: boolean }>;
}> = [
{
label: 'Fruits',
foods: [
{ value: 'apple', label: 'Apple' },
{ value: 'banana', label: 'Banana' },
{ value: 'blueberry', label: 'Blueberry' },
{ value: 'grapes', label: 'Grapes' },
{ value: 'pineapple', label: 'Pineapple' },
],
},
{
label: 'Vegetables',
foods: [
{ value: 'aubergine', label: 'Aubergine' },
{ value: 'broccoli', label: 'Broccoli' },
{ value: 'carrot', label: 'Carrot', disabled: true },
{ value: 'courgette', label: 'Courgette' },
{ value: 'leek', label: 'Leek' },
],
},
{
label: 'Meat',
foods: [
{ value: 'beef', label: 'Beef' },
{ value: 'beef-with-sauce', label: 'Beef with sauce' },
{ value: 'chicken', label: 'Chicken' },
{ value: 'lamb', label: 'Lamb' },
{ value: 'pork', label: 'Pork' },
],
},
{
foods: [
{ value: 'candies', label: 'Candies' },
{ value: 'chocolates', label: 'Chocolates' },
],
},
];
17 changes: 17 additions & 0 deletions internal/test-data/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "@repo/test-data",
"version": "0.0.0",
"private": true,
"license": "MIT",
"type": "module",
"devDependencies": {
"@repo/typescript-config": "workspace:*",
"typescript": "^5.7.3"
},
"exports": {
"./*": "./*.ts"
},
"scripts": {
"check-types": "tsc --noEmit"
}
}
9 changes: 9 additions & 0 deletions internal/test-data/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "@repo/typescript-config/base.json",
"compilerOptions": {
"rootDir": ".",
"outDir": "dist"
},
"include": ["**/*"],
"exclude": ["node_modules", "dist"]
}
1 change: 1 addition & 0 deletions packages/react/context-menu/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"@radix-ui/react-use-controllable-state": "workspace:*"
},
"devDependencies": {
"@repo/test-data": "workspace:*",
"@repo/typescript-config": "workspace:*",
"@types/react": "^19.0.7",
"@types/react-dom": "^19.0.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/react/context-menu/src/ContextMenu.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import * as ContextMenu from '@radix-ui/react-context-menu';
import { foodGroups } from '../../../../test-data/foods';
import { foodGroups } from '@repo/test-data/foods';
import styles from './ContextMenu.stories.module.css';

export default { title: 'Components/ContextMenu' };
Expand Down
1 change: 1 addition & 0 deletions packages/react/dropdown-menu/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"@radix-ui/react-use-controllable-state": "workspace:*"
},
"devDependencies": {
"@repo/test-data": "workspace:*",
"@repo/typescript-config": "workspace:*",
"@types/react": "^19.0.7",
"@types/react-dom": "^19.0.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/react/dropdown-menu/src/DropdownMenu.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as Tooltip from '@radix-ui/react-tooltip';
import * as Dialog from '@radix-ui/react-dialog';
import { SIDE_OPTIONS, ALIGN_OPTIONS } from '@radix-ui/react-popper';
import * as DropdownMenu from '@radix-ui/react-dropdown-menu';
import { foodGroups } from '../../../../test-data/foods';
import { foodGroups } from '@repo/test-data/foods';
import styles from './DropdownMenu.stories.module.css';

export default { title: 'Components/DropdownMenu' };
Expand Down
1 change: 1 addition & 0 deletions packages/react/menu/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"react-remove-scroll": "^2.6.1"
},
"devDependencies": {
"@repo/test-data": "workspace:*",
"@repo/typescript-config": "workspace:*",
"@types/react": "^19.0.7",
"@types/react-dom": "^19.0.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/react/menu/src/Menu.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import * as Menu from '@radix-ui/react-menu';
import { foodGroups } from '../../../../test-data/foods';
import { foodGroups } from '@repo/test-data/foods';
import { DirectionProvider } from '@radix-ui/react-direction';
import styles from './Menu.stories.module.css';

Expand Down
1 change: 1 addition & 0 deletions packages/react/menubar/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"@radix-ui/react-use-controllable-state": "workspace:*"
},
"devDependencies": {
"@repo/test-data": "workspace:*",
"@repo/typescript-config": "workspace:*",
"@types/react": "^19.0.7",
"@types/react-dom": "^19.0.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/react/menubar/src/Menubar.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import * as Menubar from '@radix-ui/react-menubar';
import { foodGroups } from '../../../../test-data/foods';
import { foodGroups } from '@repo/test-data/foods';
import styles from './Menubar.stories.module.css';

const subTriggerClass = [styles.item, styles.subTrigger].join(' ');
Expand Down
1 change: 1 addition & 0 deletions packages/react/select/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"react-remove-scroll": "^2.6.1"
},
"devDependencies": {
"@repo/test-data": "workspace:*",
"@repo/typescript-config": "workspace:*",
"@types/react": "^19.0.7",
"@types/react-dom": "^19.0.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/react/select/src/Select.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from 'react';
import * as Select from '@radix-ui/react-select';
import { Label } from '@radix-ui/react-label';
import * as Dialog from '@radix-ui/react-dialog';
import { foodGroups } from '../../../../test-data/foods';
import { foodGroups } from '@repo/test-data/foods';
import styles from './Select.stories.module.css';

export default { title: 'Components/Select' };
Expand Down
14 changes: 14 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2651,6 +2651,7 @@ __metadata:
"@radix-ui/react-primitive": "workspace:*"
"@radix-ui/react-use-callback-ref": "workspace:*"
"@radix-ui/react-use-controllable-state": "workspace:*"
"@repo/test-data": "workspace:*"
"@repo/typescript-config": "workspace:*"
"@types/react": "npm:^19.0.7"
"@types/react-dom": "npm:^19.0.3"
Expand Down Expand Up @@ -2785,6 +2786,7 @@ __metadata:
"@radix-ui/react-menu": "workspace:*"
"@radix-ui/react-primitive": "workspace:*"
"@radix-ui/react-use-controllable-state": "workspace:*"
"@repo/test-data": "workspace:*"
"@repo/typescript-config": "workspace:*"
"@types/react": "npm:^19.0.7"
"@types/react-dom": "npm:^19.0.3"
Expand Down Expand Up @@ -2974,6 +2976,7 @@ __metadata:
"@radix-ui/react-roving-focus": "workspace:*"
"@radix-ui/react-slot": "workspace:*"
"@radix-ui/react-use-callback-ref": "workspace:*"
"@repo/test-data": "workspace:*"
"@repo/typescript-config": "workspace:*"
"@types/react": "npm:^19.0.7"
"@types/react-dom": "npm:^19.0.3"
Expand Down Expand Up @@ -3009,6 +3012,7 @@ __metadata:
"@radix-ui/react-primitive": "workspace:*"
"@radix-ui/react-roving-focus": "workspace:*"
"@radix-ui/react-use-controllable-state": "workspace:*"
"@repo/test-data": "workspace:*"
"@repo/typescript-config": "workspace:*"
"@types/react": "npm:^19.0.7"
"@types/react-dom": "npm:^19.0.3"
Expand Down Expand Up @@ -3357,6 +3361,7 @@ __metadata:
"@radix-ui/react-use-layout-effect": "workspace:*"
"@radix-ui/react-use-previous": "workspace:*"
"@radix-ui/react-visually-hidden": "workspace:*"
"@repo/test-data": "workspace:*"
"@repo/typescript-config": "workspace:*"
"@types/react": "npm:^19.0.7"
"@types/react-dom": "npm:^19.0.3"
Expand Down Expand Up @@ -3840,6 +3845,15 @@ __metadata:
languageName: unknown
linkType: soft

"@repo/test-data@workspace:*, @repo/test-data@workspace:internal/test-data":
version: 0.0.0-use.local
resolution: "@repo/test-data@workspace:internal/test-data"
dependencies:
"@repo/typescript-config": "workspace:*"
typescript: "npm:^5.7.3"
languageName: unknown
linkType: soft

"@repo/typescript-config@workspace:*, @repo/typescript-config@workspace:internal/typescript-config":
version: 0.0.0-use.local
resolution: "@repo/typescript-config@workspace:internal/typescript-config"
Expand Down

0 comments on commit 108ff0a

Please sign in to comment.