Skip to content

Commit 677e2f6

Browse files
5.0.0-beta.2 vite migration from create-react-app
1 parent 1c7185b commit 677e2f6

File tree

83 files changed

+1394
-7769
lines changed

Some content is hidden

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

83 files changed

+1394
-7769
lines changed

.env

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
PORT=3136
2-
REACT_APP_VERSION=$npm_package_version
3-
REACT_APP_NAME=$npm_package_name
1+
VITE_REACT_APP_VERSION=$npm_package_version
2+
VITE_REACT_APP_NAME=$npm_package_name
43
SKIP_PREFLIGHT_CHECK=true

.eslintrc.cjs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
module.exports = {
2+
root: true,
3+
env: { browser: true, es2020: true },
4+
extends: [
5+
'eslint:recommended',
6+
'plugin:@typescript-eslint/recommended',
7+
'plugin:react-hooks/recommended',
8+
],
9+
ignorePatterns: ['dist', '.eslintrc.cjs'],
10+
parser: '@typescript-eslint/parser',
11+
plugins: ['react-refresh'],
12+
rules: {
13+
'react-refresh/only-export-components': [
14+
'warn',
15+
{ allowConstantExport: true },
16+
],
17+
},
18+
}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ react-validatable-form.iml
44
stats.html
55
/node_modules
66
/build
7+
/storybook-dist
78

89
npm-debug.log*
910
yarn-debug.log*

.yarn/releases/yarn-4.0.0.cjs renamed to .yarn/releases/yarn-4.0.1.cjs

Lines changed: 323 additions & 323 deletions
Large diffs are not rendered by default.

.yarnrc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ enableGlobalCache: false
44

55
nodeLinker: node-modules
66

7-
yarnPath: .yarn/releases/yarn-4.0.0.cjs
7+
yarnPath: .yarn/releases/yarn-4.0.1.cjs

index.html

Lines changed: 13 additions & 0 deletions
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/png" href="/favicon.png" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<title>React Validatable Fom Storybook</title>
8+
</head>
9+
<body>
10+
<div id="root"></div>
11+
<script type="module" src="/src/main.jsx"></script>
12+
</body>
13+
</html>

package.json

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-validatable-form",
3-
"version": "5.0.0-beta.1",
3+
"version": "5.0.0-beta.2",
44
"description": "React validatable form hook that is used to make dynamic client side validations on react forms",
55
"keywords": [
66
"react",
@@ -15,11 +15,15 @@
1515
"build": "rimraf dist && rollup --config rollup.config.mjs --environment NODE_ENV:production",
1616
"start": "rimraf dist && rollup --config rollup.config.mjs -w --environment NODE_ENV:development",
1717
"prepublishOnly": "npm run build",
18-
"start-storybook": "set PUBLIC_URL=. && react-scripts start",
19-
"build-storybook": "react-scripts build",
18+
"start-storybook": "vite --port 3136",
19+
"build-storybook": "vite build",
20+
"preview-storybook": "vite preview",
2021
"test": "jest tests"
2122
},
22-
"repository": "https://github.com/obss/react-validatable-form.git",
23+
"repository": {
24+
"type": "git",
25+
"url": "git+https://github.com/obss/react-validatable-form.git"
26+
},
2327
"homepage": "https://obss.github.io/react-validatable-form-demo",
2428
"license": "MIT",
2529
"author": "ahmetemrekilinc",
@@ -51,6 +55,7 @@
5155
"@testing-library/react": "13.4.0",
5256
"@testing-library/react-hooks": "8.0.1",
5357
"@testing-library/user-event": "14.4.3",
58+
"@vitejs/plugin-react": "^4.0.4",
5459
"antd": "4.23.5",
5560
"babel-jest": "29.2.0",
5661
"bootstrap": "5.2.2",
@@ -70,13 +75,13 @@
7075
"react-helmet-async": "1.3.0",
7176
"react-minimal-side-navigation": "1.9.2",
7277
"react-router-dom": "6.4.2",
73-
"react-scripts": "5.0.1",
7478
"react-test-renderer": "18.2.0",
7579
"rollup": "3.2.2",
7680
"rollup-plugin-node-builtins": "2.1.2",
7781
"rollup-plugin-node-globals": "1.4.0",
7882
"rollup-plugin-peer-deps-external": "2.2.4",
7983
"rollup-plugin-visualizer": "5.8.3",
84+
"vite": "^4.4.5",
8085
"web-vitals": "3.0.1"
8186
},
8287
"dependencies": {
@@ -99,5 +104,5 @@
99104
"last 1 safari version"
100105
]
101106
},
102-
"packageManager": "[email protected].0"
107+
"packageManager": "[email protected].1"
103108
}

