Skip to content

Commit d3ae768

Browse files
authored
Merge pull request #67 from Edirom/47-bug-drawing-measures-not-possible
47 bug drawing measures not possible
2 parents d1e0bfe + dfa128e commit d3ae768

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+1425
-617
lines changed

.dockerignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,6 @@ pnpm-debug.log*
2525

2626
#Electron-builder output
2727
dist_electron
28+
/docs/.vuepress/.temp
29+
/docs/.vuepress/.cache
30+
/docs/.vuepress/dist

.gitignore

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,13 @@ pnpm-debug.log*
2323
*.sw?
2424

2525
# VuePress default directories
26-
docs/.vuepress/.temp
27-
docs/.vuepress/.cache
28-
docs/.vuepress/dist
26+
/docs/.vuepress/.temp
27+
/docs/.vuepress/.cache
28+
/docs/.vuepress/dist
2929

3030
#Electron-builder output
3131
/dist_electron
3232
.env
33+
34+
# Ignore processed config files
35+
docs/.vuepress/config.js.*

40-create-ghcred.sh

Lines changed: 34 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,40 @@
11
#!/bin/sh
2+
set -e
23

3-
# Set default value for VUE_APP_PUBLIC_PATH if not provided
4-
# Remove leading and trailing whitespace and slashes from VUE_APP_PUBLIC_PATH
5-
VUE_APP_PUBLIC_PATH=$(echo $VUE_APP_PUBLIC_PATH | sed 's/^\s*\///;s/\/\s*$//')
4+
# Accept empty = root
5+
VUE_APP_PUBLIC_PATH="${VUE_APP_PUBLIC_PATH:-}"
66

