Add vite
Changes according to Vite defaults: - Move index.html to root - Replace `%PUBLIC_URL%` with plain `/`
This commit is contained in:
parent
951c90763a
commit
e21327cec5
6 changed files with 527 additions and 14542 deletions
3
Makefile
3
Makefile
|
@ -129,8 +129,7 @@ web-build:
|
||||||
&& rm -rf ../server/site \
|
&& rm -rf ../server/site \
|
||||||
&& mv build ../server/site \
|
&& mv build ../server/site \
|
||||||
&& rm \
|
&& rm \
|
||||||
../server/site/config.js \
|
../server/site/config.js
|
||||||
../server/site/asset-manifest.json
|
|
||||||
|
|
||||||
web-deps:
|
web-deps:
|
||||||
cd web && npm install
|
cd web && npm install
|
||||||
|
|
|
@ -219,7 +219,7 @@ func TestServer_StaticSites(t *testing.T) {
|
||||||
|
|
||||||
rr = request(t, s, "GET", "/mytopic", "", nil)
|
rr = request(t, s, "GET", "/mytopic", "", nil)
|
||||||
require.Equal(t, 200, rr.Code)
|
require.Equal(t, 200, rr.Code)
|
||||||
require.Contains(t, rr.Body.String(), `<meta name="robots" content="noindex, nofollow"/>`)
|
require.Contains(t, rr.Body.String(), `<meta name="robots" content="noindex, nofollow" />`)
|
||||||
|
|
||||||
rr = request(t, s, "GET", "/docs", "", nil)
|
rr = request(t, s, "GET", "/docs", "", nil)
|
||||||
require.Equal(t, 301, rr.Code)
|
require.Equal(t, 301, rr.Code)
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
<meta name="apple-mobile-web-app-status-bar-style" content="#317f6f" />
|
<meta name="apple-mobile-web-app-status-bar-style" content="#317f6f" />
|
||||||
|
|
||||||
<!-- Favicon, see favicon.io -->
|
<!-- Favicon, see favicon.io -->
|
||||||
<link rel="icon" type="image/png" href="%PUBLIC_URL%/static/images/favicon.ico" />
|
<link rel="icon" type="image/png" href="/static/images/favicon.ico" />
|
||||||
|
|
||||||
<!-- Previews in Google, Slack, WhatsApp, etc. -->
|
<!-- Previews in Google, Slack, WhatsApp, etc. -->
|
||||||
<meta property="og:type" content="website" />
|
<meta property="og:type" content="website" />
|
||||||
|
@ -26,15 +26,15 @@
|
||||||
property="og:description"
|
property="og:description"
|
||||||
content="ntfy lets you send push notifications via scripts from any computer or phone. Made with ❤ by Philipp C. Heckel, Apache License 2.0, source at https://heckel.io/ntfy."
|
content="ntfy lets you send push notifications via scripts from any computer or phone. Made with ❤ by Philipp C. Heckel, Apache License 2.0, source at https://heckel.io/ntfy."
|
||||||
/>
|
/>
|
||||||
<meta property="og:image" content="%PUBLIC_URL%/static/images/ntfy.png" />
|
<meta property="og:image" content="/static/images/ntfy.png" />
|
||||||
<meta property="og:url" content="https://ntfy.sh" />
|
<meta property="og:url" content="https://ntfy.sh" />
|
||||||
|
|
||||||
<!-- Never index -->
|
<!-- Never index -->
|
||||||
<meta name="robots" content="noindex, nofollow" />
|
<meta name="robots" content="noindex, nofollow" />
|
||||||
|
|
||||||
<!-- Style overrides & fonts -->
|
<!-- Style overrides & fonts -->
|
||||||
<link rel="stylesheet" href="%PUBLIC_URL%/static/css/app.css" type="text/css" />
|
<link rel="stylesheet" href="/static/css/app.css" type="text/css" />
|
||||||
<link rel="stylesheet" href="%PUBLIC_URL%/static/css/fonts.css" type="text/css" />
|
<link rel="stylesheet" href="/static/css/fonts.css" type="text/css" />
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<noscript>
|
<noscript>
|
||||||
|
@ -43,6 +43,7 @@
|
||||||
subscribe.
|
subscribe.
|
||||||
</noscript>
|
</noscript>
|
||||||
<div id="root"></div>
|
<div id="root"></div>
|
||||||
<script src="%PUBLIC_URL%/config.js"></script>
|
<script src="/config.js"></script>
|
||||||
|
<script type="module" src="/src/index.jsx"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
15029
web/package-lock.json
generated
15029
web/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -3,10 +3,9 @@
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "DISABLE_ESLINT_PLUGIN=true react-scripts start",
|
"start": "NODE_OPTIONS=\"--enable-source-maps\" vite",
|
||||||
"build": "DISABLE_ESLINT_PLUGIN=true react-scripts build",
|
"build": "vite build",
|
||||||
"test": "DISABLE_ESLINT_PLUGIN=true react-scripts test",
|
"serve": "vite preview",
|
||||||
"eject": "DISABLE_ESLINT_PLUGIN=true react-scripts eject",
|
|
||||||
"format": "prettier . --write",
|
"format": "prettier . --write",
|
||||||
"format:check": "prettier . --check",
|
"format:check": "prettier . --check",
|
||||||
"lint": "eslint --report-unused-disable-directives --ext .js,.jsx ./src/"
|
"lint": "eslint --report-unused-disable-directives --ext .js,.jsx ./src/"
|
||||||
|
@ -30,6 +29,7 @@
|
||||||
"stacktrace-js": "^2.0.2"
|
"stacktrace-js": "^2.0.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@vitejs/plugin-react": "^4.0.0",
|
||||||
"eslint": "^8.41.0",
|
"eslint": "^8.41.0",
|
||||||
"eslint-config-airbnb": "^19.0.4",
|
"eslint-config-airbnb": "^19.0.4",
|
||||||
"eslint-config-prettier": "^8.8.0",
|
"eslint-config-prettier": "^8.8.0",
|
||||||
|
@ -38,7 +38,7 @@
|
||||||
"eslint-plugin-react": "^7.32.2",
|
"eslint-plugin-react": "^7.32.2",
|
||||||
"eslint-plugin-react-hooks": "^4.6.0",
|
"eslint-plugin-react-hooks": "^4.6.0",
|
||||||
"prettier": "^2.8.8",
|
"prettier": "^2.8.8",
|
||||||
"react-scripts": "^5.0.0"
|
"vite": "^4.3.8"
|
||||||
},
|
},
|
||||||
"browserslist": {
|
"browserslist": {
|
||||||
"production": [
|
"production": [
|
||||||
|
|
14
web/vite.config.js
Normal file
14
web/vite.config.js
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
/* eslint-disable import/no-extraneous-dependencies */
|
||||||
|
import { defineConfig } from "vite";
|
||||||
|
import react from "@vitejs/plugin-react";
|
||||||
|
|
||||||
|
export default defineConfig(() => ({
|
||||||
|
build: {
|
||||||
|
outDir: "build",
|
||||||
|
assetsDir: "static/media"
|
||||||
|
},
|
||||||
|
server: {
|
||||||
|
port: 3000,
|
||||||
|
},
|
||||||
|
plugins: [react()],
|
||||||
|
}));
|
Loading…
Reference in a new issue