@@ -6,6 +6,7 @@ DOCSIFY_SERVE_PATH="/usr/local/bin/docsify-serve"
66DOCS_PATH=${DOCS_PATH:- docs}
77
88echo " Activating feature 'docsify-cli'..."
9+
910npm install -g docsify-cli
1011
1112# The fallback/default index.html file to use when the documents directory does
@@ -14,23 +15,23 @@ DEFAULT_INDEX_HTML=$(cat <<EOF
1415<!DOCTYPE html>
1516<html lang="en">
1617<head>
17- <meta charset="UTF-8">
18- <title>Fake Site</title>
19- <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
20- <meta name="description" content="Description">
21- <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0">
22- <link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify@4/lib/themes/vue.css">
18+ <meta charset="UTF-8">
19+ <title>Fake Site</title>
20+ <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
21+ <meta name="description" content="Description">
22+ <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0">
23+ <link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify@4/lib/themes/vue.css">
2324</head>
2425<body>
25- <div id="app"></div>
26- <script>
27- window.$docsify = {
28- name: 'fakesite',
29- repo: 'fakerepo'
30- }
31- </script>
32- <!-- Docsify v4 -->
33- <script src="//cdn.jsdelivr.net/npm/docsify@4"></script>
26+ <div id="app"></div>
27+ <script>
28+ window.$docsify = {
29+ name: 'fakesite',
30+ repo: 'fakerepo'
31+ }
32+ </script>
33+ <!-- Docsify v4 -->
34+ <script src="//cdn.jsdelivr.net/npm/docsify@4"></script>
3435</body>
3536</html>
3637EOF
4849tee " ${DOCSIFY_SERVE_PATH} " > /dev/null \
4950<< EOF
5051#!/usr/bin/env sh
52+
53+ # we need to explicitly "activate" (the current) node here, as otherwise
54+ # devcontainers using our feature and also setting their remoteEnv PATH will
55+ # cause our script to fail when run as the postStartCommand.
56+ . /usr/local/share/nvm/nvm.sh
57+ nvm use node
58+
5159mkdir -p "${DOCS_PATH} "
5260if [ ! -f "${DOCS_PATH} /index.html" ]; then
5361 echo "${DEFAULT_INDEX_HTML} " > "${DOCS_PATH} /index.html"
5462 echo "${DEFAULT_README_MD} " > "${DOCS_PATH} /README.md"
5563fi
56- nohup bash -c "docsify serve -p=${PORT} -P=${LIVERELOAD_PORT} --no-open ./${DOCS_PATH} &" >/tmp/nohup.log 2>&1
64+
65+ nohup bash -c "\
66+ docsify serve \
67+ -p=${PORT} \
68+ -P=${LIVERELOAD_PORT} \
69+ --no-open \
70+ ${DOCS_PATH} \
71+ &" >/tmp/nohup-docsify.log 2>&1
5772EOF
73+
5874chmod 0755 " ${DOCSIFY_SERVE_PATH} "
0 commit comments