From c43b249258bbd482733b6d314c2c658ab13c34e1 Mon Sep 17 00:00:00 2001 From: Dan Abramov <dan.abramov@gmail.com> Date: Fri, 2 Sep 2016 21:45:24 +0100 Subject: [PATCH] Fix tasks --- tasks/clean_pack.sh | 4 ++-- tasks/e2e.sh | 2 +- tasks/release.sh | 9 +++++---- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/tasks/clean_pack.sh b/tasks/clean_pack.sh index 48939b005..2d945d5aa 100755 --- a/tasks/clean_pack.sh +++ b/tasks/clean_pack.sh @@ -9,7 +9,7 @@ # We call this as part of the `release.sh` script. # On success, the only output to stdout is the package name. -# Start even if run from root directory +# Start in /tasks even if run from root directory cd "$(dirname "$0")" # Print error messages to stderr. @@ -46,7 +46,7 @@ cd .. # Create a temporary clean folder that contains production-only code. # Do not overwrite any files in the current folder. -clean_path=`mktemp -d clean_XXXX` +clean_path=`mktemp -d 2>/dev/null || mktemp -d -t 'clean_path'` # Copy some of the project files to the temporary folder. # Exclude folders that definitely won’t be part of the package from processing. diff --git a/tasks/e2e.sh b/tasks/e2e.sh index 677f0f311..b02953a0e 100755 --- a/tasks/e2e.sh +++ b/tasks/e2e.sh @@ -6,7 +6,7 @@ # LICENSE file in the root directory of this source tree. An additional grant # of patent rights can be found in the PATENTS file in the same directory. -# Start in tests/ even if run from root directory +# Start in tasks/ even if run from root directory cd "$(dirname "$0")" function cleanup { diff --git a/tasks/release.sh b/tasks/release.sh index 21b5cf261..1f6617a24 100755 --- a/tasks/release.sh +++ b/tasks/release.sh @@ -6,7 +6,7 @@ # LICENSE file in the root directory of this source tree. An additional grant # of patent rights can be found in the PATENTS file in the same directory. -# Start in tests/ even if run from root directory +# Start in tasks/ even if run from root directory cd "$(dirname "$0")" # Exit the script on any command with non 0 return code @@ -19,6 +19,7 @@ set -x # Go to root cd .. +root_path=$PWD # You can only release with npm >= 3 if [ $(npm -v | head -c 1) -lt 3 ]; then @@ -33,14 +34,14 @@ fi # Create a temporary clean folder that contains production only code. # Do not overwrite any files in the current folder. -clean_path=`mktemp -d clean_XXXX` +clean_path=`mktemp -d 2>/dev/null || mktemp -d -t 'clean_path'` # Copy some of the project files to the temporary folder. # Exclude folders that definitely won’t be part of the package from processing. # We will strip the dev-only code there, and then copy files back. rsync -av --exclude='.git' --exclude=$clean_path\ --exclude='node_modules' --exclude='build'\ - './' '$clean_path' >/dev/null + './' $clean_path >/dev/null # Now remove all the code relevant to development of Create React App. cd $clean_path @@ -64,7 +65,7 @@ npm dedupe rm -rf node_modules/fsevents # This modifies $clean_path/package.json to copy all dependencies to bundledDependencies -node ./node_modules/.bin/bundle-deps +node $root_path/node_modules/.bin/bundle-deps # Go! npm publish "$@" -- GitLab