Should fix sw issue, also always build versioned on master

This commit is contained in:
Hamcha 2020-06-18 14:07:10 +02:00
parent 9bd586d89c
commit da9c7ee7a2
Signed by untrusted user: hamcha
GPG key ID: 41467804B19A3315
6 changed files with 16 additions and 11 deletions

View file

@ -33,7 +33,7 @@ steps:
commands:
- yarn build
environment:
SUBPATH: /${DRONE_COMMIT_SHA:0:8}
SUBPATH: /tghandbook/${DRONE_COMMIT_BRANCH/\//_}-${DRONE_COMMIT_SHA:0:8}/dist
when:
event:
- push
@ -48,7 +48,7 @@ steps:
commands:
- yarn build
environment:
SUBPATH: /pr-${DRONE_PULL_REQUEST}
SUBPATH: /tghandbook/pr-${DRONE_PULL_REQUEST}/dist
when:
event:
- pull_request
@ -60,7 +60,7 @@ steps:
commands:
- yarn build
environment:
SUBPATH: /latest
SUBPATH: /tghandbook/latest/dist
when:
event:
- push
@ -84,9 +84,6 @@ steps:
when:
event:
- push
branch:
exclude:
- master
depends_on:
- build_versioned

View file

@ -8,9 +8,7 @@ const entryFiles = Path.join(__dirname, "./index.html");
const options = {
outDir: "./dist",
outFile: "index.html",
publicUrl: process.env.SUBPATH
? "/tghandbook" + process.env.SUBPATH + "/dist"
: "/",
publicUrl: process.env.SUBPATH || "/",
watch: false,
contentHash: false,
scopeHoist: false,

View file

@ -9,6 +9,7 @@
"build": "node ./build.js"
},
"dependencies": {
"@types/node": "^14.0.13",
"@types/service_worker_api": "^0.0.9",
"@typescript-eslint/eslint-plugin": "^3.3.0",
"@typescript-eslint/parser": "^3.3.0",

View file

@ -14,7 +14,7 @@ defaultTabs.forEach((tab) => {
});
if ("serviceWorker" in navigator) {
const x = "sw.js";
const x = process.env.SUBPATH ? `${process.env.SUBPATH}/sw.js` : "sw.js";
navigator.serviceWorker
.register(x)
.then((registration) => {

View file

@ -1,5 +1,9 @@
{
"compilerOptions": {
"target": "ES2020"
"target": "ES2020",
"baseUrl": ".",
"paths": {
"~*": ["./src/*"]
}
}
}

View file

@ -949,6 +949,11 @@
resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee"
integrity sha1-7ihweulOEdK4J7y+UnC86n8+ce4=
"@types/node@^14.0.13":
version "14.0.13"
resolved "https://registry.yarnpkg.com/@types/node/-/node-14.0.13.tgz#ee1128e881b874c371374c1f72201893616417c9"
integrity sha512-rouEWBImiRaSJsVA+ITTFM6ZxibuAlTuNOCyxVbwreu6k6+ujs7DfnU9o+PShFhET78pMBl3eH+AGSI5eOTkPA==
"@types/q@^1.5.1":
version "1.5.4"
resolved "https://registry.yarnpkg.com/@types/q/-/q-1.5.4.tgz#15925414e0ad2cd765bfef58842f7e26a7accb24"