Skip to content

Commit fb18e55

Browse files
authored
Merge pull request #32 from toggle-corp/feature/workspaces
Use yarn workspaces
2 parents d916231 + e6eb6f7 commit fb18e55

16 files changed

+14035
-126
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

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-

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: 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: 50 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,52 @@
11
{
2-
"name": "toggle-form-storybook",
3-
"version": "1.0.0",
4-
"description": "",
5-
"main": "index.js",
6-
"scripts": {
7-
"typecheck": "tsc",
8-
"lint": "eslint ./stories --report-unused-disable-directives",
9-
"storybook": "NODE_OPTIONS=--openssl-legacy-provider start-storybook -p 6006",
10-
"build-storybook": "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-ui": "^0.15.0",
47-
"react": "^18.2.0",
48-
"react-dom": "^18.2.0"
49-
}
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+
}
5052
}

storybook/stories/ConditionalForm.stories.tsx

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,20 @@ 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 '../../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';
1520
import FormContainer from './FormContainer';
1621
import NonFieldError from './NonFieldError';
17-
import { getErrorObject } from '../../lib/src/errorAccessHelper';
18-
import { requiredStringCondition } from '../../lib/src/validation';
1922

2023
type FormType = {
2124
firstName: string;

storybook/stories/FormWithDependentFields.stories.tsx

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,19 @@ 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 '../../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';
1418
import FormContainer from './FormContainer';
1519
import NonFieldError from './NonFieldError';
16-
import { getErrorObject } from '../../lib/src/errorAccessHelper';
17-
import { requiredStringCondition } from '../../lib/src/validation';
1820

1921
type FormType = {
2022
firstName: string;

0 commit comments

Comments
 (0)