Skip to content

Commit e6eb6f7

Browse files
committed
Use library on storybook after compilation
1 parent faadad0 commit e6eb6f7

14 files changed

+228
-143
lines changed

.github/workflows/chromatic.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,10 @@ jobs:
2020

2121
- name: Install Dependencies
2222
run: yarn install
23-
working-directory: lib
2423

25-
- name: Install Storybook Dependencies
26-
run: yarn install
27-
working-directory: storybook
24+
- name: 🤞 Build Library 🧪
25+
run: yarn build
26+
working-directory: lib
2827

2928
- name: 🤞 Run Typecheck 🧪
3029
run: yarn typecheck
@@ -34,7 +33,7 @@ jobs:
3433
run: yarn lint
3534
working-directory: storybook
3635

37-
- name: Publish to Chromatic
36+
- name: 🤞 Publish to Chromatic 🧪
3837
uses: chromaui/action@v1
3938
# options required to the GitHub chromatic action
4039
with:

.github/workflows/ci.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ jobs:
2020

2121
- name: Install Dependencies
2222
run: yarn install
23-
working-directory: lib
2423

2524
- name: 🤞 Run Typecheck 🧪
2625
run: yarn typecheck
@@ -30,6 +29,10 @@ jobs:
3029
run: yarn lint
3130
working-directory: lib
3231

32+
- name: 🤞 Run Test 🧪
33+
run: yarn test
34+
working-directory: lib
35+
3336
- name: 🤞 Build 🧪
3437
run: yarn build
3538
working-directory: lib

