rename check script to type-check (yarn check is already a command)
Some checks failed
continuous-integration/drone/push Build is failing
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:
parent
146aee4e44
commit
c6baf9b968
4 changed files with 18 additions and 18 deletions
|
@ -36,10 +36,10 @@ steps:
|
||||||
depends_on:
|
depends_on:
|
||||||
- build-game
|
- build-game
|
||||||
- build-pwa
|
- build-pwa
|
||||||
- name: check
|
- name: type-check
|
||||||
image: node
|
image: node
|
||||||
commands:
|
commands:
|
||||||
- yarn check
|
- yarn type-check
|
||||||
depends_on:
|
depends_on:
|
||||||
- build-game
|
- build-game
|
||||||
- build-pwa
|
- build-pwa
|
||||||
|
@ -53,7 +53,7 @@ steps:
|
||||||
depends_on:
|
depends_on:
|
||||||
- prettier
|
- prettier
|
||||||
- eslint
|
- eslint
|
||||||
- check
|
- type-check
|
||||||
- name: deploy (preview)
|
- name: deploy (preview)
|
||||||
image: dockette/vercel
|
image: dockette/vercel
|
||||||
commands:
|
commands:
|
||||||
|
@ -65,4 +65,4 @@ steps:
|
||||||
depends_on:
|
depends_on:
|
||||||
- prettier
|
- prettier
|
||||||
- eslint
|
- eslint
|
||||||
- check
|
- type-check
|
||||||
|
|
|
@ -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",
|
||||||
|
|
|
@ -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