public/index.html

Lines changed: 0 additions & 44 deletions
This file was deleted.

src/App.js renamed to src/App.jsx

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/components/Main.js renamed to src/components/Main.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -287,10 +287,10 @@ const Main = () => {
287287
};
288288

289289
return (
290-
<BrowserRouter>
290+
<BrowserRouter basename="/react-validatable-form">
291291
<div className={'obssTriangle'}>
292292
<a className={'triangleIcon'} href={'https://obss.tech/'} target={'_blank'} rel="noreferrer">
293-
<img src={process.env.PUBLIC_URL + '/obss.png'} alt={'obss'} />
293+
<img src={import.meta.env.BASE_URL + '/obss.png'} alt={'obss'} />
294294
</a>
295295
</div>
296296
<Box flexGrow={1}>
@@ -303,7 +303,7 @@ const Main = () => {
303303
<img
304304
width={48}
305305
className={'menuLogo'}
306-
src={process.env.PUBLIC_URL + '/logo.png'}
306+
src={import.meta.env.BASE_URL + '/logo.png'}
307307
alt={'logo'}
308308
/>
309309
<span className="bannerText">react-validatable-form Storybook</span>
File renamed without changes.
File renamed without changes.

src/components/Settings.js renamed to src/components/Settings.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { SettingsOutlined } from '@mui/icons-material';
55

66
const Settings = (props) => {
77
const { openSettingsDialog } = props;
8-
const versionInfo = `Version: ${process.env.REACT_APP_VERSION}`;
8+
const versionInfo = `Version: ${import.meta.env.VITE_REACT_APP_VERSION}`;
99

1010
return (
1111
<div className={'settings-div'}>
@@ -18,14 +18,14 @@ const Settings = (props) => {
1818
<Tooltip placement="bottom" title="View on GitHub">
1919
<span className={'githubIcon'}>
2020
<a href={'https://github.com/obss/react-validatable-form'} target="_blank" rel="noreferrer">
21-
<img src={process.env.PUBLIC_URL + '/github.png'} alt="github_icon" />
21+
<img src={import.meta.env.BASE_URL + '/github.png'} alt="github_icon" />
2222
</a>
2323
</span>
2424
</Tooltip>
2525
<Tooltip placement="bottom" title="View on npmjs">
2626
<span className={'npmIcon'}>
2727
<a href={'https://www.npmjs.com/package/react-validatable-form'} target="_blank" rel="noreferrer">
28-
<img src={process.env.PUBLIC_URL + '/npm.png'} alt="npm_icon" />
28+
<img src={import.meta.env.BASE_URL + '/npm.png'} alt="npm_icon" />
2929
</a>
3030
</span>
3131
</Tooltip>

src/components/ValidationResult.js renamed to src/components/ValidationResult.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import './ValidationResult.css';
22

33
const ValidationResult = ({ isValid }) => {
4-
let imgSrc = process.env.PUBLIC_URL + '/';
4+
let imgSrc = import.meta.env.BASE_URL + '/';
55
let validationResultText = '';
66
if (isValid) {
77
imgSrc += 'valid.png';
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/components/getting-started/Home.js renamed to src/components/getting-started/Home.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const Home = () => {
4444
rowGap={5}
4545
pt={2}
4646
>
47-
<img width={'200px'} src={process.env.PUBLIC_URL + '/logo.png'} alt={'logo'} />
47+
<img width={'200px'} src={import.meta.env.BASE_URL + '/logo.png'} alt={'logo'} />
4848
<Typography variant={'h3'}> react-validatable-form </Typography>
4949
<Typography variant={'h6'}>
5050
{' '}
@@ -158,7 +158,7 @@ const Home = () => {
158158
</Button>
159159
</Box>
160160
<video width={'500px'} autoPlay loop playsInline muted>
161-
<source src={process.env.PUBLIC_URL + '/example_video.mp4'} type={'video/mp4'} />
161+
<source src={import.meta.env.BASE_URL + '/example_video.mp4'} type={'video/mp4'} />
162162
</video>
163163
</Box>
164164
);
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

vite.config.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { defineConfig } from 'vite';
2+
import react from '@vitejs/plugin-react';
3+
4+
// https://vitejs.dev/config/
5+
export default defineConfig({
6+
plugins: [
7+
react({
8+
include: '**/*.{js,jsx,tsx}',
9+
}),
10+
],
11+
base: '/react-validatable-form/',
12+
build: {
13+
outDir: 'storybook-dist',
14+
},
15+
});

0 commit comments

Comments
 (0)