Skip to content

Commit 943af07

Browse files
committed
Update: fix build system
1 parent c963bd1 commit 943af07

File tree

23 files changed

+69
-44
lines changed

23 files changed

+69
-44
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"web:publish": "cd packages/react-formz-web && npm publish --access public",
1616
"native:publish": "cd packages/react-formz-native && npm publish --access public",
1717
"native:build": "yarn workspace @zerry/react-formz-native build",
18-
"build": "nx run workspace:build"
18+
"build": "nx run workspace:packages:build"
1919
},
2020
"devDependencies": {
2121
"@nrwl/jest": "^16.8.1",

packages/react-formz-native/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"build": "rm -rf dist && tsc -p tsconfig.build.json"
2323
},
2424
"dependencies": {
25+
"@zerry/react-formz-core": "workspace:^",
2526
"react-uuid": "^1.0.3",
2627
"zustand": "^4.1.1"
2728
},
+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"name": "@zerry/react-formz-native",
3+
"$schema": "../../node_modules/nx/schemas/project-schema.json",
4+
"sourceRoot": "packages/react-formz-native/src",
5+
"projectType": "library",
6+
"targets": {},
7+
"tags": []
8+
}

packages/react-formz-native/src/index.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export { default as useField } from "./hooks/fields/useField";
3838

3939
// -------------------------------- Models --------------------------------
4040

41-
export { SchemaValidator } from "../../react-formz";
41+
export { SchemaValidator } from "@zerry/react-formz-core";
4242

4343
// -------------------------------- Types --------------------------------
4444

@@ -48,7 +48,7 @@ export type {
4848
FormzError,
4949
FormzErrors,
5050
FormzValues,
51-
} from "../../react-formz/src";
51+
} from "@zerry/react-formz-core";
5252

5353
// -------------------------------- Utils --------------------------------
5454

@@ -61,4 +61,4 @@ export {
6161
set,
6262
get,
6363
useFormSubmission,
64-
} from "../../react-formz/src";
64+
} from "@zerry/react-formz-core";

packages/react-formz-native/tsconfig.build.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@
1313
"experimentalDecorators": true,
1414
"moduleResolution": "node"
1515
},
16-
"include": ["./index.ts", "./src/index.ts", "../react-formz/index.ts", "../react-formz/src/index.ts"],
16+
"include": ["./src/**/*"],
1717
"exclude": ["./src/**/*.test.ts", "./src/**/*.test.tsx"]
1818
}

packages/react-formz-web/configs/jest/setup.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import "@testing-library/jest-dom";
2-
import { formzFieldsStore, formzStore } from "../../../react-formz/src";
2+
import { formzFieldsStore, formzStore } from "@zerry/react-formz-core";
33

