Skip to content

Commit

Permalink
chore: change CRA to Vite (kyma-project#3334)
Browse files Browse the repository at this point in the history
* feat: npm install vite

* feat: npm uninstall react-scripts

* feat: adjust package json

* feat: add vite config file

* feat: move index.html on root

* feat: js support

* feat: server port

* change js to ts

* feat: adjust vite config, tsconfig, themeAtom, comment scss import, fix EditCluster, add plugin for paths and svgs

* fix: scsses

* fix: imports in workers

* fix: vite:worker-import-meta-url vite: Rollup failed to resolve import

* fix: fetch example rule-set

* fix: jsonpath import

* fix: trying to fix docker build

* feat: add website icon

* chore: I hope it's necesary

* chore: I hope this will fix build

* chore: I hope this will speed up the build

* fix: data-testID to data-testid

* chore: revert speeding up build

* config jest tests

* fix settings test and change backend address

* change backend address to local

* test local address exception

* fix: move css declaration

* fix: add include for deps optimization

* fix: fix monaco errors

* fix: fix resource validation & move config

* fix: public to base_url, remove unused & monaco fix

* fix: adjust theme url for vite

* fix: test new yaml copy

* chore: remove unused alias

* chore: bump cypress

* fix: fix docker variable

* fix: add not

* fix: change var name

---------

Co-authored-by: Oliwia Gowor <oliwiagowor@gmail.com>
  • Loading branch information
mrCherry97 and OliwiaGowor authored Oct 8, 2024
1 parent cc13afb commit 2f58885
Show file tree
Hide file tree
Showing 57 changed files with 5,834 additions and 1,448 deletions.
15 changes: 15 additions & 0 deletions babel.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"presets": [
["@babel/preset-env", { "targets": { "node": "current" } }],

"@babel/preset-react",

[
"babel-preset-vite",
{
"env": true,
"glob": false
}
]
]
}
52 changes: 0 additions & 52 deletions config-overrides.js

This file was deleted.

18 changes: 18 additions & 0 deletions config-overrides/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// this overrides configs of webpack and jest. See react-app-rewired documentation for details

module.exports = {
jest: function(config) {
config.moduleNameMapper = {
'^shared/?(.*)': '<rootDir>/src/shared/$1',
...config.moduleNameMapper,
};
config.transformIgnorePatterns = [
'node_modules/(?!(@ui5|lit-html|d3|internmap)).*\\.js$',
];
config.snapshotSerializers = [
'enzyme-to-json/serializer',
...(config.snapshotSerializers || []),
];
return config;
},
};
5 changes: 5 additions & 0 deletions config-overrides/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "config-overrides",
"main": "index.js",
"type": "commonjs"
}
43 changes: 43 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link
rel="icon"
type="image/png"
sizes="32x32"
href="./assets/favicon-32x32.png"
/>
<link
rel="icon"
type="image/png"
sizes="16x16"
href="./assets/favicon-16x16.png"
/>
<meta
name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no"
/>
<meta name="theme-color" content="#000000" />
<title>Busola</title>
</head>

<body class="ui5-content-native-scrollbars ui5-content-density-compact">
<noscript>
You need to enable JavaScript to run this app.
</noscript>
<script type="module" src="/src/index.tsx"></script>

<div id="root"></div>
<!--
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>
9 changes: 9 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export default {
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/src/$1',
},
testEnvironment: 'jest-environment-jsdom',
transform: {
'^.+\\.[t|j]sx?$': 'babel-jest',
},
};
Loading

0 comments on commit 2f58885

Please sign in to comment.