Skip to content

Commit 3dd0715

Browse files
committed
NCL-8490 Migrate CRA to vite
1 parent b71f9c1 commit 3dd0715

30 files changed

+3051
-20308
lines changed

.gitignore

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

1515
# production
1616
/build
17+
/dist
18+
/dist-ssr
1719

1820
# misc
1921
.DS_Store

.prettierignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
node_modules
22
build
3+
dist
34
package-lock.json
4-
.husky
5+
.husky

README.md

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). Too see more details about bootstrapping, open [documentation/bootstrapping.md](./documentation/bootstrapping.md)
66

7+
[2025-09] This project was migrated from Create React App to [Vite](https://vite.dev/). To see more information about migration, open [documentation/vite.md](./documentation/vite.md)
8+
79
## Changelog
810

911
[Changelog](https://github.com/project-ncl/pnc-web-ui-react/wiki/Changelog)
@@ -22,8 +24,6 @@ Preferred code editor is `Visual Studio Code`. Settings config file is also incl
2224

2325
Contribute using [GitHub flow](https://guides.github.com/introduction/flow/), once new Pull request is created, [GitHub Workflows](https://github.com/project-ncl/pnc-web-ui-react/tree/main/.github/workflows) are started and jobs consisting of building and testing are executed.
2426

25-
To see more details about scripts added by Create React App, open [documentation/README_CRA.md](./documentation/README_CRA.md).
26-
2727
First prepare project locally:
2828

2929
```bash
@@ -37,13 +37,19 @@ Then choose one of the following options:
3737
**1) Development**
3838

3939
```bash
40-
npm start # runs the app in the development mode and open http://localhost:3000
40+
npm start # runs the app in the development mode on: http://localhost:3000
4141
```
4242

4343
**2) Build**
4444

4545
```bash
46-
npm run build # builds the app for production to the build folder
46+
npm run build # builds the app for production to the dist folder
47+
```
48+
49+
**3) Preview**
50+
51+
```bash
52+
npm run preview # runs the production build from dist folder (only for testing purposes)
4753
```
4854

4955
## Release
@@ -66,7 +72,7 @@ Snapshot Test was integrated in some components. Update for snapshots is require
6672

6773
To update the snapshops of a component:
6874

69-
**1) Run unit test**
75+
**1a) Run unit test**
7076

7177
```bash
7278
npm run test # run tests for those components that was modified.
@@ -77,3 +83,11 @@ npm run test # run tests for those components that was modified.
7783
**2) Trigger update snapshots**
7884

7985
Press `u` to update failing snapshots.
86+
87+
**1b) Run vitest update**
88+
89+
Alternatively, trigger snapshots update directly.
90+
91+
```bash
92+
npx vitest --update
93+
```

documentation/README_CRA.md

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

documentation/vite.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Project's build tool
2+
3+
This project uses [Vite](https://vite.dev/) as the development server and build tool for production.
4+
5+
Create React App was used as a build tool before, but was migrated to Vite. The migration was done entirely manually, without using any automated tools. Old dependencies (such as `react-scripts`) were replaced with new ones (such as `vite`).
6+
7+
## vite-tsconfig-paths
8+
9+
This Vite plugin is needed for the [tsconfig.json](../tsconfig.json)'s `baseUrl` property to work correctly in the imports.

index.html

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<link rel="icon" href="/favicon.ico" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1" />
7+
<meta name="theme-color" content="#000000" />
8+
<meta name="description" content="Project New Castle Web UI" />
9+
<!-- load PNC Web Config from Orch -->
10+
<script type="text/javascript" src="%VITE_PNC_WEB_CONFIG_JS%/pnc-web-config/config.js"></script>
11+
<script type="text/javascript" src="%VITE_KEYCLOAK_URL%/js/keycloak.js"></script>
12+
<!--
13+
manifest.json provides metadata used when your web app is installed on a
14+
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
15+
-->
16+
<link rel="manifest" href="manifest.json" />
17+
<title>Newcastle Build System</title>
18+
</head>
19+
<body>
20+
<noscript>You need to enable JavaScript to run this app.</noscript>
21+
<div id="root"></div>
22+
<script type="module" src="/src/index.tsx"></script>
23+
</body>
24+
</html>

0 commit comments

Comments
 (0)