diff --git a/src/docsify/devcontainer-feature.json b/src/docsify/devcontainer-feature.json index ae027eb..9a080cb 100644 --- a/src/docsify/devcontainer-feature.json +++ b/src/docsify/devcontainer-feature.json @@ -1,7 +1,7 @@ { "name": "docsify", "id": "docsify", - "version": "0.1.0", + "version": "0.1.1", "description": "Automatically serves ./docs workspace directory via 'docsify serve' in the background.", "options": { "port": { diff --git a/src/docsify/install.sh b/src/docsify/install.sh index f4e65e1..08acb05 100755 --- a/src/docsify/install.sh +++ b/src/docsify/install.sh @@ -6,6 +6,7 @@ DOCSIFY_SERVE_PATH="/usr/local/bin/docsify-serve" DOCS_PATH=${DOCS_PATH:-docs} echo "Activating feature 'docsify-cli'..." + npm install -g docsify-cli # The fallback/default index.html file to use when the documents directory does @@ -14,23 +15,23 @@ DEFAULT_INDEX_HTML=$(cat < - - Fake Site - - - - + + Fake Site + + + + -
- - - +
+ + + EOF @@ -48,11 +49,26 @@ EOF tee "${DOCSIFY_SERVE_PATH}" > /dev/null \ << EOF #!/usr/bin/env sh + +# we need to explicitly "activate" (the current) node here, as otherwise +# devcontainers using our feature and also setting their remoteEnv PATH will +# cause our script to fail when run as the postStartCommand. +. /usr/local/share/nvm/nvm.sh +nvm use node + mkdir -p "${DOCS_PATH}" if [ ! -f "${DOCS_PATH}/index.html" ]; then echo "${DEFAULT_INDEX_HTML}" > "${DOCS_PATH}/index.html" echo "${DEFAULT_README_MD}" > "${DOCS_PATH}/README.md" fi -nohup bash -c "docsify serve -p=${PORT} -P=${LIVERELOAD_PORT} --no-open ./${DOCS_PATH} &" >/tmp/nohup.log 2>&1 + +nohup bash -c "\ + docsify serve \ + -p=${PORT} \ + -P=${LIVERELOAD_PORT} \ + --no-open \ + ${DOCS_PATH} \ + &" >/tmp/nohup-docsify.log 2>&1 EOF + chmod 0755 "${DOCSIFY_SERVE_PATH}" diff --git a/test/docsify/port_5678.sh b/test/docsify/port_5678.sh index c67f582..2a83c17 100755 --- a/test/docsify/port_5678.sh +++ b/test/docsify/port_5678.sh @@ -6,7 +6,7 @@ source dev-container-features-test-lib CMD=$(cat <