Skip to content

Commit 6ba7043

Browse files
feat: update config and setup files with node18, vite and vue3
1 parent 372ece8 commit 6ba7043

File tree

9 files changed

+12288
-9013
lines changed

9 files changed

+12288
-9013
lines changed

.eslintrc.json

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,42 @@
88
"jest": true,
99
"es6" :true
1010
},
11+
"parser": "@typescript-eslint/parser",
1112
"rules": {
13+
"prettier/prettier": [
14+
"error",
15+
{
16+
"tabWidth": 2,
17+
"semi": true,
18+
"singleQuote": true,
19+
"bracketSpacing": true,
20+
"printWidth": 80,
21+
"trailingComma": "all",
22+
"endOfLine": "lf",
23+
"singleAttributePerLine": true
24+
}
25+
],
1226
"no-prototype-builtins": 0,
1327
"no-case-declarations": 1,
1428
"no-empty": 1,
29+
"no-var": 1,
30+
"prefer-const": 1,
31+
"react/prop-types": 1,
1532
"react/no-unescaped-entities": 1,
1633
"react/display-name": 0,
1734
"@typescript-eslint/explicit-function-return-type": 0,
18-
"@typescript-eslint/camelcase": 0,
1935
"@typescript-eslint/explicit-member-accessibility": 0,
2036
"@typescript-eslint/no-namespace": 0,
2137
"@typescript-eslint/no-var-requires": 0,
2238
"@typescript-eslint/no-use-before-define": 0,
2339
"@typescript-eslint/no-object-literal-type-assertion": 0,
2440
"@typescript-eslint/no-empty-interface": 1,
25-
"@typescript-eslint/no-non-null-assertion": 0
41+
"@typescript-eslint/no-non-null-assertion": 0,
42+
"@typescript-eslint/no-inferrable-types": 1,
43+
"@typescript-eslint/ban-types": 1,
44+
"@typescript-eslint/no-this-alias": 1,
45+
"@typescript-eslint/ban-ts-comment": 1,
46+
"@typescript-eslint/no-empty-function": 1
2647
},
2748
"settings": {
2849
"react": {

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,6 @@ lambda-build
1414
lib
1515
build
1616
fabric
17-
fabfile.py
17+
fabfile.py
18+
# Local Netlify folder
19+
.netlify

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
save-exact=true
2+
engine-strict=true

netlify.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,6 @@
22
command = "yarn run netlify"
33
publish = "build"
44
functions = "lambda-build"
5+
6+
[functions]
7+
node_bundler = "esbuild"

package.json

Lines changed: 42 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,25 @@
88
"unpkg": "umd/flow-editor.min.js",
99
"author": "Weni <support@weni.ai>",
1010
"homepage": "./",
11+
"engines": {
12+
"node": ">=18.0.0"
13+
},
1114
"files": [
1215
"build"
1316
],
1417
"private": false,
1518
"dependencies": {
1619
"@material-symbols/font-400": "0.13.2",
17-
"@weni/unnnic-system": "1.24.8",
20+
"@weni/unnnic-system": "2.0.2",
1821
"react": "^16.8.6",
1922
"react-dom": "^16.8.6",
2023
"sms-length": "0.1.2",
21-
"vuereact-combined": "1.2.11"
24+
"veaury": "2.3.18"
2225
},
2326
"scripts": {
2427
"lambda:serve": "netlify-lambda serve lambda -p 6000",
2528
"lambda:build": "netlify-lambda build lambda",
26-
"lambda": "yarn run lambda:build && yarn run lambda:serve",
29+
"lambda": "netlify functions:serve --functions lambda --port 6000",
2730
"prettify": "prettier --write 'src/**/*.{ts,tsx,json,js,css,md}'",
2831
"netlify": "yarn run build && yarn run lambda:build",
2932
"precommit": "lint-staged",
@@ -32,12 +35,12 @@
3235
"version": "yarn run build && auto-changelog -p && git add CHANGELOG.md",
3336
"scan": "./node_modules/i18next-scanner/bin/cli.js",
3437
"dev": "yarn build && cp -Rf build/* ../rapidpro/node_modules/@weni/flow-editor/build/",
35-
"start": "react-scripts start",
36-
"build": "react-scripts build",
37-
"test": "react-scripts test --env=jsdom-sixteen",
38-
"tester": "react-scripts test --env=jest-environment-happy-dom",
39-
"eject": "react-scripts eject",
40-
"lint": "eslint -c .eslintrc.json src/**/*.{ts,tsx,js} --fix"
38+
"start": "vite --port 3000",
39+
"build": "vite build",
40+
"test": "vitest",
41+
"lint": "eslint -c .eslintrc.json src/**/*.{ts,tsx,js} --fix",
42+
"build:vite": "tsc && vite build",
43+
"preview": "vite preview"
4144
},
4245
"browserslist": {
4346
"production": [
@@ -76,29 +79,32 @@
7679
"@babel/preset-env": "^7.4.4",
7780
"@babel/preset-react": "7.0.0",
7881
"@nyaruka/temba-components": "0.18.1",
79-
"@testing-library/jest-dom": "4.0.0",
80-
"@testing-library/react": "8.0.1",
82+
"@originjs/vite-plugin-commonjs": "1.0.3",
83+
"@testing-library/jest-dom": "6.4.5",
84+
"@testing-library/react": "12.1.5",
8185
"@testing-library/user-event": "12.0.0",
8286
"@types/common-tags": "^1.8.0",
8387
"@types/core-js": "2.5.0",
8488
"@types/dateformat": "3.0.0",
8589
"@types/enzyme": "^3.9.3",
8690
"@types/enzyme-adapter-react-16": "^1.0.3",
87-
"@types/jest": "24.0.13",
88-
"@types/react": "16.8.23",
91+
"@types/react": "16.14.1",
8992
"@types/react-addons-shallow-compare": "0.14.22",
90-
"@types/react-dom": "16.8.4",
93+
"@types/react-dom": "16.9.10",
9194
"@types/react-modal": "^3.8.1",
9295
"@types/react-redux": "7.1.3",
9396
"@types/react-select": "3.0.8",
9497
"@types/redux-mock-store": "^1.0.0",
9598
"@types/textarea-caret": "3.0.0",
9699
"@types/uniqid": "^4.1.2",
97100
"@types/uuid": "^3.4.3",
98-
"@types/webpack-env": "^1.13.6",
99-
"@typescript-eslint/eslint-plugin": "1.12.0",
100-
"@typescript-eslint/parser": "1.12.0",
101-
"@weni/eslint-config": "1.0.2",
101+
"@typescript-eslint/eslint-plugin": "5.62.0",
102+
"@typescript-eslint/parser": "5.62.0",
103+
"@vitejs/plugin-react": "4.2.1",
104+
"@vitejs/plugin-vue": "5.0.4",
105+
"@vitejs/plugin-vue-jsx": "3.1.0",
106+
"@vitest/coverage-v8": "1.6.0",
107+
"@weni/eslint-config": "1.0.4",
102108
"ajv": "6.5.2",
103109
"array-move": "2.1.0",
104110
"auto-bind": "2.1.0",
@@ -113,9 +119,11 @@
113119
"enzyme-adapter-react-16": "^1.13.0",
114120
"enzyme-adapter-utils": "1.12.0",
115121
"enzyme-to-json": "^3.3.4",
116-
"eslint-config-prettier": "6.0.0",
122+
"eslint": "8.57.0",
123+
"eslint-config-prettier": "9.1.0",
117124
"eslint-config-react": "1.1.7",
118-
"eslint-plugin-prettier": "3.1.0",
125+
"eslint-config-react-app": "7.0.1",
126+
"eslint-plugin-prettier": "4.2.1",
119127
"fast-deep-equal": "2.0.1",
120128
"http-headers-validation": "0.0.1",
121129
"http-proxy-middleware": "0.19.1",
@@ -127,13 +135,15 @@
127135
"identity-obj-proxy": "3.0.0",
128136
"immutability-helper": "2.7.1",
129137
"jest-environment-jsdom-sixteen": "2.0.0",
138+
"jsdom": "24.0.0",
130139
"jsplumb": "file:jsplumb-2.13.1.tgz",
131140
"lint-staged": "8.1.7",
132141
"local-storage": "1.4.2",
133142
"lodash.clonedeep": "4.5.0",
134143
"material-symbols": "0.12.0",
135144
"moment": "2.24.0",
136-
"netlify-lambda": "^1.4.9",
145+
"msw": "2.3.1",
146+
"netlify-cli": "17.23.1",
137147
"panzoom": "9.4.3",
138148
"prettier": "1.18.2",
139149
"pretty-quick": "^1.11.0",
@@ -150,15 +160,14 @@
150160
"react-page-visibility": "3.2.1",
151161
"react-player": "1.9.3",
152162
"react-redux": "7.1.3",
153-
"react-scripts": "^3.4.1",
154163
"react-select": "3.0.8",
155164
"react-sortable-hoc": "1.9.1",
156165
"redux": "3.7.2",
157166
"redux-devtools-extension": "^2.13.5",
158167
"redux-mock-store": "1.5.3",
159168
"redux-thunk": "2.2.0",
160169
"resize-observer-polyfill": "1.5.1",
161-
"sass": "1.32.13",
170+
"sass": "1.75.0",
162171
"sha1": "1.1.1",
163172
"shx": "0.3.2",
164173
"sign-bunny": "1.0.0",
@@ -167,8 +176,16 @@
167176
"tslint": "5.17.0",
168177
"tslint-config-prettier": "1.18.0",
169178
"tslint-plugin-prettier": "2.0.1",
170-
"typescript": "3.4.5",
179+
"typescript": "3.9",
171180
"uniqid": "5.0.3",
172-
"uuid": "3.3.2"
181+
"uuid": "3.3.2",
182+
"vite": "4.5.3",
183+
"vite-plugin-eslint": "1.8.1",
184+
"vite-tsconfig-paths": "4.2.1",
185+
"vitest": "1.6.0"
186+
},
187+
"resolutions": {
188+
"@types/react": "16.8.25",
189+
"typescript": "3.9"
173190
}
174191
}

src/env.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/// <reference types="vite/client" />

tsconfig.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@
1616
"downlevelIteration": true,
1717
"isolatedModules": true,
1818
"noEmit": true,
19-
"jsx": "preserve",
19+
"jsx": "react-jsx",
2020
"strictNullChecks": false,
21-
"resolveJsonModule": true
21+
"resolveJsonModule": true,
22+
"noFallthroughCasesInSwitch": true,
23+
"types": ["vitest/globals"]
2224
},
2325
"include": ["src"],
2426
"exclude": ["__mocks__", "node_modules", "src/setupProxy.js"]

vite.config.js

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import { defineConfig } from 'vite';
2+
import path from 'path';
3+
import tsconfigPaths from 'vite-tsconfig-paths';
4+
import { viteCommonjs } from '@originjs/vite-plugin-commonjs';
5+
import veauryVitePlugins from 'veaury/vite/index.js';
6+
import eslint from 'vite-plugin-eslint';
7+
8+
export default defineConfig({
9+
plugins: [
10+
eslint({ cache: false }),
11+
tsconfigPaths({ loose: true }),
12+
viteCommonjs(),
13+
veauryVitePlugins({
14+
type: 'react',
15+
}),
16+
],
17+
resolve: {
18+
alias: {
19+
src: path.resolve(__dirname, './src'),
20+
},
21+
},
22+
server: {
23+
proxy: {
24+
'/.netlify/functions/': {
25+
target: 'http://localhost:6000/',
26+
changeOrigin: true,
27+
},
28+
},
29+
},
30+
css: {
31+
preprocessorOptions: {
32+
scss: {
33+
additionalData: `
34+
@import '@weni/unnnic-system/src/assets/scss/unnnic.scss';
35+
`,
36+
},
37+
},
38+
},
39+
test: {
40+
cache: false,
41+
clearMocks: true,
42+
globals: true,
43+
setupFiles: ['./vitest-setup.ts', 'vitest.d.ts'],
44+
environment: 'jsdom',
45+
root: 'src',
46+
coverage: {
47+
reporter: ['lcov', 'text'],
48+
},
49+
outputFile: 'coverage/sonar-report.xml',
50+
},
51+
});

0 commit comments

Comments
 (0)