lib/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
"watch": "rollup -c -w",
1515
"prepack": "yarn build",
1616
"typecheck": "tsc",
17+
"lint": "eslint ./src --report-unused-disable-directives",
1718
"check-unused": "unimported",
1819
"test": "jest",
19-
"test:coverage": "jest --coverage",
20-
"lint": "eslint ./src --report-unused-disable-directives"
20+
"test:coverage": "jest --coverage"
2121
},
2222
"repository": {
2323
"type": "git",

lib/src/utils.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ test('test isCallable', () => {
107107
}
108108
expect(isCallable(getTrue)).toBe(true);
109109
function noOp() {
110+
// eslint-disable-next-line no-console
110111
console.warn('No operation');
111112
}
112113
expect(isCallable(noOp)).toBe(true);

package.json

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

storybook/package.json

Lines changed: 50 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,52 @@
11
{
2-
"name": "@togglecorp/toggle-form-storybook",
3-
"version": "1.0.0",
4-
"description": "",
5-
"scripts": {
6-
"typecheck": "tsc",
7-
"lint": "eslint ./stories --report-unused-disable-directives",
8-
"check-unused": "unimported",
9-
"storybook": "NODE_OPTIONS=--openssl-legacy-provider start-storybook -p 6006",
10-
"storybook:build": "build-storybook"
11-
},
12-
"keywords": [],
13-
"author": "",
14-
"license": "ISC",
15-
"devDependencies": {
16-
"@babel/core": "^7.19.3",
17-
"@storybook/addon-actions": "^6.5.12",
18-
"@storybook/addon-essentials": "^6.5.12",
19-
"@storybook/addon-interactions": "^6.5.12",
20-
"@storybook/addon-links": "^6.5.12",
21-
"@storybook/builder-vite": "^0.2.3",
22-
"@storybook/react": "^6.5.12",
23-
"@storybook/testing-library": "^0.0.13",
24-
"@types/react": "^18.0.21",
25-
"@types/react-dom": "^18.0.6",
26-
"@typescript-eslint/eslint-plugin": "^5.59.8",
27-
"@typescript-eslint/parser": "^5.59.8",
28-
"babel-loader": "^8.2.5",
29-
"eslint": "^8.24.0",
30-
"eslint-config-airbnb": "^19.0.4",
31-
"eslint-plugin-import": "^2.26.0",
32-
"eslint-plugin-jsx-a11y": "^6.6.1",
33-
"eslint-plugin-react": "^7.31.8",
34-
"eslint-plugin-react-hooks": "^4.6.0",
35-
"postcss-nested": "^6.0.0",
36-
"postcss-normalize": "^10.0.1",
37-
"postcss-preset-env": "^7.8.2",
38-
"stylelint": "^14.13.0",
39-
"stylelint-config-concentric": "^2.0.2",
40-
"stylelint-config-recommended": "^9.0.0",
41-
"typescript": "^5.0.4",
42-
"vite": "^3.1.6"
43-
},
44-
"dependencies": {
45-
"@togglecorp/fujs": "^1.9.3",
46-
"@togglecorp/toggle-form": "^2.0.0",
47-
"@togglecorp/toggle-ui": "^0.15.0",
48-
"react": "^18.2.0",
49-
"react-dom": "^18.2.0",
50-
"unimported": "^1.22.0"
51-
}
2+
"name": "@togglecorp/toggle-form-storybook",
3+
"version": "1.0.0",
4+
"description": "",
5+
"scripts": {
6+
"typecheck": "tsc",
7+
"lint": "eslint ./stories --report-unused-disable-directives",
8+
"check-unused": "unimported",
9+
"storybook": "start-storybook -p 6006 --no-open",
10+
"build-storybook": "build-storybook"
11+
},
12+
"keywords": [],
13+
"author": "",
14+
"license": "ISC",
15+
"dependencies": {
16+
"@togglecorp/fujs": "^1.9.3",
17+
"@togglecorp/toggle-form": "^2.0.3",
18+
"@togglecorp/toggle-ui": "^0.15.0",
19+
"react": "^18.2.0",
20+
"react-dom": "^18.2.0"
21+
},
22+
"devDependencies": {
23+
"@babel/core": "^7.19.3",
24+
"@storybook/addon-actions": "^6.5.12",
25+
"@storybook/addon-essentials": "^6.5.12",
26+
"@storybook/addon-interactions": "^6.5.12",
27+
"@storybook/addon-links": "^6.5.12",
28+
"@storybook/builder-vite": "^0.2.3",
29+
"@storybook/react": "^6.5.12",
30+
"@storybook/testing-library": "^0.0.13",
31+
"@types/react": "^18.0.21",
32+
"@types/react-dom": "^18.0.6",
33+
"@typescript-eslint/eslint-plugin": "^5.59.8",
34+
"@typescript-eslint/parser": "^5.59.8",
35+
"babel-loader": "^8.2.5",
36+
"eslint": "^8.24.0",
37+
"eslint-config-airbnb": "^19.0.4",
38+
"eslint-plugin-import": "^2.26.0",
39+
"eslint-plugin-jsx-a11y": "^6.6.1",
40+
"eslint-plugin-react": "^7.31.8",
41+
"eslint-plugin-react-hooks": "^4.6.0",
42+
"postcss-nested": "^6.0.0",
43+
"postcss-normalize": "^10.0.1",
44+
"postcss-preset-env": "^7.8.2",
45+
"stylelint": "^14.13.0",
46+
"stylelint-config-concentric": "^2.0.2",
47+
"stylelint-config-recommended": "^9.0.0",
48+
"typescript": "^5.0.4",
49+
"unimported": "^1.22.0",
50+
"vite": "^3.1.6"
51+
}
5252
}

storybook/stories/ConditionalForm.stories.tsx

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,18 @@ import {
55
NumberInput,
66
Checkbox,
77
} from '@togglecorp/toggle-ui';
8+
import {
9+
type PartialForm,
10+
type ObjectSchema,
11+
useForm,
12+
createSubmitHandler,
13+
nullValue,
14+
nonFieldError,
15+
addCondition,
16+
getErrorObject,
17+
requiredStringCondition,
18+
} from '@togglecorp/toggle-form';
819

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';
1720
import FormContainer from './FormContainer';
1821
import NonFieldError from './NonFieldError';
1922

storybook/stories/FormWithDependentFields.stories.tsx

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,17 @@ import {
44
TextInput,
55
DateInput,
66
} from '@togglecorp/toggle-ui';
7+
import {
8+
type PartialForm,
9+
type ObjectSchema,
10+
useForm,
11+
createSubmitHandler,
12+
nonFieldError,
13+
addCondition,
14+
getErrorObject,
15+
requiredStringCondition,
16+
} from '@togglecorp/toggle-form';
717

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';
1618
import FormContainer from './FormContainer';
1719
import NonFieldError from './NonFieldError';
1820

storybook/stories/FormWithRestorePoint.stories.tsx

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,18 @@ import {
55
PasswordInput,
66
MultiSelectInput,
77
} from '@togglecorp/toggle-ui';
8-
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';
148
import {
15-
requiredStringCondition,
9+
type PartialForm,
10+
type ObjectSchema,
11+
useForm,
12+
createSubmitHandler,
13+
nonFieldError,
14+
getErrorObject,
15+
getErrorString,
1616
requiredListCondition,
17-
} from '@togglecorp/toggle-form/src/validation';
18-
import { getErrorObject, getErrorString } from '@togglecorp/toggle-form/src/errorAccessHelper';
17+
requiredStringCondition,
18+
} from '@togglecorp/toggle-form';
19+
1920
import FormContainer, { EquiRow } from './FormContainer';
2021
import NonFieldError from './NonFieldError';
2122

storybook/stories/NestedForm.stories.tsx

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,22 @@ import {
66
DateInput,
77
} from '@togglecorp/toggle-ui';
88
import { randomString } from '@togglecorp/fujs';
9-
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';
149
import {
10+
type PartialForm as RawPartialForm,
11+
type ObjectSchema,
12+
type SetValueArg,
13+
type ArraySchema,
14+
type Error,
15+
useForm,
16+
useFormArray,
17+
useFormObject,
18+
createSubmitHandler,
19+
nonFieldError,
20+
getErrorObject,
1521
requiredStringCondition,
1622
greaterThanCondition,
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';
23+
} from '@togglecorp/toggle-form';
24+
2025
import NonFieldError from './NonFieldError';
2126
import FormContainer, { Row } from './FormContainer';
2227

0 commit comments

Comments
 (0)