Skip to content

Commit 90ecbda

Browse files
committed
wip: migrating to vite
1 parent 0584fe3 commit 90ecbda

File tree

12 files changed

+13804
-21584
lines changed

12 files changed

+13804
-21584
lines changed

babel.config.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// Babel config used by Jest (standalone, without react-scripts)
2+
module.exports = {
3+
presets: [
4+
['@babel/preset-env', { targets: { node: 'current' }, modules: 'commonjs' }],
5+
['@babel/preset-react', { runtime: 'automatic' }],
6+
'@babel/preset-typescript',
7+
],
8+
};

index.html

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="utf-8" />
6+
<link rel="icon" href="/favicon.ico" />
7+
<meta name="viewport" content="width=device-width, initial-scale=1" />
8+
<meta name="theme-color" content="#000000" />
9+
<meta name="description" content="Web site created using create-react-app" />
10+
<link rel="apple-touch-icon" href="/logo192.png" />
11+
<link rel="manifest" href="/manifest.json" />
12+
<title>JSON utility tool</title>
13+
</head>
14+
15+
<body>
16+
<noscript>You need to enable JavaScript to run this app.</noscript>
17+
<div id="root"></div>
18+
<script type="module" src="/src/index.tsx"></script>
19+
</body>
20+
21+
</html>

package-lock.json

Lines changed: 13689 additions & 21555 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 31 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,18 @@
2323
"react-hot-toast": "^2.6.0",
2424
"react-icons": "^4.4.0",
2525
"react-router-dom": "^7.12.0",
26-
"react-scripts": "5.0.1",
2726
"react-switch": "^7.1.0"
2827
},
2928
"overrides": {
3029
"@types/react": "npm:types-react@rc",
3130
"@types/react-dom": "npm:types-react-dom@rc"
3231
},
3332
"devDependencies": {
33+
"@babel/preset-env": "^7.26.0",
34+
"@babel/preset-react": "^7.26.0",
35+
"@babel/preset-typescript": "^7.26.0",
3436
"@chromatic-com/cypress": "^0.11.8",
35-
"@craco/craco": "^7.1.0",
3637
"@cypress/code-coverage": "^3.14.7",
37-
"@cypress/instrument-cra": "^1.4.0",
3838
"@stryker-mutator/core": "^9.0.1",
3939
"@stryker-mutator/jest-runner": "^9.0.1",
4040
"@stryker-mutator/typescript-checker": "^9.0.1",
@@ -47,9 +47,9 @@
4747
"@types/react": "npm:types-react@rc",
4848
"@types/react-dom": "npm:types-react-dom@rc",
4949
"@types/react-router-dom": "^5.3.3",
50-
"autoprefixer": "^9.8.7",
50+
"@vitejs/plugin-react": "^4.3.4",
51+
"autoprefixer": "^10.4.21",
5152
"babel-jest": "^29.7.0",
52-
"babel-plugin-preval": "^5.0.0",
5353
"chromatic": "^13.3.4",
5454
"concurrently": "^9.2.1",
5555
"coveralls-next": "^4.2.1",
@@ -58,32 +58,38 @@
5858
"cypress-file-upload": "^5.0.8",
5959
"electron": "^40.4.1",
6060
"electron-builder": "^26.7.0",
61+
"eslint": "^8.57.1",
6162
"eslint-config-react-app": "^7.0.1",
6263
"eslint-plugin-cypress": "^2.12.1",
6364
"eslint-plugin-react": "^7.26.1",
6465
"http-server": "^14.1.1",
6566
"husky": "^9.1.7",
67+
"jest": "^29.7.0",
6668
"jest-clipboard": "^0.0.11",
69+
"jest-environment-jsdom": "^29.7.0",
6770
"jsdom-worker": "^0.3.0",
6871
"lcov-result-merger": "^5.0.1",
72+
"node-fetch": "^2.7.0",
6973
"source-map-explorer": "^2.5.3",
7074
"tailwindcss": "^3.4.18",
75+
"typescript": "^5.8.2",
76+
"vite": "^6.3.5",
77+
"vite-plugin-istanbul": "^6.0.0",
7178
"wait-on": "^8.0.3"
7279
},
7380
"postinstall": "electron-builder install-app-deps && husky install",
7481
"scripts": {
75-
"start": "HOST=0.0.0.0 BROWSER=none craco start",
76-
"start-instrumented": "HOST=0.0.0.0 BROWSER=none craco -r @cypress/instrument-cra start",
77-
"build": "NODE_OPTIONS=--openssl-legacy-provider craco build",
78-
"analyze": "source-map-explorer 'build/static/js/*.js'",
79-
"test": "craco test --max-workers=60%",
82+
"start": "vite",
83+
"start-instrumented": "VITE_COVERAGE=true vite",
84+
"build": "vite build",
85+
"analyze": "source-map-explorer 'build/assets/*.js'",
86+
"test": "jest --max-workers=60%",
8087
"test:all": "npm run e2e && npm run test -- --watchAll=false",
81-
"coverage": "npm run test -- --env=jsdom --no-cache --collectCoverage --ci --watchAll=false --colors --silent",
88+
"coverage": "jest --no-cache --collectCoverage --ci --watchAll=false --colors --silent",
8289
"coveralls": "coveralls < merged_coverage.info",
8390
"e2e": "ELECTRON_EXTRA_LAUNCH_ARGS=--remote-debugging-port=9222 CYPRESS_BASE_URL=http://localhost:3000 cypress run",
8491
"e2e:open": "CYPRESS_BASE_URL=http://localhost:3000 cypress open",
85-
"eject": "craco eject",
86-
"dev": "concurrently -k \"npm start\" \"npm run electron\"",
92+
"dev": "concurrently -k \"vite\" \"npm run electron\"",
8793
"setup": "npm run build && cp package.json ./build",
8894
"package": "npm run setup && electron-builder --linux snap -p never",
8995
"package-windows": "npm run setup && electron-builder --win --x64 -p never",
@@ -144,11 +150,22 @@
144150
}
145151
},
146152
"jest": {
153+
"testEnvironment": "jsdom",
154+
"testPathIgnorePatterns": [
155+
"/node_modules/",
156+
"/cypress/"
157+
],
158+
"setupFilesAfterEnv": [
159+
"<rootDir>/src/setupTests.ts"
160+
],
161+
"moduleNameMapper": {
162+
"\\.(css|less|scss|sass)$": "<rootDir>/src/__mocks__/styleMock.js"
163+
},
147164
"transformIgnorePatterns": [
148165
"<rootDir>/node_modules/?!(.*)"
149166
],
150167
"transform": {
151-
"^.+\\.tsx?$": "babel-jest"
168+
"^.+\\.(tsx?|js)$": "babel-jest"
152169
}
153170
}
154171
}

