From 9c3c1b760899abb6c1a5ce0832e9c98aabece746 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Tue, 8 Aug 2017 09:42:38 +0100 Subject: [PATCH 1/3] Make webpack exit non-zero on error Pass `--bail` to webpack, so that if we can't find a module, we bail out rather than deploy a broken version to /develop. https://github.com/webpack/webpack/issues/708 is somewhat relevant. --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 2b1d6e82d2..db4935f13a 100644 --- a/package.json +++ b/package.json @@ -31,8 +31,8 @@ "build:res": "node scripts/copy-res.js", "build:modernizr": "modernizr -c .modernizr.json -d src/vector/modernizr.js", "build:compile": "npm run reskindex && babel --source-maps -d lib src", - "build:bundle": "cross-env NODE_ENV=production webpack -p --progress", - "build:bundle:dev": "webpack --optimize-occurence-order --progress", + "build:bundle": "cross-env NODE_ENV=production webpack -p --progress --bail", + "build:bundle:dev": "webpack --optimize-occurence-order --progress --bail", "build:electron": "npm run clean && npm run build && npm run install:electron && build -wml --ia32 --x64", "build": "npm run reskindex && npm run build:res && npm run build:bundle", "build:dev": "npm run reskindex && npm run build:res && npm run build:bundle:dev", From 7b024751d1a9dc2f2737fd7b1e618ee0b8ad650d Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Tue, 8 Aug 2017 09:43:40 +0100 Subject: [PATCH 2/3] fetch-develop-deps: avoid breaking js-sdk do `npm i` in react-sdk *before* symlinking js-sdk, to avoid moving a load of deps from js-sdk to react-sdk and hence breaking the build. --- scripts/fetch-develop.deps.sh | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/scripts/fetch-develop.deps.sh b/scripts/fetch-develop.deps.sh index 4fa1a4a22c..e2d40341a0 100755 --- a/scripts/fetch-develop.deps.sh +++ b/scripts/fetch-develop.deps.sh @@ -49,42 +49,47 @@ function dodep() { [ "$curbranch" != 'develop' ] && clone $org $repo develop } || return $? - ( - cd $repo - echo "$repo set to branch "`git rev-parse --abbrev-ref HEAD` - ) + echo "$repo set to branch "`git -C "$repo" rev-parse --abbrev-ref HEAD` mkdir -p node_modules rm -r "node_modules/$repo" 2>/dev/null || true ln -sv "../$repo" node_modules/ + + ( + cd $repo + npm install + ) } +############################## + echo -en 'travis_fold:start:matrix-js-sdk\r' echo 'Setting up matrix-js-sdk' dodep matrix-org matrix-js-sdk -( - cd node_modules/matrix-js-sdk - npm install -) echo -en 'travis_fold:end:matrix-js-sdk\r' +############################## + echo -en 'travis_fold:start:matrix-react-sdk\r' echo 'Setting up matrix-react-sdk' dodep matrix-org matrix-react-sdk -mkdir -p node_modules/matrix-react-sdk/node_modules +# replace the version of js-sdk that got pulled into react-sdk with a symlink +# to our version. Make sure to do this *after* doing 'npm i' in react-sdk, +# otherwise npm helpfully moves another-json from matrix-js-sdk/node_modules +# into matrix-react-sdk/node_modules. +# +# (note this matches the instructions in the README.) +rm -r node_modules/matrix-react-sdk/node_modules/matrix-js-sdk ln -s ../../matrix-js-sdk node_modules/matrix-react-sdk/node_modules/ -( - cd node_modules/matrix-react-sdk - npm install -) - echo -en 'travis_fold:end:matrix-react-sdk\r' +############################## + # Link the reskindex binary in place: if we used npm link, # npm would do this for us, but we don't because we'd have # to define the npm prefix somewhere so it could put the From c31f66aed51c7f0c0e13252a0bc15602d9d51335 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Tue, 8 Aug 2017 09:47:03 +0100 Subject: [PATCH 3/3] Jenkins.sh: only fetch head of dependency branches --- scripts/jenkins.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/jenkins.sh b/scripts/jenkins.sh index 4f2e940564..7b5b4c8e2e 100755 --- a/scripts/jenkins.sh +++ b/scripts/jenkins.sh @@ -8,8 +8,11 @@ nvm use 6 set -x -# check out corresponding branches of dependencies -`dirname $0`/fetch-develop.deps.sh +# check out corresponding branches of dependencies. +# +# clone the deps with depth 1: we know we will only ever need that one +# commit. +`dirname $0`/fetch-develop.deps.sh --depth 1 npm install