7-
# Add leading slash only if string is not empty
8-
if [ "$VUE_APP_PUBLIC_PATH" != "/" ] && [ "$VUE_APP_PUBLIC_PATH" != "" ]; then
9-
VUE_APP_PUBLIC_PATH="/$VUE_APP_PUBLIC_PATH"
7+
# Normalize: allow "", "/" (root) or "/subpath"
8+
case "$VUE_APP_PUBLIC_PATH" in
9+
""|"/") NORMALIZED_PATH="/" ;; # empty or "/" means root
10+
/*) NORMALIZED_PATH="${VUE_APP_PUBLIC_PATH%/}" ;; # already starts with / but strip off trailing /
11+
*) NORMALIZED_PATH="/${VUE_APP_PUBLIC_PATH%/}" ;; # prepend / and strip off trailing /
12+
esac
13+
14+
15+
echo "Using VUE_APP_PUBLIC_PATH='${VUE_APP_PUBLIC_PATH}' (normalized='${NORMALIZED_PATH}')"
16+
17+
# Create symlink for subpath so /demo works by pointing to /
18+
if [ "$NORMALIZED_PATH" != "/" ]; then
19+
# create parent directories if needed for subsubpaths like /foo/bar/buz
20+
mkdir -p /usr/share/nginx/html`dirname $NORMALIZED_PATH`
21+
ln -snf /usr/share/nginx/html "/usr/share/nginx/html$NORMALIZED_PATH"
1022
fi
1123

12-
# Link the Vue.js app to the public path
13-
ln -s /usr/share/nginx/html /usr/share/nginx/html/"$VUE_APP_PUBLIC_PATH"
14-
sed -i "s+/myAppPlaceholder+$VUE_APP_PUBLIC_PATH+g" /usr/share/nginx/html/index.html
15-
sed -i "s+/myAppPlaceholder+$VUE_APP_PUBLIC_PATH+g" /usr/share/nginx/html/js/app.*.js
16-
17-
# Create NGINX configuration from environment variables
18-
# The @ character is used to prevent envsubst from interpreting NGINX variables
19-
cat <<EOT | envsubst | tr '@' '$' >/GH_OAUTH_CLIENT.conf
20-
# Handle CLIENT_ID, CLIENT_SECRET, and CALL_BACK - they can be empty
21-
set @CLIENT_ID "${CLIENT_ID:-}";
22-
set @CLIENT_SECRET "${CLIENT_SECRET:-}";
23-
set @CALL_BACK "${CALL_BACK:-}";
24+
cat > /GH_OAUTH_CLIENT.conf <<EOT
25+
set \$PUBLIC_PATH $NORMALIZED_PATH;
2426
EOT
27+
28+
# ---- Replace placeholders in built files ----
29+
PLACEHOLDER="/myAppPlaceholder" # ensures single trailing slash
30+
31+
find /usr/share/nginx/html \
32+
-type f \( -name "*.html" -o -name "*.js" -o -name "*.css" \) -print0 \
33+
| while IFS= read -r -d '' f; do
34+
sed -i "s|${PLACEHOLDER}/|${NORMALIZED_PATH%/}/|g" "$f" # %/ removes trailing slash for correct replacement
35+
sed -i "s|${PLACEHOLDER}|${NORMALIZED_PATH}|g" "$f"
36+
done
37+
38+
# replace myAppPlaceholder in nginx configuration
39+
sed -i "s|${PLACEHOLDER}/|${NORMALIZED_PATH%/}/|g" /etc/nginx/nginx.conf # %/ removes trailing slash for correct replacement
40+
sed -i "s|${PLACEHOLDER}|${NORMALIZED_PATH}|g" /etc/nginx/nginx.conf

Dockerfile

Lines changed: 35 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,41 @@
1-
FROM node:latest as builder
1+
# ---- 1) Base build stage ----
2+
FROM node:20-alpine AS base
3+
WORKDIR /app
24

3-
WORKDIR /usr/app
5+
# Install deps first (cache-friendly)
6+
COPY package.json package-lock.json* ./
7+
RUN if [ -f package-lock.json ]; then \
8+
npm ci --legacy-peer-deps; \
9+
else \
10+
npm install --legacy-peer-deps; \
11+
fi
12+
13+
# Bring in the full source (SPA + docs)
414
COPY . .
5-
# RUN echo "VUE_APP_CLIENT_ID=$CLIENT_ID" >.env.development.local
6-
# RUN echo "VUE_APP_CLIENT_SECRET=$CLIENT_SECRET" >.env.development.local
7-
# RUN echo "VUE_APP_CALL_BACK=$CALL_BACK" >.env.development.local
8-
RUN npm install --legacy-peer-deps --force && npm run build
915

16+
# ---- 2) Build frontend (SPA) ----
17+
FROM base AS build-app
18+
RUN npm run build
19+
20+
# ---- 3) Build VuePress docs ----
21+
FROM base AS build-docs
22+
RUN npm run docs:build
1023

24+
# ---- 4) Runtime: Nginx ----
1125
FROM nginx:alpine
26+
27+
# Default public path; can be overridden at runtime
1228
ENV VUE_APP_PUBLIC_PATH="/"
13-
WORKDIR /etc/nginx
14-
COPY 40-create-ghcred.sh /docker-entrypoint.d
15-
COPY ngnix.conf /etc/nginx/conf.d/default.conf
16-
COPY --from=builder /usr/app/dist/ /usr/share/nginx/html
29+
30+
# Copy final single-file nginx.conf
31+
COPY nginx.conf /etc/nginx/nginx.conf
32+
33+
# Add startup script to inject runtime config and symlink
34+
COPY 40-create-ghcred.sh /docker-entrypoint.d/40-create-ghcred.sh
35+
RUN chmod +x /docker-entrypoint.d/40-create-ghcred.sh
36+
37+
# Copy built files into container
38+
COPY --from=build-app /app/dist/ /usr/share/nginx/html/
39+
COPY --from=build-docs /app/docs/.vuepress/dist/ /usr/share/nginx/html/docs/
40+
41+
EXPOSE 80

Dockerfile.web

Lines changed: 0 additions & 8 deletions
This file was deleted.

README.md

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -48,23 +48,20 @@ npm run test:lint
4848
### Customize configuration
4949
See [Configuration Reference](https://cli.vuejs.org/config/).
5050

51-
52-
### Deploying to a subdirectory
53-
In compile stage
51+
### Biuld your image
52+
Replace **`cartographer`** with your preferred image name.
5453
```
55-
docker build \
56-
dockercontainer
54+
docker build -t cartographer .
55+
5756
```
5857

5958
### Run
59+
60+
Replace **demo** with your desired subpath.
61+
62+
Replace **cartographer** with the image name you used when building.
6063
```
61-
docker run \
62-
-e CLIENT_ID="your client id" \
63-
-e CLIENT_SECRET= "your client secret"\
64-
-e CALL_BACK= "your call back" \
65-
-e VUE_APP_CALL_BACK=$CALL_BACK \
66-
-e VUE_APP_PUBLIC_PATH="your subpath"
67-
dockercontainer
64+
docker run --rm -p 8080:80 -e VUE_APP_PUBLIC_PATH=/demo cartographer
6865
```
6966

7067

docker-compose.yml

Lines changed: 0 additions & 21 deletions
This file was deleted.

docker-nginx.conf/docker-nginx.conf

Lines changed: 0 additions & 42 deletions
This file was deleted.

docker-nginx.conf/docker-nginx4.conf

Lines changed: 0 additions & 19 deletions
This file was deleted.

docs/.vuepress/config.js

Lines changed: 78 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,91 @@
1-
import { defineUserConfig } from 'vuepress'
2-
import { viteBundler } from '@vuepress/bundler-vite'
3-
import { defaultTheme } from '@vuepress/theme-default'
1+
import { defineUserConfig } from "vuepress";
2+
import { viteBundler } from "@vuepress/bundler-vite";
3+
import { defaultTheme } from "@vuepress/theme-default";
44

5-
export default defineUserConfig({
6-
bundler: viteBundler(),
7-
8-
theme: defaultTheme({
9-
sidebar: [
5+
// Sidebar configuration
6+
const EN_SIDEBAR = [
7+
{
8+
text: "User Documentation",
9+
collapsible: true,
10+
link: "/user/",
11+
children: [
12+
"/user/introduction.md",
13+
"/user/installation.md",
14+
"/user/UserInterface.md",
15+
"/user/actions.md",
16+
"/user/workflow.md"
17+
]
18+
},
19+
{
20+
text: "Technical Documentation",
21+
collapsible: true,
22+
link: "/technical/README.md",
23+
children: [
1024
{
11-
text: 'Components',
25+
text: "Components",
1226
collapsible: true,
13-
link: '/README.md',
1427
children: [
15-
'/AppFooterComponent.md',
16-
'/AppHeaderComponent.md',
17-
'/AppSidebarComponent.md',
18-
'/ContentPreviewMdiv.md',
19-
'/ContentPreviewMeasure.md',
20-
'/ContentPreviewPane.md',
21-
'/ImageSelectionModal.md',
22-
'/LoadGitModal.md',
23-
'/LoadIIIFModal.md',
24-
'/LoadXMLModal.md',
25-
'/MainMenu.md',
26-
'/MeasureModal.md',
27-
'/MdivModal.md',
28-
'/OsdComponent.md',
29-
'/PageImportModal.md',
30-
'/PagesListEntry.md',
31-
'/PagesModal.md',
32-
],
28+
"/technical/AppFooterComponent.md",
29+
"/technical/AppHeaderComponent.md",
30+
"/technical/AppSidebarComponent.md",
31+
"/technical/ContentPreviewMdiv.md",
32+
"/technical/ContentPreviewMeasure.md",
33+
"/technical/ContentPreviewPane.md",
34+
"/technical/ImageSelectionModal.md",
35+
"/technical/LoadGitModal.md",
36+
"/technical/LoadIIIFModal.md",
37+
"/technical/LoadXMLModal.md",
38+
"/technical/MainMenu.md",
39+
"/technical/MeasureModal.md",
40+
"/technical/MdivModal.md",
41+
"/technical/OsdComponent.md",
42+
"/technical/PageImportModal.md",
43+
"/technical/PagesListEntry.md",
44+
"/technical/PagesModal.md"
45+
]
3346
},
3447
{
35-
text: 'Store',
48+
text: "Store",
3649
collapsible: true,
37-
link: '/store.md',
38-
children: [
39-
'/storeIndex.md',
40-
],
50+
link: "/technical/store.md",
51+
children: ["/technical/storeIndex.md"]
4152
},
42-
{
43-
text: 'Tools',
53+
{
54+
text: "Tools",
4455
collapsible: true,
45-
link: '/tools.md',
56+
link: "/technical/tools.md",
4657
children: [
47-
'/iiif.md',
48-
'/meimapping.md',
58+
"/technical/iiif.md",
59+
"/technical/meimapping.md"
60+
]
61+
}
62+
]
63+
}
64+
];
65+
66+
export default defineUserConfig({
67+
base: '/myAppPlaceholder/docs/',
68+
69+
bundler: viteBundler(),
70+
71+
locales: {
72+
'/': {
73+
lang: 'en-US',
74+
title: 'Cartographer User and Technical Documentation',
75+
description: 'User and Technical Documentation',
76+
},
77+
},
78+
79+
theme: defaultTheme({
80+
locales: {
81+
'/': {
82+
navbar: [
83+
{ text: 'Home', link: '/' }, // becomes /docs/ at build time, then replaced dynamically
84+
{ text: 'User Docs', link: '/user/' }, // becomes /docs/user/
85+
{ text: 'Technical Docs', link: '/technical/README.md' },
4986
],
87+
sidebar: EN_SIDEBAR,
5088
},
51-
],
89+
},
5290
}),
53-
})
91+
});

0 commit comments

Comments
 (0)