Skip to content

Commit 5f94ab2

Browse files
vite
1 parent fb20877 commit 5f94ab2

11 files changed

Lines changed: 120 additions & 69 deletions

File tree

Web/ClientApp/.env.development

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
PORT=44463
2-
HTTPS=true
3-
REACT_APP_DEFAULT_APISOURCE=LocalWeb
1+
VITE_PORT=44463
2+
VITE_DEFAULT_APISOURCE=LocalWeb
3+

Web/ClientApp/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
# production
1010
/build
11+
/dist
1112

1213
# misc
1314
.DS_Store
@@ -19,3 +20,4 @@
1920
npm-debug.log*
2021
yarn-debug.log*
2122
yarn-error.log*
23+

Web/ClientApp/index.html

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<meta name="theme-color" content="#000000" />
8+
<base href="/" />
9+
<meta name="robots" content="index,follow" />
10+
<meta name="title" content="Convert VB.NET to/from C# online" />
11+
<meta name="keywords" content="convert, c#, csharp, cs, VB, VB.NET, Visual Basic,code converter, csharp to vb, vb to csharp, c#, vb.net, vb, convert,free, Roslyn, code, converter, tool, conversion, file, class, module, refactoring, open source, oss" />
12+
<meta name="description" content="Completely free and open source code converter. Convert snippets online, or download the Visual Studio Extension or command line to convert whole projects/solutions and increase conversion accuracy." />
13+
<meta name="google-site-verification" content="aosecidc9TBJtszGyqGIJAXcr52U6czfoDXhQYsCvBY" />
14+
<link rel="manifest" href="/manifest.json" />
15+
<title>Code Converter: VB &lt;-&gt; C#</title>
16+
</head>
17+
<body>
18+
<noscript>You need to enable JavaScript to run this app.</noscript>
19+
<div id="root"></div>
20+
<script type="module" src="/src/index.tsx"></script>
21+
</body>
22+
</html>
23+

Web/ClientApp/package.json

Lines changed: 9 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -2,39 +2,15 @@
22
"name": "codeconverter",
33
"version": "0.1.0",
44
"private": true,
5-
"eslintConfig": {
6-
"extends": "react-app"
7-
},
5+
"type": "module",
86
"scripts": {
97
"prestart": "node aspnetcore-https && node aspnetcore-react",
10-
"start": "rimraf ./build && react-scripts start",
11-
"build": "react-scripts build",
12-
"test": "cross-env CI=true react-scripts test --env=jsdom",
13-
"eject": "react-scripts eject",
8+
"dev": "vite",
9+
"start": "vite",
10+
"build": "tsc && vite build",
11+
"preview": "vite preview",
1412
"lint": "eslint ./src/"
1513
},
16-
"browserslist": {
17-
"production": [
18-
">0.2%",
19-
"not dead",
20-
"not op_mini all"
21-
],
22-
"development": [
23-
"last 1 chrome version",
24-
"last 1 firefox version",
25-
"last 1 safari version"
26-
]
27-
},
28-
"babel": {
29-
"presets": [
30-
[
31-
"@babel/preset-react",
32-
{
33-
"runtime": "automatic"
34-
}
35-
]
36-
]
37-
},
3814
"dependencies": {
3915
"@monaco-editor/react": "^4.7.0",
4016
"axios": "^1.13.4",
@@ -48,17 +24,11 @@
4824
"reactstrap": "^9.2.3"
4925
},
5026
"devDependencies": {
51-
"@types/jest": "^30.0.0",
27+
"@types/node": "^22.10.5",
5228
"@types/react": "^19.2.13",
5329
"@types/react-dom": "^19.2.3",
54-
"ajv": "^8.17.1",
55-
"cross-env": "^10.1.0",
56-
"eslint-config-react-app": "^7.0.1",
57-
"http-proxy-middleware": "^3.0.5",
58-
"jquery": "^4.0.0",
59-
"popper.js": "^1.16.1",
60-
"react-scripts": "^5.0.1",
61-
"rimraf": "^6.1.2",
62-
"typescript": "~4.9.5"
30+
"@vitejs/plugin-react": "^4.3.4",
31+
"typescript": "~5.7.2",
32+
"vite": "^6.0.11"
6333
}
6434
}

