From 7a197eb7471925b20862ed0748a896f2767ee0bf Mon Sep 17 00:00:00 2001 From: Ernst Widerberg Date: Mon, 7 Feb 2022 10:25:53 +0100 Subject: Fix `npm run start` to work with window.injectedEnv --- make-inject-env.sh | 6 ++++++ package.json | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100755 make-inject-env.sh diff --git a/make-inject-env.sh b/make-inject-env.sh new file mode 100755 index 0000000..b403705 --- /dev/null +++ b/make-inject-env.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +source env.sh +INJECT_FILE_SRC="inject_template.js" +INJECT_FILE_DST="dist/inject.js" +envsubst < "${INJECT_FILE_SRC}" > "${INJECT_FILE_DST}" diff --git a/package.json b/package.json index defb76e..de6e6e0 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "version": "1.0.0", "description": "", "scripts": { - "start": "PER_PAGE=${PER_PAGE:=5} parcel --port 8001 src/index.html", + "start": "PER_PAGE=${PER_PAGE:=5} ./make-inject-env.sh && parcel --port 8001 src/index.html", "build": "PER_PAGE=${PER_PAGE:=5} parcel build src/index.html" }, "browserslist": "defaults", -- cgit v1.1