3 # This script generates a commit that updates our copy of OOjs
8 echo >&2 "Usage: $0 [<version>]"
12 REPO_DIR=$(cd "$(dirname $0)/../.."; pwd) # Root dir of the git repo working tree
13 TARGET_DIR="resources/lib/oojs" # Destination relative to the root of the repo
14 NPM_DIR=$(mktemp -d 2>/dev/null || mktemp -d -t 'update-oojs') # e.g. /tmp/update-oojs.rI0I5Vir
16 # Prepare working tree
18 git reset -- $TARGET_DIR
19 git checkout -- $TARGET_DIR
21 git checkout -B upstream-oojs origin/master
23 # Fetch upstream version
32 OOJS_VERSION=$(node -e 'console.log(require("./node_modules/oojs/package.json").version);')
33 if [ "$OOJS_VERSION" == "" ]
35 echo 'Could not find OOjs version'
40 rsync --force ./node_modules/oojs/dist/oojs.jquery.js "$REPO_DIR/$TARGET_DIR"
41 rsync --force ./node_modules/oojs/dist/AUTHORS.txt "$REPO_DIR/$TARGET_DIR"
42 rsync --force ./node_modules/oojs/dist/LICENSE-MIT "$REPO_DIR/$TARGET_DIR"
43 rsync --force ./node_modules/oojs/dist/README.md "$REPO_DIR/$TARGET_DIR"
45 # Clean up temporary area
52 Update OOjs to v$OOJS_VERSION
55 https://phabricator.wikimedia.org/diffusion/GOJS/browse/master/History.md;v$OOJS_VERSION
59 # Stage deletion, modification and creation of files. Then commit.
60 git add --update $TARGET_DIR
62 git commit -m "$COMMITMSG"