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"
42 # Clean up temporary area
49 Update OOjs to v$OOJS_VERSION
52 https://git.wikimedia.org/blob/oojs%2Fcore.git/v$OOJS_VERSION/History.md
56 # Stage deletion, modification and creation of files. Then commit.
57 git add
--update $TARGET_DIR
59 git commit
-m "$COMMITMSG"