44
beforeEach(() => {
55
formzFieldsStore.setState((state) => {

packages/react-formz-web/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"build-storybook": "build-storybook",
2727
"typecheck": "tsc --noEmit",
2828
"clean:dist": "rm -rf ./dist",
29-
"build": "yarn clean:dist && yarn typecheck && yarn build:src && yarn build:types && yarn build:documentation",
29+
"build": "yarn clean:dist && yarn typecheck && yarn build:src && yarn build:types",
3030
"build:src": "vite build",
3131
"build:types": "tsc -P tsconfig.build.json",
3232
"build:documentation": "yarn workspace @zerry/react-formz-documentation build",

packages/react-formz-web/project.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"name": "@zerry/react-formz",
3+
"$schema": "../../node_modules/nx/schemas/project-schema.json",
4+
"sourceRoot": "packages/react-formz-web/src",
5+
"projectType": "library",
6+
"targets": {},
7+
"tags": []
8+
}

packages/react-formz-web/src/components/ArrayField/__tests__/ArrayField.test.tsx

+2-3
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@ import userEvent from "@testing-library/user-event";
66
import { ArrayFieldProps } from "../ArrayField.types";
77
import SubmitButton from "../../SubmitButton";
88
import Field, { FieldProps } from "../../Field";
9-
import TestFieldComponent from "../../../../testUtils/TestFieldComponent";
109
import ErrorMessage from "../../ErrorMessage";
11-
import { formzStore } from "../../../../../react-formz";
12-
import { defaultTestFormName, createDefaultFormzState } from "../../../../../react-formz/testUtils";
10+
import { formzStore, defaultTestFormName, createDefaultFormzState } from "@zerry/react-formz-core";
11+
import TestFieldComponent from "../../../../testUtils/TestFieldComponent";
1312

1413
type FormState = {
1514
name: string;

packages/react-formz-web/src/components/DependentField/__tests__/DependentField.test.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ import Field, { FieldProps } from "../../Field";
99
import subYears from "date-fns/subYears";
1010
import format from "date-fns/format";
1111
import TestFieldComponent from "../../../../testUtils/TestFieldComponent";
12-
import { formzStore } from "../../../../../react-formz";
13-
import { defaultTestFormName, createDefaultFormzState } from "../../../../../react-formz/testUtils";
12+
import { formzStore, defaultTestFormName, createDefaultFormzState } from "@zerry/react-formz-core";
1413

1514
type FormState = {
1615
name: string;

packages/react-formz-web/src/components/Field/__tests__/Field.test.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ import Field from "../Field";
55
import userEvent from "@testing-library/user-event";
66
import SubmitButton from "../../SubmitButton";
77
import TestFieldComponent from "../../../../testUtils/TestFieldComponent";
8-
import { formzStore } from "../../../../../react-formz";
9-
import { defaultTestFormName, createDefaultFormzState } from "../../../../../react-formz/testUtils";
8+
import { formzStore, defaultTestFormName, createDefaultFormzState } from "@zerry/react-formz-core";
109
import { WebFieldProps } from "../Field.types";
1110

1211
function resetState() {

packages/react-formz-web/src/index.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export { default as useField } from "./hooks/fields/useField";
3535

3636
// -------------------------------- Models --------------------------------
3737

38-
export { SchemaValidator } from "../../react-formz";
38+
export { SchemaValidator } from "@zerry/react-formz-core";
3939

4040
// -------------------------------- Types --------------------------------
4141

@@ -45,7 +45,7 @@ export type {
4545
FormzError,
4646
FormzErrors,
4747
FormzValues,
48-
} from "../../react-formz/src";
48+
} from "@zerry/react-formz-core";
4949

5050
// -------------------------------- Utils --------------------------------
5151

@@ -57,4 +57,4 @@ export {
5757
isNumber,
5858
set,
5959
get
60-
} from "../../react-formz/src";
60+
} from "@zerry/react-formz-core";

packages/react-formz-web/src/types.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ import type {
44
FormzError,
55
FormzErrors,
66
FormzValues,
7-
} from "../../react-formz";
7+
} from "@zerry/react-formz-core";
88

99
export { FieldId, FieldValue, FormzError, FormzErrors, FormzValues };

packages/react-formz-web/tsconfig.build.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
"emitDeclarationOnly": true,
99
"baseUrl": "./src",
1010
},
11-
"include": ["./src/index.ts", "../react-formz/index.ts", "../react-formz/src/index.ts"],
11+
"include": ["./src/**/*"],
1212
"exclude": ["./src/**/*.test.ts", "./src/**/*.test.tsx"]
1313
}

packages/react-formz-web/vite.config.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export default defineConfig({
1212
fileName: "index",
1313
},
1414
rollupOptions: {
15-
external: ["react", "react-dom", "immer"],
15+
external: ["react", "react-dom", "immer", "@zerry/react-formz-core"],
1616
output: {
1717
// Provide global variables to use in the UMD build
1818
// for externalized deps

packages/react-formz/index.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
export * from "./src";
1+
export * from "./src";
2+
export * from "./testUtils";

packages/react-formz/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
"packageManager": "yarn@3.2.3",
55
"license": "MIT",
66
"sideEffects": false,
7-
"main": "./src/index.ts",
8-
"types": "./src/index.ts",
7+
"main": "./index.ts",
8+
"types": "./index.ts",
99
"devDependencies": {
1010
"@babel/core": "^7.19.0",
1111
"@babel/preset-env": "^7.19.0",
@@ -42,7 +42,7 @@
4242
"storybook": "start-storybook -p 6006",
4343
"build-storybook": "build-storybook",
4444
"typecheck": "tsc --noEmit",
45-
"build": "rm -rf ./dist && yarn typecheck && vite build && yarn build:types && yarn build:documentation",
45+
"build": "rm -rf ./dist && yarn typecheck && vite build && yarn build:types",
4646
"build:types": "tsc -P tsconfig.build.json",
4747
"build:documentation": "yarn workspace @zerry/react-formz-documentation build",
4848
"test": "jest",

packages/react-formz/project.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"name": "@zerry/react-formz-core",
3+
"$schema": "../../node_modules/nx/schemas/project-schema.json",
4+
"sourceRoot": "packages/react-formz/src",
5+
"projectType": "library",
6+
"targets": {},
7+
"tags": []
8+
}

packages/react-formz/src/index.ts

+8-11
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,8 @@ export type { ArrayHelpers } from "./hooks/fields/useFieldArrayHelpers";
1414
export { default as useFieldArrayHelpers } from "./hooks/fields/useFieldArrayHelpers";
1515
export { default as useFieldErrorMessage } from "./hooks/fields/useErrorMessage";
1616
export { default as useFieldTouched } from "./hooks/fields/useFieldTouched";
17-
export {
18-
default as useForm,
19-
UseFormOptions,
20-
UseFormResult,
21-
} from "./hooks/forms/useForm";
17+
export type { UseFormOptions, UseFormResult } from "./hooks/forms/useForm";
18+
export { default as useForm } from "./hooks/forms/useForm";
2219
export { default as useStableCallback } from "./hooks/utils/useStableCallback";
2320
export { default as useStableValue } from "./hooks/utils/useStableValue";
2421
export { default as useFormStateInitialized } from "./hooks/forms/useFormStateInitialized";
@@ -61,24 +58,24 @@ export {
6158

6259
// -------------------------------- Types --------------------------------
6360

64-
export { AnyObject } from "./types/common";
65-
export {
61+
export type { AnyObject } from "./types/common";
62+
export type {
6663
FieldId,
6764
FieldValue,
6865
FieldValidator,
6966
FieldProps,
7067
FieldValueFormatter,
7168
} from "./types/field";
72-
export {
69+
export type {
7370
FormId,
7471
FormzError,
7572
FormzErrors,
7673
FormzValues,
7774
FormRehydrationCallback,
7875
FormSubmitCallback,
79-
FormProps
76+
FormProps,
8077
} from "./types/form";
81-
export { LiteralUnion } from "./types/utils";
78+
export type { LiteralUnion } from "./types/utils";
8279

8380
// -------------------------------- Utils --------------------------------
8481

@@ -92,4 +89,4 @@ export {
9289
isNull,
9390
isNumber,
9491
isValidInputValue,
95-
} from "./utils/is";
92+
} from "./utils/is";
+3-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
export { defaultTestFormName } from "./constants";
2-
export { default as createDefaultFormzState } from "./createDefaultFormzState";
2+
export { default as createDefaultFormzState } from "./createDefaultFormzState";
3+
export { default as renderWithFormIdProvider } from './renderWithFormIdProvider';
4+
export { default as renderHookInAct } from './renderHookInAct';

packages/react-formz/vite.config.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,16 @@ export default defineConfig({
1212
fileName: "index",
1313
},
1414
rollupOptions: {
15-
external: ["react", "react-dom", "immer"],
15+
external: ["react", "react-dom", "immer", "@zerry/react-formz-core"],
1616
output: {
1717
// Provide global variables to use in the UMD build
1818
// for externalized deps
1919
globals: {
2020
react: "React",
2121
"react-dom": "ReactDOM",
2222
immer: "immer",
23+
"@zerry/react-formz-core": "ReactFormzCore"
24+
2325
},
2426
},
2527
},

workspace/project.json

+7-7
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"options": {
88
"commands": [
99
{
10-
"command": "nx run-many --target=lint --projects=@zerry/react-formz,@zerry/react-formz-native",
10+
"command": "nx run-many --target=lint --projects=@zerry/react-formz-core,@zerry/react-formz,@zerry/react-formz-native",
1111
"forwardAllArgs": false
1212
}
1313
],
@@ -19,7 +19,7 @@
1919
"options": {
2020
"commands": [
2121
{
22-
"command": "nx run-many --target=test --projects=@zerry/react-formz,@zerry/react-formz-native",
22+
"command": "nx run-many --target=test --projects=@zerry/react-formz-core,@zerry/react-formz,@zerry/react-formz-native",
2323
"forwardAllArgs": false
2424
}
2525
],
@@ -31,7 +31,7 @@
3131
"options": {
3232
"commands": [
3333
{
34-
"command": "nx run-many --target=test:watch --projects=@zerry/react-formz,@zerry/react-formz-native",
34+
"command": "nx run-many --target=test:watch --projects=@zerry/react-formz-core,@zerry/react-formz,@zerry/react-formz-native",
3535
"forwardAllArgs": true
3636
}
3737
],
@@ -43,7 +43,7 @@
4343
"options": {
4444
"commands": [
4545
{
46-
"command": "nx run-many --target=build --projects=@zerry/react-formz,@zerry/react-formz-native",
46+
"command": "nx run-many --target=build --projects=@zerry/react-formz-core,@zerry/react-formz,@zerry/react-formz-native",
4747
"forwardAllArgs": false
4848
}
4949
],
@@ -55,7 +55,7 @@
5555
"options": {
5656
"commands": [
5757
{
58-
"command": "nx run-many --target=format --projects=@zerry/react-formz,@zerry/react-formz-native",
58+
"command": "nx run-many --target=format --projects=@zerry/react-formz-core,@zerry/react-formz,@zerry/react-formz-native",
5959
"forwardAllArgs": false
6060
}
6161
],
@@ -67,7 +67,7 @@
6767
"options": {
6868
"commands": [
6969
{
70-
"command": "nx run-many --target=check-types --projects=@zerry/react-formz,@zerry/react-formz-native",
70+
"command": "nx run-many --target=check-types --projects=@zerry/react-formz-core,@zerry/react-formz,@zerry/react-formz-native",
7171
"forwardAllArgs": false
7272
}
7373
],
@@ -79,7 +79,7 @@
7979
"options": {
8080
"commands": [
8181
{
82-
"command": "nx run-many --target=check-formatting --projects=@zerry/react-formz,@zerry/react-formz-native",
82+
"command": "nx run-many --target=check-formatting --projects=@zerry/react-formz-core,@zerry/react-formz,@zerry/react-formz-native",
8383
"forwardAllArgs": false
8484
}
8585
],

yarn.lock

+1
Original file line numberDiff line numberDiff line change
@@ -11638,6 +11638,7 @@ __metadata:
1163811638
"@babel/core": ^7.19.1
1163911639
"@babel/preset-env": ^7.19.0
1164011640
"@types/jest": ^29.0.0
11641+
"@zerry/react-formz-core": "workspace:^"
1164111642
babel-jest: ^29.0.2
1164211643
jest: ^29.0.2
1164311644
metro-react-native-babel-preset: ^0.72.3

0 commit comments

Comments
 (0)