diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml index f2c578a9..dcb70ab1 100644 --- a/.github/workflows/preview.yml +++ b/.github/workflows/preview.yml @@ -30,7 +30,7 @@ jobs: - name: Build run: | npm install - BASE_URL=/pr-${{ github.event.number }} npm run preview + ./hugo/scripts/build.sh production "/pr-${{github.event.number}}" - name: Upload artifact uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 with: diff --git a/hugo/package.json b/hugo/package.json index a7afe5e4..32197431 100644 --- a/hugo/package.json +++ b/hugo/package.json @@ -18,9 +18,8 @@ "build:worker/sql": "esbuild ./assets/scripts/sql/language-server.ts --bundle --format=iife --outfile=./static/showcase/libs/worker/sqlServerWorker.js", "build:worker/minilogo": "esbuild ../node_modules/langium-minilogo/out/language-server/main-browser.js --bundle --format=iife --outfile=./static/showcase/libs/worker/minilogoServerWorker.js", "build:static": "npm run clean:static && npm run build:worker/statemachine && npm run build:worker/domainmodel && npm run build:worker/sql && npm run build:worker/minilogo && npm run build:worker/arithmetics && npm run build:worker/playground-common && npm run build:worker/playground-langium && npm run build:worker/playground-user && npm run copy:monaco-workers", - "preview": "npm run build:static && cross-env NODE_ENV=production hugo --config ./config.toml -b $BASE_URL -d ../public --gc --minify", - "build": "npm run build:static && cross-env NODE_ENV=production hugo --config ./config.toml -b / -d ../public --gc --minify", - "watch": "npm run build:static && cross-env NODE_ENV=development hugo server --config ./config.toml -D -b localhost:1313 -d ../public --appendPort=false", + "build": "./scripts/build.sh production /", + "watch": "npm run build:static && cross-env NODE_ENV=development hugo server --config ./config.toml -D -b localhost:1313 -d ../public --appendPort=false", "watch:gitpod": "npm run build:static && cross-env NODE_ENV=development hugo server --config ./config.toml -D -b `gp url 1313` -d ../public --appendPort=false" }, "devDependencies": { diff --git a/hugo/scripts/build.sh b/hugo/scripts/build.sh new file mode 100755 index 00000000..b87dbc69 --- /dev/null +++ b/hugo/scripts/build.sh @@ -0,0 +1,3 @@ +#!/bin/bash +cd $(dirname "$0")/.. +npm run build:static && npx cross-env NODE_ENV=${1} hugo --config config.toml -b ${2} -d ../public --gc --minify \ No newline at end of file diff --git a/package.json b/package.json index b23663ba..cb45657c 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,6 @@ "watch": "npm run build --workspace core && concurrently -c gray,blue -k -n hugo,tailwind \"npm run watch --workspace hugo\" \"npm run watch --workspace tailwind\"", "watch:gitpod": "npm run build --workspace core && concurrently -c gray,blue -k -n hugo,tailwind \"npm run watch:gitpod --workspace hugo\" \"npm run watch --workspace tailwind\"", "build": "npm run clean && npm run build --workspace core --workspace=tailwind --workspace=hugo", - "preview": "npm run clean && npm run build --workspace core --workspace=tailwind && npm run preview --workspace hugo", "clean": "shx rm -rf public && npm run clean --workspace core --workspace=tailwind" }, "devDependencies": {