Merge branch 'drone-ci'
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
commit
61b9c8d66d
8 changed files with 98 additions and 21 deletions
81
.drone.yml
Normal file
81
.drone.yml
Normal file
|
@ -0,0 +1,81 @@
|
||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
|
||||||
|
workspace:
|
||||||
|
path: /drone/svelte-sharg
|
||||||
|
|
||||||
|
# Check if the game builds
|
||||||
|
# If yes, test if everything is nice
|
||||||
|
# If yes, deploy to vercel
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: install
|
||||||
|
image: node
|
||||||
|
commands:
|
||||||
|
- yarn
|
||||||
|
- name: build-game
|
||||||
|
image: node
|
||||||
|
commands:
|
||||||
|
- yarn build:game
|
||||||
|
depends_on:
|
||||||
|
- install
|
||||||
|
- name: build-pwa
|
||||||
|
image: node
|
||||||
|
commands:
|
||||||
|
- yarn build:pwa
|
||||||
|
depends_on:
|
||||||
|
- install
|
||||||
|
- name: prettier
|
||||||
|
image: node
|
||||||
|
commands:
|
||||||
|
- yarn lint:prettier:all
|
||||||
|
depends_on:
|
||||||
|
- build-game
|
||||||
|
- build-pwa
|
||||||
|
- name: eslint
|
||||||
|
image: node
|
||||||
|
commands:
|
||||||
|
- yarn lint:eslint --max-warnings=0
|
||||||
|
depends_on:
|
||||||
|
- build-game
|
||||||
|
- build-pwa
|
||||||
|
- name: type-check
|
||||||
|
image: node
|
||||||
|
commands:
|
||||||
|
- yarn type-check
|
||||||
|
depends_on:
|
||||||
|
- build-game
|
||||||
|
- build-pwa
|
||||||
|
- name: deploy (production)
|
||||||
|
image: dockette/vercel
|
||||||
|
environment:
|
||||||
|
VERCEL_TOKEN:
|
||||||
|
from_secret: VERCEL_TOKEN
|
||||||
|
VERCEL_SCOPE:
|
||||||
|
from_secret: VERCEL_SCOPE
|
||||||
|
commands:
|
||||||
|
- vercel -t $VERCEL_TOKEN --scope $VERCEL_SCOPE -c
|
||||||
|
when:
|
||||||
|
branch:
|
||||||
|
- main
|
||||||
|
depends_on:
|
||||||
|
- prettier
|
||||||
|
- eslint
|
||||||
|
- type-check
|
||||||
|
- name: deploy (preview)
|
||||||
|
image: dockette/vercel
|
||||||
|
environment:
|
||||||
|
VERCEL_TOKEN:
|
||||||
|
from_secret: VERCEL_TOKEN
|
||||||
|
VERCEL_SCOPE:
|
||||||
|
from_secret: VERCEL_SCOPE
|
||||||
|
commands:
|
||||||
|
- vercel -t $VERCEL_TOKEN --scope $VERCEL_SCOPE -c
|
||||||
|
when:
|
||||||
|
branch:
|
||||||
|
exclude:
|
||||||
|
- main
|
||||||
|
depends_on:
|
||||||
|
- prettier
|
||||||
|
- eslint
|
||||||
|
- type-check
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,3 +1,4 @@
|
||||||
/node_modules/
|
/node_modules/
|
||||||
/public/build/
|
/public/build/
|
||||||
/public/service-worker.js
|
/public/service-worker.js
|
||||||
|
.vercel
|
||||||
|
|
|
@ -13,9 +13,9 @@
|
||||||
"dev:pwa": "yarn build:pwa -w",
|
"dev:pwa": "yarn build:pwa -w",
|
||||||
"start": "sirv public --no-clear",
|
"start": "sirv public --no-clear",
|
||||||
"preview": "yarn build && yarn start",
|
"preview": "yarn build && yarn start",
|
||||||
"check": "yarn check:game && yarn check:pwa",
|
"type-check": "yarn type-check:game && yarn type-check:pwa",
|
||||||
"check:game": "svelte-check --tsconfig ./tsconfig.json",
|
"type-check:game": "svelte-check --tsconfig ./tsconfig.json",
|
||||||
"check:pwa": "svelte-check --tsconfig ./src/pwa/tsconfig.json",
|
"type-check:pwa": "svelte-check --tsconfig ./src/pwa/tsconfig.json",
|
||||||
"lint": "yarn lint:prettier && yarn lint:eslint",
|
"lint": "yarn lint:prettier && yarn lint:eslint",
|
||||||
"lint:prettier": "pretty-quick --ignore-path .gitignore --check --plugin-search-dir=. .",
|
"lint:prettier": "pretty-quick --ignore-path .gitignore --check --plugin-search-dir=. .",
|
||||||
"lint:prettier:all": "prettier --ignore-path .gitignore --check --plugin-search-dir=. .",
|
"lint:prettier:all": "prettier --ignore-path .gitignore --check --plugin-search-dir=. .",
|
||||||
|
@ -24,7 +24,7 @@
|
||||||
"fix:prettier": "pretty-quick --ignore-path .gitignore --write --plugin-search-dir=. .",
|
"fix:prettier": "pretty-quick --ignore-path .gitignore --write --plugin-search-dir=. .",
|
||||||
"fix:prettier:all": "prettier --ignore-path .gitignore --write --plugin-search-dir=. .",
|
"fix:prettier:all": "prettier --ignore-path .gitignore --write --plugin-search-dir=. .",
|
||||||
"fix:eslint": "eslint --fix --ignore-path .gitignore ./src/",
|
"fix:eslint": "eslint --fix --ignore-path .gitignore ./src/",
|
||||||
"test": "yarn lint:prettier:all && yarn lint:eslint --max-warnings=0 && yarn check"
|
"test": "yarn lint:prettier:all && yarn lint:eslint --max-warnings=0 && yarn type-check"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@rollup/plugin-node-resolve": "^13.0.5",
|
"@rollup/plugin-node-resolve": "^13.0.5",
|
||||||
|
|
|
@ -53,4 +53,4 @@
|
||||||
"display": "standalone",
|
"display": "standalone",
|
||||||
"background_color": "#536892",
|
"background_color": "#536892",
|
||||||
"theme_color": "#2e4372"
|
"theme_color": "#2e4372"
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,10 +10,7 @@ export default {
|
||||||
preferConst: true,
|
preferConst: true,
|
||||||
strict: true,
|
strict: true,
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [typescript({ tsconfig: "src/pwa/tsconfig.json" }), production && terser({ output: { comments: false } })],
|
||||||
typescript({ sourceMap: false, include: "**/service-worker.ts", lib: ["WebWorker"] }),
|
|
||||||
production && terser({ output: { comments: false } }),
|
|
||||||
],
|
|
||||||
watch: {
|
watch: {
|
||||||
clearScreen: false,
|
clearScreen: false,
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
<svelte:options immutable />
|
<svelte:options immutable />
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { fade } from "svelte/transition";
|
|
||||||
|
|
||||||
import type { Resource } from "../../shark/data/Resources";
|
import type { Resource } from "../../shark/data/Resources";
|
||||||
|
|
||||||
export let categoryName: string;
|
export let categoryName: string;
|
||||||
|
|
|
@ -5,7 +5,7 @@ const STATIC_CACHE_NAME = CACHE_NAME + "-" + CACHE_VERSION;
|
||||||
const INITIAL_FILES_TO_CACHE = ["/", "/index.html", "/build/bundle.js", "/build/bundle.css", "/favicon.png"];
|
const INITIAL_FILES_TO_CACHE = ["/", "/index.html", "/build/bundle.js", "/build/bundle.css", "/favicon.png"];
|
||||||
const CACHE_DENYLIST = ["/manifest.json", "/service-worker.js", "livereload.js"];
|
const CACHE_DENYLIST = ["/manifest.json", "/service-worker.js", "livereload.js"];
|
||||||
|
|
||||||
const globalScope = self as WorkerGlobalScope as ServiceWorkerGlobalScope;
|
const globalScope = self as unknown /* as WorkerGlobalScope */ as ServiceWorkerGlobalScope;
|
||||||
|
|
||||||
globalScope.addEventListener("install", (event) => {
|
globalScope.addEventListener("install", (event) => {
|
||||||
console.debug("[ServiceWorker] Install");
|
console.debug("[ServiceWorker] Install");
|
||||||
|
@ -41,13 +41,12 @@ globalScope.addEventListener("fetch", (event) => {
|
||||||
const path = new URL(event.request.url).pathname;
|
const path = new URL(event.request.url).pathname;
|
||||||
console.debug("[ServiceWorker] Fetch", event.request.url, "==", path);
|
console.debug("[ServiceWorker] Fetch", event.request.url, "==", path);
|
||||||
|
|
||||||
function getFromFetch(cache: Cache) {
|
async function getFromFetch(cache: Cache) {
|
||||||
return fetch(event.request).then((response) => {
|
const response = await fetch(event.request);
|
||||||
if (!CACHE_DENYLIST.includes(path)) {
|
if (!CACHE_DENYLIST.includes(path)) {
|
||||||
cache.put(path, response.clone());
|
cache.put(path, response.clone());
|
||||||
}
|
}
|
||||||
return response;
|
return response;
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getFromCache() {
|
async function getFromCache() {
|
||||||
|
|
|
@ -2,9 +2,10 @@
|
||||||
"extends": "@tsconfig/svelte/tsconfig.json",
|
"extends": "@tsconfig/svelte/tsconfig.json",
|
||||||
"target": "es2021",
|
"target": "es2021",
|
||||||
"include": ["src/**/*"],
|
"include": ["src/**/*"],
|
||||||
"exclude": ["src/service-worker.ts"],
|
"exclude": ["src/pwa/**"],
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"isolatedModules": false
|
"isolatedModules": false,
|
||||||
|
"useDefineForClassFields": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue