Skip to content

Commit

Permalink
PWA, migrate to bun.
Browse files Browse the repository at this point in the history
  • Loading branch information
FS-Frost committed Jun 6, 2024
1 parent 1e53ae1 commit 61ab193
Show file tree
Hide file tree
Showing 7 changed files with 83 additions and 942 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,21 @@ jobs:
- name: Checkout 🛎️
uses: actions/checkout@v2.3.1

- uses: oven-sh/setup-bun@v1
with:
bun-version: latest

- name: Install
run: |
npm install
bun install
- name: Run tests
run: |
npm run-script check
bun run check
- name: Build 🔧
run: |
npm run-script build
bun run build
- name: Change base-tag in index.html from / to dictionary
run: sed -i 's/<base href="\/" \/>/<base href="\/dictionary\/" \/>/g' public/index.html
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Dictionary

Web dictionary for Spanish and English languages.
Web dictionary for Spanish and English languages, installable as [PWA](https://developer.mozilla.org/en-US/docs/Web/Progressive_web_apps).

[https://fs-frost.github.io/dictionary](https://fs-frost.github.io/dictionary)

Expand All @@ -16,8 +16,8 @@ Web dictionary for Spanish and English languages.
## Run locally

```shell
yarn install
yarn run dev
bun install
bun run dev
```

Go to http://localhost:5000.
Binary file added bun.lockb
Binary file not shown.
Binary file modified public/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
99 changes: 58 additions & 41 deletions public/index.html
Original file line number Diff line number Diff line change
@@ -1,44 +1,61 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />

<title>Dictionary</title>

<base href="/" />
<link rel="icon" type="image/png" href="/favicon.png" />
<link rel="stylesheet" href="global.css" />
<link rel="stylesheet" href="build/bundle.css" />
<link
href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css"
rel="stylesheet"
integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC"
crossorigin="anonymous"
/>
<script
src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js"
integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM"
crossorigin="anonymous"
></script>
<script src="js/fork-me-baby.min.js"></script>

<script defer src="build/bundle.js"></script>
</head>

<body>
<script>
forkMeBaby({
position: "top-right",
link: "https://github.com/FS-Frost/dictionary",
sticky: false,

<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />

<title>Dictionary</title>

<base href="/" />
<link rel="icon" type="image/png" href="/favicon.png" />
<link rel="manifest" href="manifest.json" />
<link rel="stylesheet" href="global.css" />
<link rel="stylesheet" href="build/bundle.css" />
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous" />
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js"
integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM"
crossorigin="anonymous"></script>
<script src="js/fork-me-baby.min.js"></script>

<script defer src="build/bundle.js"></script>
</head>

<body>
<script>
forkMeBaby({
position: "top-right",
link: "https://github.com/FS-Frost/dictionary",
sticky: false,
});

if ("serviceWorker" in navigator) {
window.addEventListener("load", function () {
navigator.serviceWorker
.register("worker.js")
.then(
function (registration) {
console.log("Worker registration successful", registration.scope);
},
function (err) {
console.log("Worker registration failed", err);
}
)
.catch(function (err) {
console.log(err);
});
});
</script>

<style>
.fork-me-baby.top-right:before {
border-right-color: #302a7a !important;
}
</style>
</body>
</html>
} else {
console.log("Service Worker is not supported by browser.");
}
</script>

<style>
.fork-me-baby.top-right:before {
border-right-color: #302a7a !important;
}
</style>
</body>

</html>
15 changes: 15 additions & 0 deletions public/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"short_name": "Dictionary",
"name": "Dictionary",
"icons": [
{
"src": "favicon.png",
"sizes": "512x512 192x192 64x64 32x32 24x24 16x16",
"type": "image/png"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#003eb3",
"background_color": "#ffffff"
}
Loading

0 comments on commit 61ab193

Please sign in to comment.