postcss.config.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = {
2+
plugins: {
3+
tailwindcss: {},
4+
autoprefixer: {},
5+
},
6+
};

src/__mocks__/styleMock.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = {};

src/__test__/core/__snapshots__/formater.test.ts.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
exports[`json utility tool should format json with two space 1`] = `
44
"{
5-
\\"a\\": true,
6-
\\"b\\": false
5+
"a": true,
6+
"b": false
77
}"
88
`;

src/tailwindResolver.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
// ignore file is in here because of cypress instrumentation code
44

5-
// @preval
6-
const resolveConfig = require('tailwindcss/resolveConfig');
7-
const tailwindConfig = require('../tailwind.config');
8-
module.exports = resolveConfig(tailwindConfig);
5+
import resolveConfig from 'tailwindcss/resolveConfig';
6+
import tailwindConfig from '../tailwind.config';
7+
8+
export default resolveConfig(tailwindConfig);

stryker.config.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88
"html"
99
],
1010
"coverageAnalysis": "off",
11-
"jest": {
12-
"projectType": "create-react-app"
13-
},
1411
"checkers": [
1512
"typescript"
1613
],

tailwind.config.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
module.exports = {
2-
content: ['./src/**/*.{js,jsx,ts,tsx}', './public/index.html'],
1+
/** @type {import('tailwindcss').Config} */
2+
export default {
3+
content: ['./src/**/*.{js,jsx,ts,tsx}', './index.html'],
34
darkMode: 'class',
45
theme: {
56
extend: {

0 commit comments

Comments
 (0)