Add netlify for fast previews (#5353)

* Add netlify to readme

* add redirect for testing

* fix command

* add SPA redirect

* run desktop lighthouse tests

* add base dir

* remove base dir - use app redirect

* remove unneeded redirect

* remove status

* remove status

* static redirects

* remove toml redirect

* use toml again

* make redirect conditional

* add debug msg

* remove check section
This commit is contained in:
Matthias Mair 2023-07-27 03:17:44 +02:00 committed by GitHub
parent 339eae53a1
commit 39464f645a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 0 deletions

View File

@ -9,6 +9,7 @@
[![Documentation Status](https://readthedocs.org/projects/inventree/badge/?version=latest)](https://inventree.readthedocs.io/en/latest/?badge=latest)
![Docker Build](https://github.com/inventree/inventree/actions/workflows/docker.yaml/badge.svg)
[![OpenSSF Best Practices](https://bestpractices.coreinfrastructure.org/projects/7179/badge)](https://bestpractices.coreinfrastructure.org/projects/7179)
[![Netlify Status](https://api.netlify.com/api/v1/badges/9bbb2101-0a4d-41e7-ad56-b63fb6053094/deploy-status)](https://app.netlify.com/sites/inventree/deploys)
[![Coveralls](https://img.shields.io/coveralls/github/inventree/InvenTree)](https://coveralls.io/github/inventree/InvenTree)
[![Crowdin](https://badges.crowdin.net/inventree/localized.svg)](https://crowdin.com/project/inventree)
@ -156,8 +157,10 @@ Find a full list of used third-party libraries in [our documentation](https://do
<a href="https://inventree.org/digitalocean">
<img src="https://opensource.nyc3.cdn.digitaloceanspaces.com/attribution/assets/SVG/DO_Logo_horizontal_blue.svg" width="201px">
</a>
<a href="https://www.netlify.com"> <img src="https://www.netlify.com/v3/img/components/netlify-color-bg.svg" alt="Deploys by Netlify" /> </a>
</p>
<!-- License -->
## :warning: License

19
src/frontend/netlify.toml Normal file
View File

@ -0,0 +1,19 @@
# Netlify configuration file
# https://www.netlify.com/docs/netlify-toml-reference/
[build]
command = "yarn run build --outDir dist"
publish = "dist"
# Send requests to subpath
[[redirects]]
from = "/*"
to = "/index.html"
status = 200
[[plugins]]
package = "@netlify/plugin-lighthouse"
[plugins.inputs.settings]
preset = "desktop" # Optionally run Lighthouse using a desktop configuration

View File

@ -8,3 +8,8 @@ ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(
<App />
</React.StrictMode>
);
// Redirect to /platform if on /
if (window.location.pathname === '/') {
window.location.replace('/platform');
}