Skip to content

Commit bb3da10

Browse files
committed
Consider public path during release builds
1 parent bb612a3 commit bb3da10

File tree

3 files changed

+42
-15
lines changed

3 files changed

+42
-15
lines changed

.github/workflows/release.yml

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,6 @@ jobs:
5454
- name: Check formatting
5555
run: npm run format-check
5656

57-
- name: Build project
58-
run: npm run build
59-
6057
- name: Install jq
6158
run: sudo apt-get update && sudo apt-get install -y jq
6259

@@ -68,6 +65,21 @@ jobs:
6865
run: |
6966
echo "Version: '${{ steps.version.outputs.version }}'"
7067
68+
- name: Build project for Current Dir
69+
run: npm run build --qPublicBasePath=app/current/excel
70+
71+
- name: Release to current dir
72+
run: |
73+
# Update current
74+
rm -rf "docs/app/current/excel"
75+
mkdir -p "docs/app/current/excel"
76+
cp -r dist/spa/* "docs/app/current/excel/"
77+
78+
- name: Build project for Version Dir
79+
run: |
80+
VERSION=${{ steps.version.outputs.version }}
81+
npm run build --qPublicBasePath=app/$VERSION/excel
82+
7183
- name: Release to version dir
7284
run: |
7385
VERSION=${{ steps.version.outputs.version }}
@@ -79,13 +91,6 @@ jobs:
7991
# Copy dist/spa to docs/app/version/excel
8092
cp -r dist/spa/* "docs/app/$VERSION/excel/"
8193
82-
- name: Release to current dir
83-
run: |
84-
# Update current
85-
rm -rf "docs/app/current/excel"
86-
mkdir -p "docs/app/current/excel"
87-
cp -r dist/spa/* "docs/app/current/excel/"
88-
8994
- name: Commit and push changes
9095
env:
9196
PUSH_BRANCH: ${{ github.event.workflow_run.head_branch || github.ref_name }}

CNAME

Lines changed: 0 additions & 1 deletion
This file was deleted.

quasar.config.ts

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,37 @@
22
// https://v2.quasar.dev/quasar-cli-vite/quasar-config-file
33

44
import { defineConfig } from "#q-app/wrappers";
5+
import { isNullOrWhitespace } from "src/util/string_util";
56
import packageSpec from "./package.json";
67

78
// import checker from "vite-plugin-checker";
89
// import vueDevTools from "vite-plugin-vue-devtools";
910

10-
const FLAG_ENABLE_VUE_DEV_TOOLS: boolean = false;
11+
const FLAG_ENABLE_VUE_DEV_TOOLS: boolean = false as const;
1112

12-
const PUBLIC_BASE_PATH: string = "/";
13+
function resolvePublicBasePath(): string {
14+
let p = process.env.Q_PUBLIC_BASE_PATH;
15+
16+
if (isNullOrWhitespace(p)) {
17+
// npm exposes `npm_config_*` env vars for `npm run build -- --publicPath=/foo`
18+
p = process.env.npm_config_qpublicbasepath;
19+
}
20+
21+
if (isNullOrWhitespace(p)) {
22+
p = "/";
23+
}
24+
25+
// Ensure we always have a leading slash for Vite's base path resolution
26+
p = p && p.startsWith("/") ? p : `/${p}`;
27+
28+
if (p !== "/") {
29+
console.log(`Q_PUBLIC_BASE_PATH is '${p}'`);
30+
}
31+
32+
return p;
33+
}
34+
35+
const Q_PUBLIC_BASE_PATH: string = resolvePublicBasePath();
1336

1437
export default defineConfig((ctx) => {
1538
console.log("\nquasar.config.ts: defineConfig(..): QuasarContext >>", ctx, "<< QuasarContext");
@@ -70,7 +93,7 @@ export default defineConfig((ctx) => {
7093

7194
// rebuildCache: true, // rebuilds Vite/linter/etc cache on startup
7295

73-
publicPath: PUBLIC_BASE_PATH,
96+
publicPath: Q_PUBLIC_BASE_PATH,
7497
// analyze: true,
7598
env: {
7699
PACKAGE_NAME: packageSpec.name,
@@ -201,7 +224,7 @@ export default defineConfig((ctx) => {
201224
// manifestFilename: 'manifest.json',
202225
extendManifestJson(json: unknown) {
203226
(json as Record<string, string>).short_name = packageSpec.productName;
204-
(json as Record<string, string>).start_url = PUBLIC_BASE_PATH;
227+
(json as Record<string, string>).start_url = Q_PUBLIC_BASE_PATH;
205228
},
206229
// useCredentialsForManifestTag: true,
207230
// injectPwaMetaTags: false,

0 commit comments

Comments
 (0)