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

View File

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

View File

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

View File

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

View File

@ -1,5 +1,9 @@
{ {
"compilerOptions": { "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" resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee"
integrity sha1-7ihweulOEdK4J7y+UnC86n8+ce4= 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": "@types/q@^1.5.1":
version "1.5.4" version "1.5.4"
resolved "https://registry.yarnpkg.com/@types/q/-/q-1.5.4.tgz#15925414e0ad2cd765bfef58842f7e26a7accb24" resolved "https://registry.yarnpkg.com/@types/q/-/q-1.5.4.tgz#15925414e0ad2cd765bfef58842f7e26a7accb24"