Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to Vite #749

Merged
merged 7 commits into from
May 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@
c87549e71a10bc789eac8036078228f06e515a8e
ca5d736a7169eb6b4b0d849e061d5bf9565dcc53
2e27f58963feb9e4d1c573d4745d07770777fa7d

# Run eslint (https://github.com/binwiederhier/ntfy/pull/748)
f558b4dbe9bb5b9e0e87fada1215de2558353173
8319f1cf26113167fb29fe12edaff5db74caf35f
8 changes: 5 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,7 @@ web-build:
&& rm -rf ../server/site \
&& mv build ../server/site \
&& rm \
../server/site/config.js \
../server/site/asset-manifest.json
../server/site/config.js

web-deps:
cd web && npm install
Expand All @@ -145,6 +144,9 @@ web-format:
web-format-check:
cd web && npm run format:check

web-lint:
cd web && npm run lint

# Main server/client build

cli: cli-deps
Expand Down Expand Up @@ -233,7 +235,7 @@ cli-build-results:

# Test/check targets

check: test web-format-check fmt-check vet lint staticcheck
check: test web-format-check fmt-check vet web-lint lint staticcheck

test: .PHONY
go test $(shell go list ./... | grep -vE 'ntfy/(test|examples|tools)')
Expand Down
2 changes: 1 addition & 1 deletion server/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ func TestServer_StaticSites(t *testing.T) {

rr = request(t, s, "GET", "/mytopic", "", nil)
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)
require.Equal(t, 301, rr.Code)
Expand Down
1 change: 1 addition & 0 deletions web/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
src/app/emojis.js
31 changes: 31 additions & 0 deletions web/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"extends": ["airbnb", "prettier"],
"env": {
"browser": true
},
"globals": {
"config": "readonly"
},
"parserOptions": {
"ecmaVersion": 2023
},
"rules": {
"no-console": "off",
"class-methods-use-this": "off",
"func-style": ["error", "expression"],
"no-restricted-syntax": ["error", "ForInStatement", "LabeledStatement", "WithStatement"],
"no-await-in-loop": "error",
"import/no-cycle": "warn",
"react/prop-types": "off",
"react/destructuring-assignment": "off",
"react/jsx-no-useless-fragment": "off",
"react/jsx-props-no-spreading": "off",
"react/function-component-definition": [
"error",
{
"namedComponents": "arrow-function",
"unnamedComponents": "arrow-function"
}
]
}
}
1 change: 1 addition & 0 deletions web/.prettierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
build/
dist/
public/static/langs/
src/app/emojis.js
11 changes: 6 additions & 5 deletions web/public/index.html → web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<meta name="apple-mobile-web-app-status-bar-style" content="#317f6f" />

<!-- 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. -->
<meta property="og:type" content="website" />
Expand All @@ -26,15 +26,15 @@
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."
/>
<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" />

<!-- Never index -->
<meta name="robots" content="noindex, nofollow" />

<!-- Style overrides & fonts -->
<link rel="stylesheet" href="%PUBLIC_URL%/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/app.css" type="text/css" />
<link rel="stylesheet" href="/static/css/fonts.css" type="text/css" />
</head>
<body>
<noscript>
Expand All @@ -43,6 +43,7 @@
subscribe.
</noscript>
<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>
</html>
Loading