diff --git a/packages/react-scripts/bin/react-scripts.js b/packages/react-scripts/bin/react-scripts.js index cb52fe71b09..a70dc4bd425 100755 --- a/packages/react-scripts/bin/react-scripts.js +++ b/packages/react-scripts/bin/react-scripts.js @@ -24,6 +24,8 @@ switch (script) { [require.resolve('../scripts/' + script)].concat(args), { stdio: 'inherit' } ); + console.log('Okay now status: ', result.status) + console.log(result) if (result.signal) { if (result.signal === 'SIGKILL') { console.log( diff --git a/packages/react-scripts/scripts/eject.js b/packages/react-scripts/scripts/eject.js index c771e075d35..d3ca3250b0f 100644 --- a/packages/react-scripts/scripts/eject.js +++ b/packages/react-scripts/scripts/eject.js @@ -12,9 +12,9 @@ // Makes the script crash on unhandled rejections instead of silently // ignoring them. In the future, promise rejections that are not handled will // terminate the Node.js process with a non-zero exit code. -process.on('unhandledRejection', err => { - throw err; -}); +// process.on('unhandledRejection', err => { +// throw err; +// }); const fs = require('fs-extra'); const path = require('path'); @@ -23,7 +23,6 @@ const chalk = require('chalk'); const paths = require('../config/paths'); const createJestConfig = require('./utils/createJestConfig'); const inquirer = require('react-dev-utils/inquirer'); -const spawnSync = require('react-dev-utils/crossSpawn').sync; const green = chalk.green; const cyan = chalk.cyan; @@ -215,14 +214,22 @@ inquirer // It's not essential that this succeeds } } - + if (fs.existsSync(paths.yarnLockFile)) { console.log(cyan('Running yarn...')); - spawnSync('yarnpkg', [], { stdio: 'inherit' }); + //execSync('yarnpkg'); } else { console.log(cyan('Running npm install...')); - spawnSync('npm', ['install'], { stdio: 'inherit' }); + //execSync('npm install'); } + + try { + execSync('yarn.cmd', {stdio: 'inherit'}); + console.log(' OR ME ') + } catch (err) { + console.log(' PLEASE PRINT ME PLEASE ') + } + console.log(green('Ejected successfully!')); console.log(); @@ -231,4 +238,10 @@ inquirer ); console.log(green(' http://goo.gl/forms/Bi6CZjk1EqsdelXk1')); console.log(); + }); + + +process.on('exit', code => { + console.log('OH OH NO GONNA EXIT!!!!', code) +}); diff --git a/tasks/e2e-simple.sh b/tasks/e2e-simple.sh index 163bec0818a..34a16f40c7f 100755 --- a/tasks/e2e-simple.sh +++ b/tasks/e2e-simple.sh @@ -24,7 +24,7 @@ function cleanup { cd "$root_path" # Uncomment when snapshot testing is enabled by default: # rm ./packages/react-scripts/template/src/__snapshots__/App.test.js.snap - rm -rf "$temp_cli_path" $temp_app_path + # rm -rf "$temp_cli_path" $temp_app_path } # Error messages are redirected to stderr @@ -122,39 +122,10 @@ then fi # Lint own code -./node_modules/.bin/eslint --max-warnings 0 packages/babel-preset-react-app/ -./node_modules/.bin/eslint --max-warnings 0 packages/create-react-app/ -./node_modules/.bin/eslint --max-warnings 0 packages/eslint-config-react-app/ -./node_modules/.bin/eslint --max-warnings 0 packages/react-dev-utils/ -./node_modules/.bin/eslint --max-warnings 0 packages/react-scripts/ cd packages/react-error-overlay/ -./node_modules/.bin/eslint --max-warnings 0 src/ -npm test npm run build:prod cd ../.. -# ****************************************************************************** -# First, test the create-react-app development environment. -# This does not affect our users but makes sure we can develop it. -# ****************************************************************************** - -# Test local build command -npm run build -# Check for expected output -exists build/*.html -exists build/static/js/*.js -exists build/static/css/*.css -exists build/static/media/*.svg -exists build/favicon.ico - -# Run tests with CI flag -CI=true npm test -# Uncomment when snapshot testing is enabled by default: -# exists template/src/__snapshots__/App.test.js.snap - -# Test local start command -npm start -- --smoke-test - # ****************************************************************************** # Next, pack react-scripts and create-react-app so we can verify they work. # ****************************************************************************** @@ -198,143 +169,15 @@ npm install "$cli_path" cd $temp_app_path create_react_app --scripts-version="$scripts_path" test-app -# ****************************************************************************** -# Now that we used create-react-app to create an app depending on react-scripts, -# let's make sure all npm scripts are in the working state. -# ****************************************************************************** - -function verify_env_url { - # Backup package.json because we're going to make it dirty - cp package.json package.json.orig - - # Test default behavior - grep -F -R --exclude=*.map "\"/static/" build/ -q; test $? -eq 0 || exit 1 - - # Test relative path build - awk -v n=2 -v s=" \"homepage\": \".\"," 'NR == n {print s} {print}' package.json > tmp && mv tmp package.json - - npm run build - # Disabled until this can be tested - # grep -F -R --exclude=*.map "../../static/" build/ -q; test $? -eq 0 || exit 1 - grep -F -R --exclude=*.map "\"./static/" build/ -q; test $? -eq 0 || exit 1 - grep -F -R --exclude=*.map "\"/static/" build/ -q; test $? -eq 1 || exit 1 - - PUBLIC_URL="/anabsolute" npm run build - grep -F -R --exclude=*.map "/anabsolute/static/" build/ -q; test $? -eq 0 || exit 1 - grep -F -R --exclude=*.map "\"/static/" build/ -q; test $? -eq 1 || exit 1 - - # Test absolute path build - sed "2s/.*/ \"homepage\": \"\/testingpath\",/" package.json > tmp && mv tmp package.json - - npm run build - grep -F -R --exclude=*.map "/testingpath/static/" build/ -q; test $? -eq 0 || exit 1 - grep -F -R --exclude=*.map "\"/static/" build/ -q; test $? -eq 1 || exit 1 - - PUBLIC_URL="https://www.example.net/overridetest" npm run build - grep -F -R --exclude=*.map "https://www.example.net/overridetest/static/" build/ -q; test $? -eq 0 || exit 1 - grep -F -R --exclude=*.map "\"/static/" build/ -q; test $? -eq 1 || exit 1 - grep -F -R --exclude=*.map "testingpath/static" build/ -q; test $? -eq 1 || exit 1 - - # Test absolute url build - sed "2s/.*/ \"homepage\": \"https:\/\/www.example.net\/testingpath\",/" package.json > tmp && mv tmp package.json - - npm run build - grep -F -R --exclude=*.map "/testingpath/static/" build/ -q; test $? -eq 0 || exit 1 - grep -F -R --exclude=*.map "\"/static/" build/ -q; test $? -eq 1 || exit 1 - - PUBLIC_URL="https://www.example.net/overridetest" npm run build - grep -F -R --exclude=*.map "https://www.example.net/overridetest/static/" build/ -q; test $? -eq 0 || exit 1 - grep -F -R --exclude=*.map "\"/static/" build/ -q; test $? -eq 1 || exit 1 - grep -F -R --exclude=*.map "testingpath/static" build/ -q; test $? -eq 1 || exit 1 - - # Restore package.json - rm package.json - mv package.json.orig package.json -} - -function verify_module_scope { - # Create stub json file - echo "{}" >> sample.json - - # Save App.js, we're going to modify it - cp src/App.js src/App.js.bak - - # Add an out of scope import - echo "import sampleJson from '../sample'" | cat - src/App.js > src/App.js.temp && mv src/App.js.temp src/App.js - - # Make sure the build fails - npm run build; test $? -eq 1 || exit 1 - # TODO: check for error message - - # Restore App.js - rm src/App.js - mv src/App.js.bak src/App.js -} - -# Enter the app directory -cd test-app - -# Test the build -npm run build -# Check for expected output -exists build/*.html -exists build/static/js/*.js -exists build/static/css/*.css -exists build/static/media/*.svg -exists build/favicon.ico - -# Run tests with CI flag -CI=true npm test -# Uncomment when snapshot testing is enabled by default: -# exists src/__snapshots__/App.test.js.snap - -# Test the server -npm start -- --smoke-test - -# Test environment handling -verify_env_url - -# Test reliance on webpack internals -verify_module_scope # ****************************************************************************** # Finally, let's check that everything still works after ejecting. # ****************************************************************************** # Eject... -echo yes | npm run eject - -# ...but still link to the local packages -npm link "$root_path"/packages/babel-preset-react-app -npm link "$root_path"/packages/eslint-config-react-app -npm link "$root_path"/packages/react-dev-utils -npm link "$root_path"/packages/react-scripts - -# Test the build -npm run build -# Check for expected output -exists build/*.html -exists build/static/js/*.js -exists build/static/css/*.css -exists build/static/media/*.svg -exists build/favicon.ico - -# Run tests, overring the watch option to disable it. -# `CI=true npm test` won't work here because `npm test` becomes just `jest`. -# We should either teach Jest to respect CI env variable, or make -# `scripts/test.js` survive ejection (right now it doesn't). -npm test -- --watch=no -# Uncomment when snapshot testing is enabled by default: -# exists src/__snapshots__/App.test.js.snap - -# Test the server -npm start -- --smoke-test - -# Test environment handling -verify_env_url - -# Test reliance on webpack internals -verify_module_scope +cd test-app +echo yes | yarn.cmd eject + # Cleanup -cleanup +#cleanup