3 # This script generates a commit that updates our copy of OOjs UI
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-ui" # Destination relative to the root of the repo
14 NPM_DIR
=$
(mktemp
-d 2>/dev
/null || mktemp
-d -t 'update-oojs-ui') # e.g. /tmp/update-oojs-ui.rI0I5Vir
16 # Prepare working tree
18 git
reset $TARGET_DIR && git checkout
$TARGET_DIR && git fetch origin
&&
19 git checkout
-B upstream-oojs-ui origin
/master ||
exit 1
21 # Fetch upstream version
25 npm
install "oojs-ui@$1" ||
exit 1
27 npm
install oojs-ui ||
exit 1
30 OOJSUI_VERSION
=$
(node
-e 'console.log(require("./node_modules/oojs-ui/package.json").version);')
31 if [ "$OOJSUI_VERSION" == "" ]
33 echo 'Could not find OOjs UI version'
37 # Copy files, excluding:
38 # * the Apex theme files,
39 # * the minimised distribution files, and
40 # * the RTL sheets for non-CSSJanus environments
41 rsync
--force --recursive --delete \
43 --exclude 'oojs-ui*.min.*' \
44 --exclude 'oojs-ui*.rtl.css' \
45 .
/node_modules
/oojs-ui
/dist
/ "$REPO_DIR/$TARGET_DIR" ||
exit 1
47 # Clean up temporary area
51 cd $REPO_DIR ||
exit 1
54 Update OOjs UI to v$OOJSUI_VERSION
57 https://git.wikimedia.org/blob/oojs%2Fui.git/v$OOJSUI_VERSION/History.md
61 # Stage deletion, modification and creation of files. Then commit.
62 git add
--update $TARGET_DIR && git add
$TARGET_DIR && git commit
-m "$COMMITMSG" ||
exit 1