6 echo >&2 "Usage: $0 [<version>]"
10 REPO_DIR
=$
(cd "$(dirname $0)/../.."; pwd) # Root dir of the git repo working tree
11 TARGET_DIR
="resources/lib/oojs" # Destination relative to the root of the repo
12 NPM_DIR
=$
(mktemp
-d 2>/dev
/null || mktemp
-d -t 'update-oojs') # e.g. /tmp/update-oojs.rI0I5Vir
14 # Prepare working tree
16 git
reset $TARGET_DIR && git checkout
$TARGET_DIR && git fetch origin
&&
17 git checkout
-B upstream-oojs origin
/master ||
exit 1
19 # Fetch upstream version
23 npm
install "oojs@$1" ||
exit 1
25 npm
install oojs ||
exit 1
28 OOJS_VERSION
=$
(node
-e 'console.log(JSON.parse(require("fs").readFileSync("./node_modules/oojs/package.json")).version);')
29 if [ "$OOJS_VERSION" == "" ]
31 echo 'Could not find OOjs version'
36 rsync
--recursive --delete --force .
/node_modules
/oojs
/dist
"$REPO_DIR/$TARGET_DIR" ||
exit 1
38 # Clean up temporary area
42 cd $REPO_DIR ||
exit 1
45 Update OOjs to v$OOJS_VERSION
48 https://git.wikimedia.org/blob/oojs%2Fcore.git/v$OOJS_VERSION/History.md
52 # Stage deletion, modification and creation of files. Then commit.
53 git add
--update $TARGET_DIR && git add
$TARGET_DIR && git commit
-m "$COMMITMSG" ||
exit 1