Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
module.exports = {
extends: '@react-native-community',
env: {
node: true,
},
rules: {
'prettier/prettier': [2, 'fb'],
},
settings: {
react: {
version: 'latest',
},
},
overrides: [
{
files: ['**/__mocks__/**', '**/__fixtures__/**', 'testSetup.js'],
env: {
jest: true,
},
},
],
};
22 changes: 4 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,34 +19,20 @@
"@babel/plugin-transform-strict-mode": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"@babel/preset-flow": "^7.0.0",
"@react-native-community/eslint-config": "^0.0.2",
"babel-jest": "^24.0.0",
"@react-native-community/eslint-config": "^0.0.3",
"babel-jest": "^24.5.0",
"chalk": "^2.4.2",
"eslint": "^5.10.0",
"execa": "^1.0.0",
"flow-bin": "^0.95.1",
"flow-typed": "^2.5.1",
"glob": "^7.1.3",
"jest": "^24.0.0",
"lerna": "^3.10.6",
"jest": "^24.5.0",
"lerna": "^3.13.1",
"micromatch": "^3.1.10",
"mkdirp": "^0.5.1",
"string-length": "^2.0.0"
},
"eslintConfig": {
"extends": "@react-native-community",
"env": {
"es6": true,
"jest": true,
"node": true
},
"rules": {
"prettier/prettier": [
2,
"fb"
]
}
},
"jest": {
"projects": [
"packages/*",
Expand Down
19 changes: 9 additions & 10 deletions packages/cli/src/tools/isPackagerRunning.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,27 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
* @flow
*/

import fetch from 'node-fetch';

/**
* Indicates whether or not the packager is running. It returns a promise that
* when fulfilled can returns one out of these possible values:
* returns one of these possible values:
* - `running`: the packager is running
* - `not_running`: the packager nor any process is running on the expected
* port.
* - `unrecognized`: one other process is running on the port we expect the
* packager to be running.
* - `not_running`: the packager nor any process is running on the expected port.
* - `unrecognized`: one other process is running on the port we expect the packager to be running.
*/
function isPackagerRunning(packagerPort = process.env.RCT_METRO_PORT || 8081) {
function isPackagerRunning(
packagerPort: string = process.env.RCT_METRO_PORT || '8081',
): Promise<'running' | 'not_running' | 'unrecognized'> {
return fetch(`http://localhost:${packagerPort}/status`).then(
res =>
res
.text()
.then(
body =>
body === 'packager-status:running' ? 'running' : 'unrecognized',
.then(body =>
body === 'packager-status:running' ? 'running' : 'unrecognized',
),
() => 'not_running',
);
Expand Down
Loading