Skip to content

Commit

Permalink
rndebugger-open: Remove --expo flag
Browse files Browse the repository at this point in the history
expo 49 start using 8081 as default packager port, also packager-info is no longer supported.

users are also able to use `--port 19000` for Expo <= 48.

closes #689
  • Loading branch information
jhen0409 committed Jul 21, 2023
1 parent 9970b34 commit b5bb1c6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 16 deletions.
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 = 19000;

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 b5bb1c6

Please sign in to comment.