-
-
Notifications
You must be signed in to change notification settings - Fork 27k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use "commander" for cli argv handling (#1195)
* Use "commander" for cli argv handling * Handle different scripts version forms and exits without a name given * Revert comment about min supported node version * Check sooner for the minimal node version * Add travis test for node <4 * Parse stderr in node versions <4
- Loading branch information
1 parent
9d42ffa
commit 7f9fb29
Showing
4 changed files
with
48 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
--- | ||
language: node_js | ||
node_js: | ||
- 0.10 | ||
- 4 | ||
- 6 | ||
cache: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,11 @@ | |
# Start in tasks/ even if run from root directory | ||
cd "$(dirname "$0")" | ||
|
||
# CLI and app temporary locations | ||
# http://unix.stackexchange.com/a/84980 | ||
temp_cli_path=`mktemp -d 2>/dev/null || mktemp -d -t 'temp_cli_path'` | ||
temp_app_path=`mktemp -d 2>/dev/null || mktemp -d -t 'temp_app_path'` | ||
|
||
function cleanup { | ||
echo 'Cleaning up.' | ||
cd $root_path | ||
|
@@ -53,15 +58,23 @@ set -x | |
cd .. | ||
root_path=$PWD | ||
|
||
npm install | ||
|
||
# If the node version is < 4, the script should just give an error. | ||
if [ `node --version | sed -e 's/^v//' -e 's/\..\+//g'` -lt 4 ] | ||
then | ||
cd $temp_app_path | ||
err_output=`node "$root_path"/packages/create-react-app/index.js test-node-version 2>&1 > /dev/null || echo ''` | ||
[[ $err_output =~ You\ are\ currently\ running\ Node\ v.+\ but\ create-react-app\ requires\ \>=4\. ]] && exit 0 || exit 1 | ||
fi | ||
|
||
if [ "$USE_YARN" = "yes" ] | ||
then | ||
# Install Yarn so that the test can use it to install packages. | ||
npm install -g [email protected] # TODO: remove version when https://github.com/yarnpkg/yarn/issues/2142 is fixed. | ||
yarn cache clean | ||
fi | ||
|
||
npm install | ||
|
||
# Lint own code | ||
./node_modules/.bin/eslint --ignore-path .gitignore ./ | ||
|
||
|
@@ -117,13 +130,10 @@ mv package.json.orig package.json | |
# ****************************************************************************** | ||
|
||
# Install the CLI in a temporary location | ||
# http://unix.stackexchange.com/a/84980 | ||
temp_cli_path=`mktemp -d 2>/dev/null || mktemp -d -t 'temp_cli_path'` | ||
cd $temp_cli_path | ||
npm install $cli_path | ||
|
||
# Install the app in a temporary location | ||
temp_app_path=`mktemp -d 2>/dev/null || mktemp -d -t 'temp_app_path'` | ||
cd $temp_app_path | ||
create_react_app --scripts-version=$scripts_path test-app | ||
|
||
|
@@ -185,7 +195,6 @@ npm test -- --watch=no | |
# Test the server | ||
npm start -- --smoke-test | ||
|
||
|
||
# ****************************************************************************** | ||
# Test --scripts-version with a version number | ||
# ****************************************************************************** | ||
|