Skip to content

Commit

Permalink
Merge branch 'master' into update-rndebugger-open
Browse files Browse the repository at this point in the history
  • Loading branch information
jhen0409 committed Jul 21, 2023
2 parents 8a09137 + b5bb1c6 commit 9322e10
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 18 deletions.
2 changes: 1 addition & 1 deletion __e2e__/app.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ describe('Application launch', () => {

await waitForExpect(async () => {
expect(await mainWindow.title()).toBe(
`React Native Debugger - Waiting for client connection (port ${customRNServerPort})`,
'React Native Debugger - Waiting for client connection (port 8081)',
);
});
server.close();
Expand Down
2 changes: 1 addition & 1 deletion app/containers/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ export default class App extends Component {
button="Confirm"
inputProps={{
type: 'input',
value: 19001,
value: 19000,
}}
onInputChange={value => Number(value.replace(/\D/g, '').substr(0, 5)) || ''}
onSubmit={this.handlePortOnSubmit}
Expand Down
3 changes: 2 additions & 1 deletion npm-package/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ $ REACT_DEBUGGER="rndebugger-open --open --port 8081" npm start
$ set REACT_DEBUGGER="rndebugger-open --open --port 8081" && npm start
```

If you're using Expo <= 48, use port 19000 instead of 8081.

#### Options (--option)

Name | Description
Expand All @@ -55,7 +57,6 @@ Name | Description
`revert` | Revert rndebugger-open injection. Default is `false`
`open` | Run open directly instead of inject patch
`port` | Specified react-native packager port with `--open` option. Default is `8081`
`expo` | Use [Expo](https://github.com/expo)'s RN packager port if you're not specified port.

You can also [`Launch by CLI or React Native packager`](https://github.com/jhen0409/react-native-debugger/blob/master/docs/getting-started.md#launch-by-cli-or-react-native-packager-macos-only) instead of this package.

Expand Down
16 changes: 1 addition & 15 deletions npm-package/bin/rndebugger-open.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,7 @@

'use strict';

const fs = require('fs');
const path = require('path');

const defaultPort = 8081;
const expoDefaultPort = 19001;

const expoInfoPath = path.join(process.cwd(), '.expo/packager-info.json');

/* eslint-disable global-require */
const getExpoPort = () =>
(fs.existsSync(expoInfoPath)
? require(expoInfoPath).packagerPort || expoDefaultPort
: expoDefaultPort);

const argv = require('minimist')(process.argv.slice(2), {
boolean: [
Expand All @@ -26,8 +14,6 @@ const argv = require('minimist')(process.argv.slice(2), {
'macos',
// Open directly instead of Inject code
'open',
// Use expo packager port (getExpoPort) instead of RN packager default port (8081)
'expo',
],
string: ['port', 'host'],
default: {
Expand All @@ -36,7 +22,7 @@ const argv = require('minimist')(process.argv.slice(2), {
});

let moduleName;
argv.port = Number(argv.port) || (argv.expo ? getExpoPort() : defaultPort);
argv.port = Number(argv.port) || defaultPort;
if (argv.open && (argv.port || argv.host)) {
moduleName = '../lib/open';
} else {
Expand Down

0 comments on commit 9322e10

Please sign in to comment.