Skip to content

Commit faadad0

Browse files
committed
Use yarn workspaces
1 parent d916231 commit faadad0

12 files changed

+13895
-71
lines changed

README.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -215,13 +215,15 @@ Symbol to define `null` on `forceValue` and `defaultValue` on literal schema
215215

216216
## Development
217217

218-
### Library
219-
220218
```bash
221-
cd lib
222-
223219
# Install dependencies
224220
yarn install
221+
```
222+
223+
### Lib
224+
225+
```bash
226+
cd lib
225227

226228
# Eslint
227229
yarn lint
@@ -241,10 +243,6 @@ yarn test
241243
```bash
242244
cd storybook
243245

244-
# Install dependencies
245-
yarn install
246-
247246
# Start storybook
248247
yarn storybook
249248
```
250-

package.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"private": true,
3+
"workspaces": [
4+
"lib",
5+
"storybook"
6+
]
7+
}

storybook/.unimportedrc.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"entry": ["./stories/**/*.stories.tsx"],
3+
"ignorePatterns": ["node_modules/**", "build/**"],
4+
"ignoreUnimported": ["**/*.d.ts"],
5+
"extensions": [".ts", ".js", ".tsx", ".jsx"]
6+
}

storybook/package.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{
2-
"name": "toggle-form-storybook",
2+
"name": "@togglecorp/toggle-form-storybook",
33
"version": "1.0.0",
44
"description": "",
5-
"main": "index.js",
65
"scripts": {
76
"typecheck": "tsc",
87
"lint": "eslint ./stories --report-unused-disable-directives",
8+
"check-unused": "unimported",
99
"storybook": "NODE_OPTIONS=--openssl-legacy-provider start-storybook -p 6006",
10-
"build-storybook": "build-storybook"
10+
"storybook:build": "build-storybook"
1111
},
1212
"keywords": [],
1313
"author": "",
@@ -43,8 +43,10 @@
4343
},
4444
"dependencies": {
4545
"@togglecorp/fujs": "^1.9.3",
46+
"@togglecorp/toggle-form": "^2.0.0",
4647
"@togglecorp/toggle-ui": "^0.15.0",
4748
"react": "^18.2.0",
48-
"react-dom": "^18.2.0"
49+
"react-dom": "^18.2.0",
50+
"unimported": "^1.22.0"
4951
}
5052
}

storybook/stories/ConditionalForm.stories.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@ import {
66
Checkbox,
77
} from '@togglecorp/toggle-ui';
88

9-
import useForm from '../../lib/src/form';
10-
import { createSubmitHandler } from '../../lib/src/submissionHelper';
11-
import type { PartialForm } from '../../lib/src/types';
12-
import { nullValue, nonFieldError } from '../../lib/src/types';
13-
import { addCondition } from '../../lib/src/schema';
14-
import type { ObjectSchema } from '../../lib/src/schema';
9+
import useForm from '@togglecorp/toggle-form/src/form';
10+
import { createSubmitHandler } from '@togglecorp/toggle-form/src/submissionHelper';
11+
import type { PartialForm } from '@togglecorp/toggle-form/src/types';
12+
import { nullValue, nonFieldError } from '@togglecorp/toggle-form/src/types';
13+
import { addCondition } from '@togglecorp/toggle-form/src/schema';
14+
import type { ObjectSchema } from '@togglecorp/toggle-form/src/schema';
15+
import { getErrorObject } from '@togglecorp/toggle-form/src/errorAccessHelper';
16+
import { requiredStringCondition } from '@togglecorp/toggle-form/src/validation';
1517
import FormContainer from './FormContainer';
1618
import NonFieldError from './NonFieldError';
17-
import { getErrorObject } from '../../lib/src/errorAccessHelper';
18-
import { requiredStringCondition } from '../../lib/src/validation';
1919

2020
type FormType = {
2121
firstName: string;

storybook/stories/FormWithDependentFields.stories.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@ import {
55
DateInput,
66
} from '@togglecorp/toggle-ui';
77

8-
import useForm from '../../lib/src/form';
9-
import { createSubmitHandler } from '../../lib/src/submissionHelper';
10-
import type { ObjectSchema } from '../../lib/src/schema';
11-
import { nonFieldError } from '../../lib/src/types';
12-
import { addCondition } from '../../lib/src/schema';
13-
import type { PartialForm } from '../../lib/src/types';
8+
import useForm from '@togglecorp/toggle-form/src/form';
9+
import { createSubmitHandler } from '@togglecorp/toggle-form/src/submissionHelper';
10+
import type { ObjectSchema } from '@togglecorp/toggle-form/src/schema';
11+
import { nonFieldError } from '@togglecorp/toggle-form/src/types';
12+
import { addCondition } from '@togglecorp/toggle-form/src/schema';
13+
import type { PartialForm } from '@togglecorp/toggle-form/src/types';
14+
import { getErrorObject } from '@togglecorp/toggle-form/src/errorAccessHelper';
15+
import { requiredStringCondition } from '@togglecorp/toggle-form/src/validation';
1416
import FormContainer from './FormContainer';
1517
import NonFieldError from './NonFieldError';
16-
import { getErrorObject } from '../../lib/src/errorAccessHelper';
17-
import { requiredStringCondition } from '../../lib/src/validation';
1818

1919
type FormType = {
2020
firstName: string;

storybook/stories/FormWithRestorePoint.stories.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@ import {
66
MultiSelectInput,
77
} from '@togglecorp/toggle-ui';
88

9-
import { createSubmitHandler } from '../../lib/src/submissionHelper';
10-
import useForm from '../../lib/src/form';
11-
import type { PartialForm } from '../../lib/src/types';
12-
import { nonFieldError } from '../../lib/src/types';
13-
import type { ObjectSchema } from '../../lib/src/schema';
14-
import FormContainer, { EquiRow } from './FormContainer';
15-
import NonFieldError from './NonFieldError';
9+
import { createSubmitHandler } from '@togglecorp/toggle-form/src/submissionHelper';
10+
import useForm from '@togglecorp/toggle-form/src/form';
11+
import type { PartialForm } from '@togglecorp/toggle-form/src/types';
12+
import { nonFieldError } from '@togglecorp/toggle-form/src/types';
13+
import type { ObjectSchema } from '@togglecorp/toggle-form/src/schema';
1614
import {
1715
requiredStringCondition,
1816
requiredListCondition,
19-
} from '../../lib/src/validation';
20-
import { getErrorObject, getErrorString } from '../../lib/src/errorAccessHelper';
17+
} from '@togglecorp/toggle-form/src/validation';
18+
import { getErrorObject, getErrorString } from '@togglecorp/toggle-form/src/errorAccessHelper';
19+
import FormContainer, { EquiRow } from './FormContainer';
20+
import NonFieldError from './NonFieldError';
2121

2222
interface Option {
2323
key: string;

storybook/stories/NestedForm.stories.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,18 @@ import {
77
} from '@togglecorp/toggle-ui';
88
import { randomString } from '@togglecorp/fujs';
99

10-
import { createSubmitHandler } from '../../lib/src/submissionHelper';
11-
import useForm, { useFormArray, useFormObject } from '../../lib/src/form';
12-
import type { PartialForm as RawPartialForm, SetValueArg } from '../../lib/src/types';
13-
import type { Error, ObjectSchema, ArraySchema } from '../../lib/src/schema';
14-
import NonFieldError from './NonFieldError';
15-
import FormContainer, { Row } from './FormContainer';
10+
import { createSubmitHandler } from '@togglecorp/toggle-form/src/submissionHelper';
11+
import useForm, { useFormArray, useFormObject } from '@togglecorp/toggle-form/src/form';
12+
import type { PartialForm as RawPartialForm, SetValueArg } from '@togglecorp/toggle-form/src/types';
13+
import type { Error, ObjectSchema, ArraySchema } from '@togglecorp/toggle-form/src/schema';
1614
import {
1715
requiredStringCondition,
1816
greaterThanCondition,
19-
} from '../../lib/src/validation';
20-
import { getErrorObject } from '../../lib/src/errorAccessHelper';
21-
import { nonFieldError } from '../../lib/src/types';
17+
} from '@togglecorp/toggle-form/src/validation';
18+
import { getErrorObject } from '@togglecorp/toggle-form/src/errorAccessHelper';
19+
import { nonFieldError } from '@togglecorp/toggle-form/src/types';
20+
import NonFieldError from './NonFieldError';
21+
import FormContainer, { Row } from './FormContainer';
2222

2323
type PartialForm<T> = RawPartialForm<T, 'clientId'>;
2424

storybook/stories/SimpleForm.stories.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@ import {
66
MultiSelectInput,
77
} from '@togglecorp/toggle-ui';
88

9-
import { createSubmitHandler } from '../../lib/src/submissionHelper';
10-
import useForm from '../../lib/src/form';
11-
import type { PartialForm } from '../../lib/src/types';
12-
import { nonFieldError } from '../../lib/src/types';
13-
import type { ObjectSchema } from '../../lib/src/schema';
14-
import NonFieldError from './NonFieldError';
15-
import FormContainer from './FormContainer';
9+
import { createSubmitHandler } from '@togglecorp/toggle-form/src/submissionHelper';
10+
import useForm from '@togglecorp/toggle-form/src/form';
11+
import type { PartialForm } from '@togglecorp/toggle-form/src/types';
12+
import { nonFieldError } from '@togglecorp/toggle-form/src/types';
13+
import type { ObjectSchema } from '@togglecorp/toggle-form/src/schema';
1614
import {
1715
requiredStringCondition,
1816
requiredListCondition,
19-
} from '../../lib/src/validation';
20-
import { getErrorObject, getErrorString } from '../../lib/src/errorAccessHelper';
17+
} from '@togglecorp/toggle-form/src/validation';
18+
import { getErrorObject, getErrorString } from '@togglecorp/toggle-form/src/errorAccessHelper';
19+
import NonFieldError from './NonFieldError';
20+
import FormContainer from './FormContainer';
2121

2222
interface Option {
2323
key: string;

storybook/stories/SimpleFormWithContext.stories.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ import {
55
Checkbox,
66
} from '@togglecorp/toggle-ui';
77

8-
import { createSubmitHandler } from '../../lib/src/submissionHelper';
9-
import useForm from '../../lib/src/form';
10-
import type { PartialForm } from '../../lib/src/types';
11-
import { nonFieldError, undefinedValue } from '../../lib/src/types';
12-
import type { ObjectSchema } from '../../lib/src/schema';
13-
import NonFieldError from './NonFieldError';
14-
import FormContainer from './FormContainer';
8+
import { createSubmitHandler } from '@togglecorp/toggle-form/src/submissionHelper';
9+
import useForm from '@togglecorp/toggle-form/src/form';
10+
import type { PartialForm } from '@togglecorp/toggle-form/src/types';
11+
import { nonFieldError, undefinedValue } from '@togglecorp/toggle-form/src/types';
12+
import type { ObjectSchema } from '@togglecorp/toggle-form/src/schema';
1513
import {
1614
requiredStringCondition,
17-
} from '../../lib/src/validation';
18-
import { getErrorObject } from '../../lib/src/errorAccessHelper';
15+
} from '@togglecorp/toggle-form/src/validation';
16+
import { getErrorObject } from '@togglecorp/toggle-form/src/errorAccessHelper';
17+
import NonFieldError from './NonFieldError';
18+
import FormContainer from './FormContainer';
1919

2020
type FormType = {
2121
name?: string;

0 commit comments

Comments
 (0)