Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: use the cli-server-api package #1140

Merged
merged 3 commits into from
May 8, 2020
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
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ And then:

```sh
cd /my/new/react-native/project/
yarn link "@react-native-community/cli-platform-ios" "@react-native-community/cli-platform-android" "@react-native-community/cli" "@react-native-community/cli-types" "@react-native-community/cli-tools" "@react-native-community/cli-debugger-ui"
yarn link "@react-native-community/cli-platform-ios" "@react-native-community/cli-platform-android" "@react-native-community/cli" "@react-native-community/cli-server-api" "@react-native-community/cli-types" "@react-native-community/cli-tools" "@react-native-community/cli-debugger-ui"

npx react-native start --watchFolders /path/to/cloned/cli/
npx react-native run-android
```

*Note: you must use the `--watchFolders` flag with the `start` command when testing the CLI with `yarn link` like this. Otherwise Metro can't find the symlinked folder and this may result in errors such as `ReferenceError: SHA-1 for file ... is not computed`.*
_Note: you must use the `--watchFolders` flag with the `start` command when testing the CLI with `yarn link` like this. Otherwise Metro can't find the symlinked folder and this may result in errors such as `ReferenceError: SHA-1 for file ... is not computed`._

Once you're done with testing and you'd like to get back to regular setup, run `yarn unlink` instead of `yarn link` from above command. Then `yarn install --force`.

Expand Down
1 change: 1 addition & 0 deletions packages/cli-server-api/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ export function createDevServerMiddleware(options: MiddlewareOptions) {
'/message',
);
broadcast = messageSocket.broadcast;
isDebuggerConnected = debuggerProxy.isDebuggerConnected;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @fson the debugger connected state was not updated, likely an oversight when moving code around

const eventsSocket = eventsSocketServer.attachToServer(
server,
'/events',
Expand Down
10 changes: 2 additions & 8 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,15 @@
"dependencies": {
"@hapi/joi": "^15.0.3",
"@react-native-community/cli-debugger-ui": "^4.8.0",
"@react-native-community/cli-server-api": "^4.8.0",
"@react-native-community/cli-tools": "^4.8.0",
"@react-native-community/cli-types": "^4.8.0",
"chalk": "^3.0.0",
"command-exists": "^1.2.8",
"commander": "^2.19.0",
"compression": "^1.7.1",
"connect": "^3.6.5",
"cosmiconfig": "^5.1.0",
"deepmerge": "^3.2.0",
"envinfo": "^7.1.0",
"errorhandler": "^1.5.0",
"execa": "^1.0.0",
"find-up": "^4.1.0",
"fs-extra": "^8.1.0",
Expand All @@ -63,17 +61,14 @@
"serve-static": "^1.13.1",
"strip-ansi": "^5.2.0",
"sudo-prompt": "^9.0.0",
"wcwidth": "^1.0.1",
"ws": "^1.1.0"
"wcwidth": "^1.0.1"
},
"peerDependencies": {
"react-native": "^0.62.0-rc.0"
},
"devDependencies": {
"@types/command-exists": "^1.2.0",
"@types/compression": "^1.0.1",
"@types/cosmiconfig": "^5.0.3",
"@types/errorhandler": "^0.0.32",
"@types/fs-extra": "^8.1.0",
"@types/glob": "^7.1.1",
"@types/graceful-fs": "^4.1.3",
Expand All @@ -83,7 +78,6 @@
"@types/mkdirp": "^0.5.2",
"@types/semver": "^6.0.2",
"@types/wcwidth": "^1.0.0",
"@types/ws": "^6.0.3",
"slash": "^3.0.0",
"snapshot-diff": "^0.7.0"
}
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/commands/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {Command, DetachedCommand} from '@react-native-community/cli-types';

// @ts-ignore - JS file
import server from './server/server';
import start from './start/start';
import bundle from './bundle/bundle';
import ramBundle from './bundle/ramBundle';
import link from './link/link';
Expand All @@ -16,7 +16,7 @@ import init from './init';
import doctor from './doctor';

export const projectCommands = [
server,
start,
bundle,
ramBundle,
link,
Expand Down
203 changes: 0 additions & 203 deletions packages/cli/src/commands/server/eventsSocket.ts

This file was deleted.

Loading