Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

migrated CRA to Vite and made necessary changes #301

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 88 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="icon" href="public/favicon.ico" />
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta
name="keywords"
content="fossology,
spdx,
license-management,
license"
/>
<meta
name="description"
content="FOSSology is a open source license compliance software system and toolkit. As a toolkit you can run license, copyright and export control scans from the command line. "
/>
<meta name="author" content="@fossology" />
<meta name="theme-color" content="#DC3545" />
<meta itemprop="name" content="FOSSology | Open source license compliance software system" />
<meta
itemprop="description"
content="FOSSology is a open source license compliance software system and toolkit. As a toolkit you can run license, copyright and export control scans from the command line. "
/>
<meta
itemprop="image"
content="https://www.fossology.org/wp-content/uploads/sites/39/2017/08/logo_fossology.png"
/>
<meta name="twitter:card" content="Summary" />
<meta name="twitter:site" content="@fossology" />
<meta name="twitter:title" content="FOSSology | Open source license compliance software system" />
<meta
name="twitter:description"
content="FOSSology is a open source license compliance software system and toolkit. As a toolkit you can run license, copyright and export control scans from the command line. "
/>
<meta name="twitter:creator" content="@fossology" />
<meta
name="twitter:image:src"
content="https://www.fossology.org/wp-content/uploads/sites/39/2017/08/logo_fossology.png"
/>
<meta property="og:title" content="FOSSology | Open source license compliance software system" />
<meta property="og:type" content="The study of Open Source" />
<meta property="og:url" content="https://www.fossology.org/" />
<meta
property="og:image"
content="https://www.fossology.org/wp-content/uploads/sites/39/2017/08/logo_fossology.png"
/>
<meta
property="og:description"
content="FOSSology is a open source license compliance software system and toolkit. As a toolkit you can run license, copyright and export control scans from the command line. "
/>
<meta
property="og:site_name"
content="FOSSology | Open source license compliance software system"
/>
<link rel="apple-touch-icon" href="public/logo192.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="public/manifest.json" />
<!--
Notice the use of public in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.

Unlike "/favicon.ico" or "favicon.ico", "public/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>FOSSology UI</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<script type="module" src="/src/index.jsx"></script>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.

You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.

To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
</html>
14 changes: 12 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@
"web-vitals": "^1.0.1"
},
"scripts": {
"dev": "vite",
"preview": "vite preview",
"start": "react-scripts start",
"build": "react-scripts build",
"build": "vite build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"format": "prettier --write .",
Expand Down Expand Up @@ -73,22 +75,30 @@
"babel-loader": "8.1.0"
},
"devDependencies": {
"@eslint/js": "^9.15.0",
"@storybook/addon-actions": "^6.5.5",
"@storybook/addon-essentials": "^6.5.5",
"@storybook/addon-links": "^6.5.5",
"@storybook/node-logger": "^6.5.5",
"@storybook/preset-create-react-app": "^3.1.7",
"@storybook/react": "^6.5.5",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"@vitejs/plugin-react": "^4.3.4",
"csv-parser": "^3.0.0",
"eslint": "^7.28.0",
"eslint-config-airbnb": "18.2.1",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jsx-a11y": "^6.5.1",
"eslint-plugin-prettier": "^3.4.0",
"eslint-plugin-react": "^7.37.2",
"eslint-plugin-react-hooks": "^1.7.0",
"eslint-plugin-react-refresh": "^0.4.14",
"globals": "^15.12.0",
"jest-fetch-mock": "3.0.3",
"prettier": "^2.6.2"
"prettier": "^2.6.2",
"vite": "^6.0.1"
},
"packageManager": "[email protected]"
}
2 changes: 1 addition & 1 deletion src/Routes.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ const Footer = React.lazy(() => import("components/Footer"));
const Routes = () => {
return (
<>
<BrowserRouter basename={process.env.PUBLIC_URL}>
<BrowserRouter basename={import.meta.env.PUBLIC_URL}>
<Switch>
{/* Home Page */}
<PublicLayout exact path={routes.home} component={Home} />
Expand Down
6 changes: 3 additions & 3 deletions src/constants/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
*/

// Length of the random string for login
export const tokenNameLength = process.env.TOKEN_NAME_LENGTH || 40;
export const tokenNameLength = import.meta.env.TOKEN_NAME_LENGTH || 40;

// By default the scope for user is to write
export const tokenScope = process.env.TOKEN_SCOPE || "write";
export const tokenScope = import.meta.env.TOKEN_SCOPE || "write";

// Authorization token expiry days
export const tokenExpiryDays = process.env.TOKEN_EXPIRY_DAYS || 2;
export const tokenExpiryDays = import.meta.env.TOKEN_EXPIRY_DAYS || 2;
4 changes: 2 additions & 2 deletions src/constants/endpoints.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@

// Api Url set in the env file
const apiUrl = `${
process.env.REACT_APP_HTTPS === "true" ? "https" : "http"
}://${process.env.REACT_APP_SERVER_URL}`;
import.meta.env.REACT_APP_HTTPS === "true" ? "https" : "http"
}://${import.meta.env.REACT_APP_SERVER_URL}`;

// Endpoints for all the REST APIs
const endpoints = {
Expand Down
24 changes: 24 additions & 0 deletions vite.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import path from "path";

// https://vite.dev/config/
export default defineConfig({
plugins: [react()],
resolve: {
alias: {
styles: path.resolve(__dirname, "src/styles"),
context: path.resolve(__dirname, "src/context"),
Routes: path.resolve(__dirname, "src/Routes"),
constants: path.resolve(__dirname, "src/constants"),
shared: path.resolve(__dirname, "src/shared"),
pages: path.resolve(__dirname, "src/pages"),
services: path.resolve(__dirname, "src/services"),
assets: path.resolve(__dirname, "src/assets"),
api: path.resolve(__dirname, "src/api"),
components: path.resolve(__dirname, "src/components"),
data: path.resolve(__dirname, "src/data"),

},
},
})
Loading
Loading