forked from facebook/react-native
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: Addresses CI build failures due to use of scoped packages by metro. Closes facebook#17878 Differential Revision: D6914937 Pulled By: hramos fbshipit-source-id: e6ce97561035f4deb128cd1e30d81ab4edea3e4c
- Loading branch information
1 parent
613afba
commit fa11fae
Showing
3 changed files
with
40 additions
and
25 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
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 |
---|---|---|
|
@@ -17,7 +17,7 @@ | |
* --android - 'react-native init' and check Android app doesn't redbox | ||
* --js - 'react-native init' and only check the packager returns a bundle | ||
* --skip-cli-install - to skip react-native-cli global installation (for local debugging) | ||
* --retries [num] - how many times to retry possible flaky commands: npm install and running tests, default 1 | ||
* --retries [num] - how many times to retry possible flaky commands: yarn add and running tests, default 1 | ||
*/ | ||
/*eslint-disable no-undef */ | ||
require('shelljs/global'); | ||
|
@@ -44,12 +44,12 @@ let exitCode; | |
try { | ||
// install CLI | ||
cd('react-native-cli'); | ||
exec('npm pack'); | ||
exec('yarn pack'); | ||
const CLI_PACKAGE = path.join(ROOT, 'react-native-cli', 'react-native-cli-*.tgz'); | ||
cd('..'); | ||
|
||
if (!argv['skip-cli-install']) { | ||
if (exec(`sudo npm install -g ${CLI_PACKAGE}`).code) { | ||
if (exec(`sudo yarn global add ${CLI_PACKAGE}`).code) { | ||
echo('Could not install react-native-cli globally.'); | ||
echo('Run with --skip-cli-install to skip this step'); | ||
exitCode = 1; | ||
|
@@ -65,7 +65,7 @@ try { | |
} | ||
} | ||
|
||
if (exec('npm pack').code) { | ||
if (exec('yarn pack').code) { | ||
echo('Failed to pack react-native'); | ||
exitCode = 1; | ||
throw Error(exitCode); | ||
|
@@ -76,7 +76,7 @@ try { | |
if (tryExecNTimes( | ||
() => { | ||
exec('sleep 10s'); | ||
return exec(`react-native init EndToEndTest --version ${PACKAGE} --npm`).code; | ||
return exec(`react-native init EndToEndTest --version ${PACKAGE}`).code; | ||
}, | ||
numberOfRetries, | ||
() => rm('-rf', 'EndToEndTest'))) { | ||
|
@@ -92,7 +92,7 @@ try { | |
echo('Running an Android e2e test'); | ||
echo('Installing e2e framework'); | ||
if (tryExecNTimes( | ||
() => exec('npm install --save-dev [email protected] [email protected] [email protected] [email protected] [email protected]', { silent: true }).code, | ||
() => exec('yarn add --dev [email protected] [email protected] [email protected] [email protected] [email protected]', { silent: true }).code, | ||
numberOfRetries)) { | ||
echo('Failed to install appium'); | ||
echo('Most common reason is npm registry connectivity, try again'); | ||
|
@@ -125,7 +125,7 @@ try { | |
|
||
echo(`Starting packager server, ${SERVER_PID}`); | ||
// shelljs exec('', {async: true}) does not emit stdout events, so we rely on good old spawn | ||
const packagerProcess = spawn('npm', ['start', '--', '--max-workers 1'], { | ||
const packagerProcess = spawn('yarn', ['start', '--max-workers 1'], { | ||
env: process.env | ||
}); | ||
SERVER_PID = packagerProcess.pid; | ||
|
@@ -158,7 +158,7 @@ try { | |
// shelljs exec('', {async: true}) does not emit stdout events, so we rely on good old spawn | ||
const packagerEnv = Object.create(process.env); | ||
packagerEnv.REACT_NATIVE_MAX_WORKERS = 1; | ||
const packagerProcess = spawn('npm', ['start', '--', '--nonPersistent'], | ||
const packagerProcess = spawn('yarn', ['start', '--nonPersistent'], | ||
{ | ||
stdio: 'inherit', | ||
env: packagerEnv | ||
|
@@ -204,7 +204,7 @@ try { | |
exitCode = 1; | ||
throw Error(exitCode); | ||
} | ||
if (exec('npm test').code) { | ||
if (exec('yarn test').code) { | ||
echo('Jest test failure'); | ||
exitCode = 1; | ||
throw Error(exitCode); | ||
|