Skip to content

Commit 47b7e0d

Browse files
committed
refactor(react-formio): migrate to esm and vitest
1 parent 44c6ca8 commit 47b7e0d

File tree

206 files changed

+10574
-2081
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

206 files changed

+10574
-2081
lines changed

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ storybook-static
5454
.DS_Store
5555
.nyc_output
5656
/docs/.vuepress/dist/
57-
/packages/tailwind/COLORS.JSON
5857

5958
# Yarn
6059
.pnp.*

.storybook/main.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { StorybookConfig } from "@storybook/react-vite";
22

33
const config: StorybookConfig = {
4-
staticDirs: ["../packages/tailwind/build"],
4+
staticDirs: ["../packages/tailwind-formio/build"],
55

66
stories: [
77
"../stories/Getting-started.mdx",

commitlint.config.cjs

-1
This file was deleted.

commitlint.config.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default { extends: ["@commitlint/config-conventional"] };

package.json

+14-16
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,19 @@
1414
},
1515
"homepage": "https://github.com/TypedProject/tsed-formio",
1616
"scripts": {
17-
"/postinstall": "lerna run build --stream",
1817
"configure": "monorepo ci configure",
1918
"test": "lerna run test --stream",
2019
"lint": "eslint",
2120
"lint:fix": "eslint",
2221
"build": "monorepo build --verbose",
2322
"publish": "monorepo publish --dry-run",
2423
"start": "lerna run start --stream --parallel",
25-
"tailwind:build": "lerna run tailwind:build --stream --scope @tsed/tailwind",
24+
"tailwind:build": "lerna run build --stream --scope @tsed/tailwind-formio",
2625
"release": "semantic-release",
2726
"prepare": "is-ci || husky install",
28-
"storybook:test": "yarn test-storybook",
29-
"storybook:test:ci": "yarn test-storybook --maxWorkers=2",
30-
"storybook:start": "storybook dev -p 6006",
27+
"storybook:test": "yarn build && yarn test-storybook",
28+
"storybook:test:ci": "yarn build && yarn test-storybook --maxWorkers=2",
29+
"storybook:start": "yarn tailwind:build && storybook dev -p 6006",
3130
"storybook:build": "yarn run tailwind:build && yarn run build-storybook",
3231
"build-storybook": "storybook build -c .storybook",
3332
"caniuse": "npx -y update-browserslist-db@latest",
@@ -46,10 +45,11 @@
4645
"@types/react-router-dom": "^5.3.3",
4746
"@types/react-table": "^7.7.14",
4847
"connected-react-router": "6.9.1",
49-
"formiojs": "^4.14.13",
48+
"formiojs": "4.21.6",
5049
"history": "5.3.0",
5150
"lerna": "8.1.2",
5251
"lodash": "4.17.21",
52+
"nodemon": "3.1.9",
5353
"react": "^18.2.0",
5454
"react-dom": "^18.2.0",
5555
"react-redux": "7.2.6",
@@ -76,11 +76,11 @@
7676
"@storybook/test-runner": "0.21.0",
7777
"@swc/core": "^1.2.208",
7878
"@swc/jest": "^0.2.21",
79-
"@testing-library/dom": "^8.14.0",
80-
"@testing-library/jest-dom": "^5.16.4",
81-
"@testing-library/react": "^12.1.5",
82-
"@testing-library/user-event": "^14.2.1",
83-
"@tsed/monorepo-utils": "2.1.2",
79+
"@testing-library/dom": "10.4.0",
80+
"@testing-library/jest-dom": "6.5.0",
81+
"@testing-library/react": "16.1.0",
82+
"@testing-library/user-event": "14.5.2",
83+
"@tsed/monorepo-utils": "2.3.10",
8484
"@types/ejs": "^3.0.5",
8585
"@types/jest": "27.0.2",
8686
"@types/lodash": "4.14.168",
@@ -108,19 +108,17 @@
108108
"eslint-plugin-workspaces": "0.10.1",
109109
"fs-extra": "10.1.0",
110110
"globby": "^14.0.2",
111-
"happy-dom": "^16.0.0",
112111
"husky": "^8.0.1",
112+
"jsdom": "25.0.1",
113113
"lint-staged": "13.0.3",
114-
"microbundle": "0.13.0",
115114
"playwright": "1.49.1",
116115
"postcss": "8.4.49",
117116
"postcss-nested": "7.0.2",
118117
"postcss-normalize": "13.0.1",
119118
"prettier": "3.4.2",
120119
"prop-types": "^15.8.1",
121-
"react": "^18.2.0",
122-
"react-dom": "^18.2.0",
123-
"react-svg": "10.0.23",
120+
"react": "18.3.1",
121+
"react-dom": "18.3.1",
124122
"rimraf": "^3.0.2",
125123
"rollup-preserve-directives": "^1.1.3",
126124
"semantic-release": "23.0.5",

packages/integration/index.html

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<title>Vite + React + TS</title>
8+
</head>
9+
<body>
10+
<div id="root"></div>
11+
<script type="module" src="/src/main.tsx"></script>
12+
</body>
13+
</html>

packages/integration/package.json

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"name": "@tsed/react-formio-integration",
3+
"version": "2.3.2",
4+
"description": "",
5+
"private": true,
6+
"type": "module",
7+
"license": "MIT",
8+
"scripts": {
9+
"dev": "vite dev"
10+
},
11+
"dependencies": {
12+
"classnames": "^2.3.1",
13+
"eventemitter2": "^6.4.3",
14+
"prop-types": "15.8.1"
15+
},
16+
"peerDependencies": {
17+
"@formio/choices.js": ">=9.0.1",
18+
"formiojs": ">=4.0.0",
19+
"lodash": ">=4.17.20",
20+
"prop-types": ">=15.7.2",
21+
"react": ">=16.14.0",
22+
"react-dnd": ">=16.0.1",
23+
"react-dnd-html5-backend": ">=16.0.1",
24+
"react-dom": ">=16.14.0",
25+
"react-table": ">=7.6.3",
26+
"tooltip.js": ">=1.3.3"
27+
},
28+
"devDependencies": {
29+
"@tsed/react-formio": "workspace:*",
30+
"@tsed/tailwind-formio": "workspace:*",
31+
"@tsed/typescript": "workspace:*",
32+
"microbundle": "0.13.0",
33+
"vite": "5.4.11",
34+
"vitest": "2.1.8"
35+
}
36+
}
+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
export default {
2+
plugins: {
3+
"postcss-normalize": {},
4+
"tailwindcss/nesting": {},
5+
tailwindcss: {},
6+
autoprefixer: {}
7+
}
8+
};

packages/integration/public/vite.svg

+1
Loading

packages/integration/src/App.tsx

+118
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
import { defaultDisplayChoices, FormEdit } from "@tsed/react-formio";
2+
3+
const opts: any = {
4+
typeChoices: [
5+
{ label: "Form", value: "form" },
6+
{ label: "Resources", value: "resource" }
7+
],
8+
displayChoices: defaultDisplayChoices,
9+
enableTags: true,
10+
// options: { template: "tailwind", iconset: "bx" },
11+
form: {
12+
type: "form",
13+
tags: [],
14+
owner: "5d0797a382461b6656d2c790",
15+
components: [
16+
{
17+
label: "Text Field",
18+
labelPosition: "top",
19+
placeholder: "",
20+
description: "",
21+
tooltip: "",
22+
prefix: "",
23+
suffix: "",
24+
widget: { type: "input" },
25+
inputMask: "",
26+
allowMultipleMasks: false,
27+
customClass: "",
28+
tabindex: "",
29+
autocomplete: "",
30+
hidden: false,
31+
hideLabel: false,
32+
showWordCount: false,
33+
showCharCount: false,
34+
mask: false,
35+
autofocus: false,
36+
spellcheck: true,
37+
disabled: false,
38+
tableView: true,
39+
modalEdit: false,
40+
multiple: false,
41+
persistent: true,
42+
inputFormat: "plain",
43+
protected: false,
44+
dbIndex: false,
45+
case: "",
46+
encrypted: false,
47+
redrawOn: "",
48+
clearOnHide: true,
49+
customDefaultValue: "",
50+
calculateValue: "",
51+
calculateServer: false,
52+
allowCalculateOverride: false,
53+
validateOn: "change",
54+
validate: {
55+
required: true,
56+
pattern: "",
57+
customMessage: "",
58+
custom: "",
59+
customPrivate: false,
60+
json: "",
61+
minLength: "",
62+
maxLength: "",
63+
strictDateValidation: false,
64+
multiple: false,
65+
unique: false
66+
},
67+
unique: false,
68+
errorLabel: "",
69+
key: "textField",
70+
tags: [],
71+
properties: {},
72+
conditional: { show: null, when: null, eq: "", json: "" },
73+
customConditional: "",
74+
logic: [],
75+
attributes: {},
76+
overlay: {
77+
style: "",
78+
page: "",
79+
left: "",
80+
top: "",
81+
width: "",
82+
height: ""
83+
},
84+
type: "textfield",
85+
input: true,
86+
refreshOn: "",
87+
inputType: "text",
88+
id: "eqb1o4r",
89+
defaultValue: ""
90+
}
91+
],
92+
title: "text-field",
93+
display: "form",
94+
access: [
95+
{
96+
roles: ["5d0797bc872fc747da559858", "5d0797bc872fc71d05559859", "5d0797bc872fc7da3b55985a"],
97+
type: "read_all"
98+
}
99+
],
100+
submissionAccess: [],
101+
controller: "",
102+
properties: {},
103+
settings: {},
104+
name: "textField",
105+
path: "textfield",
106+
machineName: "tcspjwhsevrzpcd:textField"
107+
}
108+
};
109+
110+
function App() {
111+
return (
112+
<div className='p-8'>
113+
<FormEdit {...opts} />
114+
</div>
115+
);
116+
}
117+
118+
export default App;
Loading

packages/integration/src/main.tsx

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import "./styles/index.css";
2+
3+
import { Formio, Templates } from "@tsed/react-formio";
4+
import tailwind from "@tsed/tailwind-formio";
5+
import { StrictMode } from "react";
6+
import { createRoot } from "react-dom/client";
7+
8+
import App from "./App";
9+
10+
// eslint-disable-next-line react-hooks/rules-of-hooks
11+
Formio.use(tailwind);
12+
Templates.framework = "tailwind";
13+
14+
createRoot(document.getElementById("root")!).render(
15+
<StrictMode>
16+
<App />
17+
</StrictMode>
18+
);

0 commit comments

Comments
 (0)