From 93f1b8ffe9a1d220f89967b091d1904b9fd3c41b Mon Sep 17 00:00:00 2001 From: Hamcha Date: Wed, 17 Jun 2020 15:48:05 +0200 Subject: [PATCH] Add signature and fix paths --- .drone.yml | 9 +++++++++ build.js | 24 ++++++++++++++++++++++++ package.json | 2 +- 3 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 build.js diff --git a/.drone.yml b/.drone.yml index 55a6d0a..7386dcf 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,3 +1,4 @@ +--- kind: pipeline name: default @@ -31,6 +32,8 @@ steps: image: node commands: - yarn build + environment: + SUBPATH: /${DRONE_COMMIT_SHA:0:8} when: event: - push @@ -44,6 +47,8 @@ steps: image: node commands: - yarn build + environment: + SUBPATH: /pr-${DRONE_PULL_REQUEST} when: event: - pull_request @@ -140,3 +145,7 @@ volumes: - name: cache host: path: /opt/gitea/drone-cache/hamcha/tghandbook + +--- +kind: signature +hmac: fade536706bcf207d4cf35663c985e3f457b957b743519f19fbb696549cf07f3 diff --git a/build.js b/build.js new file mode 100644 index 0000000..592b1c4 --- /dev/null +++ b/build.js @@ -0,0 +1,24 @@ +/* eslint-disable */ +const Bundler = require("parcel-bundler"); +const Path = require("path"); + +const entryFiles = Path.join(__dirname, "./index.html"); + +// Bundler options +const options = { + outDir: "./dist", + outFile: "index.html", + publicUrl: process.env.SUBPATH, + watch: false, + contentHash: false, + scopeHoist: false, + target: "browser", + logLevel: 3, // 5 = save everything to a file, 4 = like 3, but with timestamps and additionally log http requests to dev server, 3 = log info, warnings & errors, 2 = log warnings & errors, 1 = log errors, 0 = log nothing + sourceMaps: true, // Enable or disable sourcemaps, defaults to enabled (minified builds currently always create sourcemaps) + autoInstall: true, // Enable or disable auto install of missing dependencies found during bundling +}; + +(async () => { + const bundler = new Bundler(entryFiles, options); + await bundler.bundle(); +})(); diff --git a/package.json b/package.json index 990e1c4..35124f6 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "scripts": { "dev": "parcel index.html", "lint": "eslint lib", - "build": "parcel build index.html" + "build": "node ./build.js" }, "dependencies": { "@typescript-eslint/eslint-plugin": "^3.3.0",