Skip to content

Commit 3a81385

Browse files
pankhur94ben-polinskyaruniverse
authored
switching test apps to vite (#389)
* removing overrides not needed * adding install step to desktop/web template readme * changing to .gitignore, updating root readme * removing braces as it is patched post micromatch@4.0.8, form-data is not required as non of the affected versions are used in our repo * web test app to vite * desktop test app to vite * suggested changes, fixing test, lint * rush change * Update packages/apps/web-viewer-test/README.md Co-authored-by: Ben Polinsky <78756012+ben-polinsky@users.noreply.github.com> * Update packages/apps/web-viewer-test/index.html Co-authored-by: Ben Polinsky <78756012+ben-polinsky@users.noreply.github.com> * Update packages/apps/desktop-viewer-test/index.html Co-authored-by: Ben Polinsky <78756012+ben-polinsky@users.noreply.github.com> * Update packages/apps/desktop-viewer-test/README.md Co-authored-by: Ben Polinsky <78756012+ben-polinsky@users.noreply.github.com> * Update common/changes/@itwin/viewer-react/pankhur94-pnpm-overrides-fix_2025-07-30-22-21.json Co-authored-by: Arun George <11051042+aruniverse@users.noreply.github.com> * Update common/changes/@itwin/web-viewer-react/pankhur94-pnpm-overrides-fix_2025-07-30-22-21.json Co-authored-by: Arun George <11051042+aruniverse@users.noreply.github.com> --------- Co-authored-by: Ben Polinsky <78756012+ben-polinsky@users.noreply.github.com> Co-authored-by: Arun George <11051042+aruniverse@users.noreply.github.com>
1 parent 57f5035 commit 3a81385

70 files changed

Lines changed: 3102 additions & 8630 deletions

Some content is hidden

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

README.MD

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ The iTwin Viewer is a configurable iTwin.js viewer. This monorepo contains the i
1212
| itwin-web-viewer-template | [packages/templates/web](packages/templates/web) | [Template that contains the iTwin Web Viewer](#itwin-viewer-template-for-web-using-vite) | Clone with degit for a quick start |
1313
| itwin-desktop-viewer-template | [packages/templates/desktop](packages/templates/desktop) | [Template that contains the iTwin Desktop Viewer](#itwin-viewer-template-for-desktop-using-vite) | Clone with degit for a quick start |
1414

15-
# iTwin Viewer Template for Web using Vite
15+
## iTwin Viewer Template for Web using Vite
1616

1717
This is a template for web applications that are based on the [iTwin Viewer](https://github.com/itwin/viewer/tree/main/packages/modules/web-viewer-react) built using [Vite](https://github.com/vitejs/vite).
1818

@@ -29,7 +29,7 @@ pnpm run build && pnpm run preview
2929
```
3030
This ensure that the icons render correctly.
3131

32-
# iTwin Viewer Template for Desktop using Vite
32+
## iTwin Viewer Template for Desktop using Vite
3333

3434
This is a template for Desktop applications that are based on the [iTwin Viewer](https://github.com/itwin/viewer/tree/main/packages/modules/desktop-viewer-react) built using [Vite](https://github.com/vitejs/vite).
3535

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"changes": [
3+
{
4+
"packageName": "@itwin/viewer-react",
5+
"comment": "",
6+
"type": "none"
7+
}
8+
],
9+
"packageName": "@itwin/viewer-react"
10+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"changes": [
3+
{
4+
"packageName": "@itwin/web-viewer-react",
5+
"comment": "",
6+
"type": "none"
7+
}
8+
],
9+
"packageName": "@itwin/web-viewer-react"
10+
}
Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,4 @@
11
{
2-
"$schema": "https://developer.microsoft.com/json-schemas/rush/v5/pnpm-config.schema.json",
3-
"useWorkspaces": true,
4-
"globalOverrides": {
5-
"body-parser@<1.20.3": "^1.20.3",
6-
"braces": "^3.0.3",
7-
"path-to-regexp@>=0.2.0": "^8.0.0",
8-
"path-to-regexp@<0.1.12": "^0.1.12",
9-
"postcss": "^8.4.31",
10-
"http-proxy-middleware": "^2.0.7",
11-
"micromatch": "^4.0.5",
12-
"send": "^0.19.0",
13-
"cross-spawn": "^7.0.5",
14-
"serve-static": "1.16.0",
15-
"form-data": "^4.0.4"
16-
}
17-
}
2+
"$schema": "https://developer.microsoft.com/json-schemas/rush/v5/pnpm-config.schema.json",
3+
"useWorkspaces": true
4+
}

common/config/rush/pnpm-lock.yaml

Lines changed: 2783 additions & 8144 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

common/scripts/eslint.base.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ module.exports = {
3939
"@typescript-eslint/interface-name-prefix": "off",
4040
"react/no-unescaped-entities": "off",
4141
"react/display-name": "off",
42+
"react/react-in-jsx-scope": "off",
4243
"react/prop-types": "off",
4344
"no-unused-vars": "off",
4445
"@typescript-eslint/no-unused-vars": ["warn", { ignoreRestSiblings: true }],

packages/apps/desktop-viewer-test/.env

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,3 @@ ITWIN_VIEWER_CLIENT_ID=""
44
ITWIN_VIEWER_REDIRECT_URI=""
55
ITWIN_VIEWER_ISSUER_URL="https://ims.bentley.com"
66
IMJS_VIEWER_CLIENT_ID=${ITWIN_VIEWER_CLIENT_ID}
7-
8-
# Advanced CRA Config: https://create-react-app.dev/docs/advanced-configuration/
9-
BROWSER=none
10-
SKIP_PREFLIGHT_CHECK=true
11-
DISABLE_ESLINT_PLUGIN=true
12-
GENERATE_SOURCEMAP=false
13-
DISABLE_NEW_JSX_TRANSFORM=true
14-
15-
# Advanced iModel.js CRA Config: https://github.com/imodeljs/create-react-app/blob/imodeljs/packages/react-scripts/README-imodeljs.md
16-
USE_FAST_SASS=false
17-
USE_FULL_SOURCEMAP=true
18-
TRANSPILE_DEPS=false
19-
DISABLE_TERSER=true

packages/apps/desktop-viewer-test/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Desktop Viewer Sample
22

3-
This app is an example of using the iTwin Viewer in a modularized React + Electron desktop application. It is meant to be used as a development environment for the components in the packages in this monorepo. It is not intended to be used as a seed/starter application. You should use the [Create React App template](https://www.npmjs.com/package/@itwin/cra-template-desktop-viewer) to seed a new application.
3+
This is an example of using the iTwin Viewer in a Electron desktop application using React. It is meant to be used as a development environment for the components in the packages in this monorepo. It is not intended to be used as a seed/starter application. You should use the [iTwin Desktop Viewer Template](https://github.com/itwin/viewer/tree/main/packages/templates/desktop) to seed a new application.
44

5-
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
5+
This project was built with [Vite](https://github.com/vitejs/vite).
66

77
## Configuration
88

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<!doctype html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="utf-8">
6+
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
7+
<meta name="theme-color" content="#000000">
8+
<link rel="shortcut icon" href="./public/favicon.ico">
9+
<title>iTwin Desktop Viewer Test App</title>
10+
<style>
11+
html,
12+
body {
13+
height: 100%;
14+
width: 100%;
15+
margin: 0;
16+
}
17+
18+
#root {
19+
height: 100%;
20+
}
21+
</style>
22+
</head>
23+
24+
<body>
25+
<noscript>
26+
You need to enable JavaScript to run this app.
27+
</noscript>
28+
<div id="root"></div>
29+
<script type="module" src="/src/frontend/index.tsx"></script>
30+
</body>
31+
32+
</html>

packages/apps/desktop-viewer-test/package.json

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,16 @@
1111
"node": ">=18.0.0"
1212
},
1313
"scripts": {
14-
"build": "",
15-
"build:desktop": "npm run -s build:frontend && npm run -s build:backend",
14+
"build": "npm run -s build:frontend && npm run -s build:backend",
1615
"build:backend": "tsc -p tsconfig.backend.json",
17-
"build:frontend": "react-scripts build",
18-
"clean": "rimraf lib build dist",
19-
"copy": "npm run copy:assets && npm run copy:enUS",
20-
"copy:assets": "cpx \"./assets/*\" ./build/assets/",
21-
"copy:enUS": "cpx \"./build/locales/en/*\" ./build/locales/en-US/",
16+
"build:frontend": "vite build",
17+
"clean": "rimraf lib dist",
2218
"electron": "electron lib/backend/main.js",
2319
"electron:debug": "cross-env NODE_ENV=development electron lib/backend/main.js",
2420
"lint": "eslint \"./src/**/*.{ts,tsx}\" 1>&2",
2521
"lint:fix": "npm run -s lint -- --fix",
2622
"start": "npm run build:backend && run-p \"start:frontend\" \"electron:debug\"",
27-
"start:frontend": "react-scripts start",
23+
"start:frontend": "vite",
2824
"test": ""
2925
},
3026
"browserslist": [
@@ -74,7 +70,6 @@
7470
"@itwin/tree-widget-react": "^3.0.0",
7571
"@itwin/webgl-compatibility": "^5.0.0",
7672
"@itwin/unified-selection-react": "^1.0.0",
77-
"@types/dotenv-flow": "^3.2.0",
7873
"dotenv-flow": "^3.2.0",
7974
"electron": "^36.0.0",
8075
"minimist": "^1.2.8",
@@ -86,20 +81,23 @@
8681
"redux": "^5.0.0"
8782
},
8883
"devDependencies": {
89-
"@bentley/react-scripts": "^5.0.5",
9084
"@itwin/build-tools": "^4.0.6",
85+
"@types/dotenv-flow": "^3.2.0",
9186
"@types/electron-devtools-installer": "^2.2.2",
9287
"@types/minimist": "^1.2.2",
9388
"@types/node": "^22",
9489
"@types/react": "^18.2.18",
9590
"@types/react-dom": "^18.2.7",
91+
"@vitejs/plugin-react": "^4.6.0",
9692
"cpx2": "4.2.0",
9793
"cross-env": "^7.0.3",
9894
"electron-devtools-installer": "^2.2.4",
9995
"npm-run-all": "^4.1.5",
10096
"rimraf": "^3.0.2",
101-
"sass": "^1.64.2",
97+
"sass": "^1.89.2",
10298
"typescript": "~5.6.2",
103-
"webpack": "^5.94.0"
99+
"vite": "^7.0.1",
100+
"vite-plugin-node-polyfills": "^0.24.0",
101+
"vite-plugin-static-copy": "^3.1.0"
104102
}
105103
}

0 commit comments

Comments
 (0)