rename check script to type-check (yarn check is already a command)
Some checks failed
continuous-integration/drone/push Build is failing

fix tsconfig.json
fix pwa/service-worker.ts (svelte-check doesn't type `self` correctly)
This commit is contained in:
Tobias Berger 2021-10-14 13:09:57 +02:00
parent 146aee4e44
commit c6baf9b968
4 changed files with 18 additions and 18 deletions

View file

@ -36,10 +36,10 @@ steps:
depends_on:
- build-game
- build-pwa
- name: check
- name: type-check
image: node
commands:
- yarn check
- yarn type-check
depends_on:
- build-game
- build-pwa
@ -53,7 +53,7 @@ steps:
depends_on:
- prettier
- eslint
- check
- type-check
- name: deploy (preview)
image: dockette/vercel
commands:
@ -65,4 +65,4 @@ steps:
depends_on:
- prettier
- eslint
- check
- type-check

View file

@ -13,9 +13,9 @@
"dev:pwa": "yarn build:pwa -w",
"start": "sirv public --no-clear",
"preview": "yarn build && yarn start",
"check": "yarn check:game && yarn check:pwa",
"check:game": "svelte-check --tsconfig ./tsconfig.json",
"check:pwa": "svelte-check --tsconfig ./src/pwa/tsconfig.json",
"type-check": "yarn type-check:game && yarn type-check:pwa",
"type-check:game": "svelte-check --tsconfig ./tsconfig.json",
"type-check:pwa": "svelte-check --tsconfig ./src/pwa/tsconfig.json",
"lint": "yarn lint:prettier && yarn lint:eslint",
"lint:prettier": "pretty-quick --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:all": "prettier --ignore-path .gitignore --write --plugin-search-dir=. .",
"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": {
"@rollup/plugin-node-resolve": "^13.0.5",

View file

@ -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 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) => {
console.debug("[ServiceWorker] Install");
@ -41,13 +41,12 @@ globalScope.addEventListener("fetch", (event) => {
const path = new URL(event.request.url).pathname;
console.debug("[ServiceWorker] Fetch", event.request.url, "==", path);
function getFromFetch(cache: Cache) {
return fetch(event.request).then((response) => {
async function getFromFetch(cache: Cache) {
const response = await fetch(event.request);
if (!CACHE_DENYLIST.includes(path)) {
cache.put(path, response.clone());
}
return response;
});
}
async function getFromCache() {

View file

@ -2,9 +2,10 @@
"extends": "@tsconfig/svelte/tsconfig.json",
"target": "es2021",
"include": ["src/**/*"],
"exclude": ["src/service-worker.ts"],
"exclude": ["src/pwa/**"],
"compilerOptions": {
"strict": true,
"isolatedModules": false
"isolatedModules": false,
"useDefineForClassFields": true
}
}