-
Notifications
You must be signed in to change notification settings - Fork 96
Expand file tree
/
Copy pathpreview.sh
More file actions
executable file
·54 lines (44 loc) · 1.17 KB
/
preview.sh
File metadata and controls
executable file
·54 lines (44 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/sh
main() {
trap 'kill -9 0' SIGINT
export _PORT="${_PORT:-60141}"
export DOCKER_IMAGE="${DOCKER_IMAGE:-ghcr.io/pmndrs/docs:latest}"
export MDX="${MDX:-docs}"
export NEXT_PUBLIC_LIBNAME="${NEXT_PUBLIC_LIBNAME:-Poimandres}"
rm -rf "$MDX/out"
# docker build -t $DOCKER_IMAGE .
docker run --rm --init -t \
-v "./$MDX":/app/docs \
-e MDX \
-e NEXT_PUBLIC_LIBNAME \
-e NEXT_PUBLIC_LIBNAME_SHORT \
-e NEXT_PUBLIC_LIBNAME_DOTSUFFIX_LABEL \
-e NEXT_PUBLIC_LIBNAME_DOTSUFFIX_HREF \
-e BASE_PATH \
-e DIST_DIR="$MDX/out$BASE_PATH" \
-e OUTPUT=export \
-e HOME_REDIRECT \
-e MDX_BASEURL=http://localhost:$_PORT \
-e SOURCECODE_BASEURL \
-e EDIT_BASEURL \
-e NEXT_PUBLIC_URL \
-e ICON \
-e LOGO \
-e GITHUB \
-e DISCORD \
-e THEME_PRIMARY \
-e THEME_SCHEME \
-e THEME_CONTRAST \
-e THEME_NOTE \
-e THEME_TIP \
-e THEME_IMPORTANT \
-e THEME_WARNING \
-e THEME_CAUTION \
-e CONTRIBUTORS_PAT \
$DOCKER_IMAGE pnpm run build || exit 1
kill $(lsof -ti:"$_PORT")
npx serve $MDX -p $_PORT --no-port-switching --no-clipboard &
npx -y serve "$MDX/out" &
wait
}
main