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

WIP: migrate cra to vite #5

Merged
merged 2 commits into from
Jan 15, 2024
Merged
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
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v21.5.0
12 changes: 12 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">

<head> </head>

<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root" class="page-content"></div>
<script type="module" src="/src/index.tsx"></script>
</body>

</html>
27,092 changes: 9,426 additions & 17,666 deletions package-lock.json

Large diffs are not rendered by default.

18 changes: 10 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
"version": "0.1.0",
"private": true,
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"start": "vite",
"build": "tsc && vite build",
"postbuild": "rimraf ./build/static/js/runtime~*",
"preview": "vite preview",
"test": "react-scripts test --env=jsdom --transformIgnorePatterns \"node_modules/(?!(azure-devops-ui))/\"",
"eject": "react-scripts eject",
"storybook": "storybook dev -p 6006",
Expand All @@ -26,26 +27,27 @@
],
"dependencies": {
"@types/jsonwebtoken": "^8.3.8",
"@vitejs/plugin-react": "^4.2.1",
"axios": "^0.19.2",
"azure-devops-extension-api": "^1.157.0",
"azure-devops-extension-sdk": "^2.0.11",
"azure-devops-ui": "^2.166.1",
"history": "^4.10.1",
"jwt-decode": "^4.0.0",
"moment": "^2.24.0",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react": "^16.8.0",
"react-dom": "^16.8.0",
"react-json-pretty": "^2.2.0",
"react-router-dom": "^5.1.2",
"react-scripts": "5.0.1"
"vite": "^5.0.11",
"vite-tsconfig-paths": "^4.2.3"
},
"devDependencies": {
"@babel/core": "^7.9.0",
"@storybook/addon-essentials": "^7.6.6",
"@storybook/addon-interactions": "^7.6.6",
"@storybook/addon-links": "^7.6.6",
"@storybook/addon-onboarding": "^1.0.10",
"@storybook/preset-create-react-app": "^7.6.6",
"@storybook/react": "^7.6.6",
"@storybook/react-webpack5": "^7.6.6",
"@testing-library/jest-dom": "^5.3.0",
Expand All @@ -54,7 +56,7 @@
"@types/axios": "^0.14.0",
"@types/history": "^4.7.5",
"@types/jest": "^25.1.5",
"@types/node": "^13.11.0",
"@types/node": "^20.10.8",
"@types/react": "^16.9.32",
"@types/react-dom": "^16.9.6",
"@types/react-router-dom": "^5.1.3",
Expand All @@ -66,7 +68,7 @@
"prettier": "^3.1.1",
"prop-types": "^15.8.1",
"storybook": "^7.6.6",
"typescript": "^3.9.10",
"typescript": "^5.3.3",
"webpack": "^5.89.0"
},
"jest": {
Expand Down
18 changes: 0 additions & 18 deletions public/index.html

This file was deleted.

2 changes: 1 addition & 1 deletion src/hooks/useReport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const useReport = <T>(type: string) => {

setData(report);
setError("");
} catch (e) {
} catch (e: any) {
if (e.status !== 404) {
setError(
"Something went wrong while retrieving report data. Please try again later, or contact TAS if the issue persists."
Expand Down
7 changes: 3 additions & 4 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"compilerOptions": {
"target": "es5",
"target": "ESNext",
"lib": [
"dom",
"dom.iterable",
Expand All @@ -19,8 +19,7 @@
"noEmit": true,
"jsx": "preserve",
"types": [
"jest",
"node"
"vite/client"
]
},
"include": [
Expand All @@ -29,4 +28,4 @@
"exclude": [
"node_modules"
]
}
}
15 changes: 15 additions & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import viteTsconfigPaths from "vite-tsconfig-paths";

export default defineConfig({
// depending on your application, base can also be "/"
base: "",
plugins: [react(), viteTsconfigPaths()],
server: {
// this ensures that the browser opens upon server start
open: true,
// this sets a default port to 3000
port: 3000,
},
});
Loading