mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 00:39:13 +00:00
refactor(web): migrate create-react-app to vite (#787)
* removed react-app type instead use vite. * removed index.html from public since vite uses it from root: read more: https://vitejs.dev/guide/#index-html-and-project-root * yarn.lock update. * added vite config file. With commented rollUp option if we want the build to be called build but using default stuff for now. * updated tsconfig to use vite and include vite.config.ts * changed package json build commands to use vite. * for some reason there is an error in vite config when we put project as tsconfig.json. * build.go updated to use the new dist folder. * refactored as well updated to use dist and web.AssetHandler again. * Fixed issue forcing the frontend to be reloaded for all routes to work if logged in fresh without reloading it will always go back to dashboard. * updated it to use the new function; need to fix the Index for baseUrl I believe, if enabled it works except logs route will crash due to cors. * refactored and default port to 7474, don't think we need the rollUpOptions. * added tmp/ to ignore . * init air.toml, for dev hot reloading both app and backend. https://github.com/cosmtrek/air run it using air but make sure it's in PATH * updated the start command to build and watch for changes, works great with air. * revert * added proxy for vite config. To be used for dev. * refactor: I think this should fix it, when logs route etc getting accessed usually it throws error but by getting rid of the catch-all it should work as intended, since web.RegisterHandler(r) will catch the unmatched ones. * fix: baseurl and build * fix(build): docker ignore !web/dist * fix(build): dockerignore add exclusions * docs: update README.md * build: update postcss config --------- Co-authored-by: KaiserBh <kaiserbh@proton.me> Co-authored-by: ze0s <ze0s@riseup.net>
This commit is contained in:
parent
2fa75d85d5
commit
edae1bbf4b
17 changed files with 715 additions and 9457 deletions
34
web/index.html
Normal file
34
web/index.html
Normal file
|
@ -0,0 +1,34 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="icon" href="/static/favicon.ico" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<meta name="theme-color" content="#000000" />
|
||||
<meta
|
||||
name="description"
|
||||
content="autobrr"
|
||||
/>
|
||||
<link rel="apple-touch-icon" href="/static/logo192.png" />
|
||||
<link crossorigin="use-credentials" rel="manifest" href="/static/manifest.json" />
|
||||
<title>autobrr</title>
|
||||
<!-- {{if eq .BaseUrl "/" }}
|
||||
<base href="/">
|
||||
<script>
|
||||
window.APP = {}
|
||||
window.APP.baseUrl = "/"
|
||||
</script>
|
||||
{{else}} -->
|
||||
<base href="{{.BaseUrl}}">
|
||||
<script>
|
||||
window.APP = {}
|
||||
window.APP.baseUrl = "{{.BaseUrl}}"
|
||||
</script>
|
||||
<!-- {{end}} -->
|
||||
</head>
|
||||
<body class="bg-color">
|
||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||
<div id="root" class="pattern"></div>
|
||||
<script type="module" src="./src/index.tsx"></script>
|
||||
</body>
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue