Skip to content

Commit

Permalink
refactor(react-formio): migrate to esm and vitest
Browse files Browse the repository at this point in the history
BREAKING CHANGE: expose all formio modules on ESM format only
  • Loading branch information
Romakita committed Dec 29, 2024
1 parent 23aec9c commit 07acb3d
Show file tree
Hide file tree
Showing 206 changed files with 10,574 additions and 2,081 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ storybook-static
.DS_Store
.nyc_output
/docs/.vuepress/dist/
/packages/tailwind/COLORS.JSON

# Yarn
.pnp.*
Expand Down
2 changes: 1 addition & 1 deletion .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { StorybookConfig } from "@storybook/react-vite";

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

stories: [
"../stories/Getting-started.mdx",
Expand Down
1 change: 0 additions & 1 deletion commitlint.config.cjs

This file was deleted.

1 change: 1 addition & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default { extends: ["@commitlint/config-conventional"] };
30 changes: 14 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,19 @@
},
"homepage": "https://github.com/TypedProject/tsed-formio",
"scripts": {
"/postinstall": "lerna run build --stream",
"configure": "monorepo ci configure",
"test": "lerna run test --stream",
"lint": "eslint",
"lint:fix": "eslint",
"build": "monorepo build --verbose",
"publish": "monorepo publish --dry-run",
"start": "lerna run start --stream --parallel",
"tailwind:build": "lerna run tailwind:build --stream --scope @tsed/tailwind",
"tailwind:build": "lerna run build --stream --scope @tsed/tailwind-formio",
"release": "semantic-release",
"prepare": "is-ci || husky install",
"storybook:test": "yarn test-storybook",
"storybook:test:ci": "yarn test-storybook --maxWorkers=2",
"storybook:start": "storybook dev -p 6006",
"storybook:test": "yarn build && yarn test-storybook",
"storybook:test:ci": "yarn build && yarn test-storybook --maxWorkers=2",
"storybook:start": "yarn tailwind:build && storybook dev -p 6006",
"storybook:build": "yarn run tailwind:build && yarn run build-storybook",
"build-storybook": "storybook build -c .storybook",
"caniuse": "npx -y update-browserslist-db@latest",
Expand All @@ -46,10 +45,11 @@
"@types/react-router-dom": "^5.3.3",
"@types/react-table": "^7.7.14",
"connected-react-router": "6.9.1",
"formiojs": "^4.14.13",
"formiojs": "4.21.6",
"history": "5.3.0",
"lerna": "8.1.2",
"lodash": "4.17.21",
"nodemon": "3.1.9",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-redux": "7.2.6",
Expand All @@ -76,11 +76,11 @@
"@storybook/test-runner": "0.21.0",
"@swc/core": "^1.2.208",
"@swc/jest": "^0.2.21",
"@testing-library/dom": "^8.14.0",
"@testing-library/jest-dom": "^5.16.4",
"@testing-library/react": "^12.1.5",
"@testing-library/user-event": "^14.2.1",
"@tsed/monorepo-utils": "2.1.2",
"@testing-library/dom": "10.4.0",
"@testing-library/jest-dom": "6.5.0",
"@testing-library/react": "16.1.0",
"@testing-library/user-event": "14.5.2",
"@tsed/monorepo-utils": "2.3.10",
"@types/ejs": "^3.0.5",
"@types/jest": "27.0.2",
"@types/lodash": "4.14.168",
Expand Down Expand Up @@ -108,19 +108,17 @@
"eslint-plugin-workspaces": "0.10.1",
"fs-extra": "10.1.0",
"globby": "^14.0.2",
"happy-dom": "^16.0.0",
"husky": "^8.0.1",
"jsdom": "25.0.1",
"lint-staged": "13.0.3",
"microbundle": "0.13.0",
"playwright": "1.49.1",
"postcss": "8.4.49",
"postcss-nested": "7.0.2",
"postcss-normalize": "13.0.1",
"prettier": "3.4.2",
"prop-types": "^15.8.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-svg": "10.0.23",
"react": "18.3.1",
"react-dom": "18.3.1",
"rimraf": "^3.0.2",
"rollup-preserve-directives": "^1.1.3",
"semantic-release": "23.0.5",
Expand Down
13 changes: 13 additions & 0 deletions packages/integration/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React + TS</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
36 changes: 36 additions & 0 deletions packages/integration/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"name": "@tsed/react-formio-integration",
"version": "2.3.2",
"description": "",
"private": true,
"type": "module",
"license": "MIT",
"scripts": {
"dev": "vite dev"
},
"dependencies": {
"classnames": "^2.3.1",
"eventemitter2": "^6.4.3",
"prop-types": "15.8.1"
},
"peerDependencies": {
"@formio/choices.js": ">=9.0.1",
"formiojs": ">=4.0.0",
"lodash": ">=4.17.20",
"prop-types": ">=15.7.2",
"react": ">=16.14.0",
"react-dnd": ">=16.0.1",
"react-dnd-html5-backend": ">=16.0.1",
"react-dom": ">=16.14.0",
"react-table": ">=7.6.3",
"tooltip.js": ">=1.3.3"
},
"devDependencies": {
"@tsed/react-formio": "workspace:*",
"@tsed/tailwind-formio": "workspace:*",
"@tsed/typescript": "workspace:*",
"microbundle": "0.13.0",
"vite": "5.4.11",
"vitest": "2.1.8"
}
}
8 changes: 8 additions & 0 deletions packages/integration/postcss.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export default {
plugins: {
"postcss-normalize": {},
"tailwindcss/nesting": {},
tailwindcss: {},
autoprefixer: {}
}
};
1 change: 1 addition & 0 deletions packages/integration/public/vite.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
118 changes: 118 additions & 0 deletions packages/integration/src/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
import { defaultDisplayChoices, FormEdit } from "@tsed/react-formio";

