浏览代码

Add git hooks to update the server extension on checkout/merge

This is similar to the Jupyter notebook repo.

Fixes #2
Jason Grout 8 年之前
父节点
当前提交
dabdb2a96c
共有 4 个文件被更改,包括 26 次插入0 次删除
  1. 9 0
      git-hooks/README.md
  2. 9 0
      git-hooks/install-hooks.sh
  3. 4 0
      git-hooks/post-checkout
  4. 4 0
      git-hooks/post-merge

+ 9 - 0
git-hooks/README.md

@@ -0,0 +1,9 @@
+# Git hooks for JupyterLab
+
+add these to your `.git/hooks`
+
+For now, we just have `post-checkout` and `post-merge`,
+both of which attempt to rebuild the server extension,
+so make sure that you have a fully synced repo whenever you checkout or pull.
+
+To use these hooks, run `./install-hooks.sh`.

+ 9 - 0
git-hooks/install-hooks.sh

@@ -0,0 +1,9 @@
+#!/usr/bin/env bash
+
+DOTGIT=`git rev-parse --git-dir`
+TOPLEVEL=`git rev-parse --show-toplevel`
+TO=${DOTGIT}/hooks
+FROM=${TOPLEVEL}/git-hooks
+
+ln -s ${FROM}/post-checkout ${TO}/post-checkout
+ln -s ${FROM}/post-merge ${TO}/post-merge

+ 4 - 0
git-hooks/post-checkout

@@ -0,0 +1,4 @@
+#!/bin/bash
+
+echo "rebuilding extension"
+(npm install && npm run build:serverextension) || echo "fail to rebuild javascript"

+ 4 - 0
git-hooks/post-merge

@@ -0,0 +1,4 @@
+#!/bin/bash
+
+echo "rebuilding extension"
+(npm install && npm run build:serverextension) || echo "fail to rebuild javascript"