Skip to content
This repository has been archived by the owner on Sep 3, 2022. It is now read-only.

Commit

Permalink
Make live mode work better for compiled typescript. (#1322)
Browse files Browse the repository at this point in the history
Make live mode work better for compiled typescript.
  • Loading branch information
jimmc authored Apr 20, 2017
1 parent ed8bacf commit 7c80dbc
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions containers/datalab/content/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# This script supports a live mode in which a datalab git-clone directory is
# mapped to /devroot in this container. When /devroot exists, this script
# sets things up so that changes are immediately picked up by the noteboook
# server. For files in the static and templates directories, this means the
# developer can just modify the files in their datalab source tree and
# reload the web page to pick up the changes. For typescript
# files that get compiled into javascript, the developer needs to run the
# build script for those files, after which the changes will get noticed by
# the notebook server and it will automatically restart.

USAGE='USAGE:
docker run -it -p "8081:8080" -v "${HOME}:/content" gcr.io/cloud-datalab/datalab:local
Expand Down Expand Up @@ -119,8 +129,12 @@ if [ -d /devroot ]; then
echo "Running notebook server in live mode"
export DATALAB_LIVE_STATIC_DIR=/devroot/sources/web/datalab/static
export DATALAB_LIVE_TEMPLATES_DIR=/devroot/sources/web/datalab/templates
# Make sure we have the latest compiled typescript output
cp -p /devroot/build/web/nb/*.js /datalab/web
# Use our internal node_modules dir
export NODE_PATH="${NODE_PATH}:/datalab/web/node_modules"
# Auto-restart when the developer builds from the typescript files.
echo ${FOREVER_CMD} --watch --watchDirectory /devroot/build/web/nb /devroot/build/web/nb/app.js
${FOREVER_CMD} --watch --watchDirectory /devroot/build/web/nb /devroot/build/web/nb/app.js
else
echo "Open your browser to http://localhost:8081/ to connect to Datalab."
${FOREVER_CMD} /datalab/web/app.js
fi
echo "Open your browser to http://localhost:8081/ to connect to Datalab."
${FOREVER_CMD} /datalab/web/app.js

0 comments on commit 7c80dbc

Please sign in to comment.