const opts: any = {
typeChoices: [
{ label: "Form", value: "form" },
{ label: "Resources", value: "resource" }
],
displayChoices: defaultDisplayChoices,
enableTags: true,
// options: { template: "tailwind", iconset: "bx" },
form: {
type: "form",
tags: [],
owner: "5d0797a382461b6656d2c790",
components: [
{
label: "Text Field",
labelPosition: "top",
placeholder: "",
description: "",
tooltip: "",
prefix: "",
suffix: "",
widget: { type: "input" },
inputMask: "",
allowMultipleMasks: false,
customClass: "",
tabindex: "",
autocomplete: "",
hidden: false,
hideLabel: false,
showWordCount: false,
showCharCount: false,
mask: false,
autofocus: false,
spellcheck: true,
disabled: false,
tableView: true,
modalEdit: false,
multiple: false,
persistent: true,
inputFormat: "plain",
protected: false,
dbIndex: false,
case: "",
encrypted: false,
redrawOn: "",
clearOnHide: true,
customDefaultValue: "",
calculateValue: "",
calculateServer: false,
allowCalculateOverride: false,
validateOn: "change",
validate: {
required: true,
pattern: "",
customMessage: "",
custom: "",
customPrivate: false,
json: "",
minLength: "",
maxLength: "",
strictDateValidation: false,
multiple: false,
unique: false
},
unique: false,
errorLabel: "",
key: "textField",
tags: [],
properties: {},
conditional: { show: null, when: null, eq: "", json: "" },
customConditional: "",
logic: [],
attributes: {},
overlay: {
style: "",
page: "",
left: "",
top: "",
width: "",
height: ""
},
type: "textfield",
input: true,
refreshOn: "",
inputType: "text",
id: "eqb1o4r",
defaultValue: ""
}
],
title: "text-field",
display: "form",
access: [
{
roles: ["5d0797bc872fc747da559858", "5d0797bc872fc71d05559859", "5d0797bc872fc7da3b55985a"],
type: "read_all"
}
],
submissionAccess: [],
controller: "",
properties: {},
settings: {},
name: "textField",
path: "textfield",
machineName: "tcspjwhsevrzpcd:textField"
}
};

function App() {
return (
<div className='p-8'>
<FormEdit {...opts} />
</div>
);
}

export default App;
1 change: 1 addition & 0 deletions packages/integration/src/assets/react.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions packages/integration/src/main.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import "./styles/index.css";

import { Formio, Templates } from "@tsed/react-formio";
import tailwind from "@tsed/tailwind-formio";
import { StrictMode } from "react";
import { createRoot } from "react-dom/client";

import App from "./App";

// eslint-disable-next-line react-hooks/rules-of-hooks
Formio.use(tailwind);
Templates.framework = "tailwind";

createRoot(document.getElementById("root")!).render(
<StrictMode>
<App />
</StrictMode>
);
Loading

0 comments on commit 07acb3d

Please sign in to comment.