Web/ClientApp/src/App.test.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import React from 'react';
21
import { createRoot } from 'react-dom/client';
32
import { MemoryRouter } from 'react-router-dom';
43
import App from './App';
@@ -12,4 +11,4 @@ it('renders without crashing', async () => {
1211
</MemoryRouter>
1312
);
1413
await new Promise(resolve => setTimeout(resolve, 1000));
15-
});
14+
});

Web/ClientApp/src/App.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import * as Api from "./Api"
2-
import React, { Component, useEffect, useState } from "react";
2+
import { useEffect, useState } from "react";
33
import { Route, Routes } from "react-router";
44
import Layout from "./components/Layout";
55
import { Home } from "./components/Home";
66
import { About } from "./components/About";
77

88
import "./custom.css"
99

10+
1011
const App = () => {
1112
const [versionString, setVersionString] = useState("");
1213
useEffect(() => {

Web/ClientApp/src/index.tsx

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
import 'bootstrap/dist/css/bootstrap.css';
2-
import React from 'react';
2+
import { StrictMode } from 'react';
33
import { createRoot } from 'react-dom/client';
44
import { BrowserRouter } from 'react-router-dom';
55
import App from './App';
6-
import registerServiceWorker from './registerServiceWorker';
6+
7+
// Set the API source in the document head for the API module to read
8+
const headElement = document.head as HTMLElement & { dataset: DOMStringMap };
9+
headElement.dataset['apisource'] = import.meta.env.VITE_DEFAULT_APISOURCE || 'LocalWeb';
710

811
const baseUrl = document.getElementsByTagName('base')[0]?.getAttribute('href') || undefined;
912

@@ -13,9 +16,12 @@ let normalizedBaseUrl = baseUrl;
1316
if (normalizedBaseUrl && normalizedBaseUrl.endsWith('/') && normalizedBaseUrl !== '/') {
1417
normalizedBaseUrl = normalizedBaseUrl.substring(0, normalizedBaseUrl.length - 1);
1518
}
19+
1620
root.render(
17-
<BrowserRouter basename={baseUrl}>
18-
<App />
19-
</BrowserRouter>);
21+
<StrictMode>
22+
<BrowserRouter basename={baseUrl}>
23+
<App />
24+
</BrowserRouter>
25+
</StrictMode>
26+
);
2027

21-
registerServiceWorker();

Web/ClientApp/src/react-app-env.d.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

Web/ClientApp/src/vite-env.d.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/// <reference types="vite/client" />
2+
3+
interface ImportMetaEnv {
4+
readonly VITE_DEFAULT_APISOURCE: string
5+
readonly VITE_PUBLIC_URL?: string
6+
}
7+
8+
interface ImportMeta {
9+
readonly env: ImportMetaEnv
10+
}

Web/ClientApp/tsconfig.json

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,32 @@
11
{
22
"compilerOptions": {
3-
"target": "es5",
3+
"target": "ES2020",
4+
"useDefineForClassFields": true,
5+
"lib": ["ES2020", "DOM", "DOM.Iterable"],
6+
"module": "ESNext",
7+
"skipLibCheck": true,
8+
9+
/* Bundler mode */
10+
"moduleResolution": "bundler",
11+
"allowImportingTsExtensions": true,
12+
"isolatedModules": true,
13+
"moduleDetection": "force",
14+
"noEmit": true,
15+
"jsx": "react-jsx",
16+
17+
/* Linting */
18+
"strict": true,
19+
"noUnusedLocals": true,
20+
"noUnusedParameters": true,
21+
"noFallthroughCasesInSwitch": true,
22+
"noUncheckedSideEffectImports": true,
23+
24+
/* Additional */
425
"allowJs": true,
526
"esModuleInterop": true,
627
"allowSyntheticDefaultImports": true,
7-
"strict": true,
828
"forceConsistentCasingInFileNames": true,
9-
"module": "esnext",
10-
"moduleResolution": "node",
11-
"resolveJsonModule": true,
12-
"isolatedModules": true,
13-
"noEmit": true,
14-
"jsx": "react-jsx",
15-
"lib": [
16-
"es2015",
17-
"dom"
18-
],
19-
"skipLibCheck": false,
20-
"noFallthroughCasesInSwitch": true
29+
"resolveJsonModule": true
2130
},
22-
"include": [
23-
"src"
24-
]
31+
"include": ["src"]
2532
}

0 commit comments

Comments
 (0)