-
Notifications
You must be signed in to change notification settings - Fork 480
refactor: add @expo/dev-server #1845
Conversation
bddf261 to
6b73b35
Compare
| ); | ||
| } | ||
|
|
||
| type ConsoleLogLevel = 'info' | 'warn' | 'error' | 'debug'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move to the top
packages/dev-server/src/middleware/__tests__/clientLogsMiddleware-test.ts
Show resolved
Hide resolved
5f70eec to
a6bd7e8
Compare
b6fe237 to
55fbadb
Compare
494ec4a to
d7ea99f
Compare
9e05f00 to
23f102d
Compare
| watchFolders: [...metroConfig.watchFolders], | ||
| }); | ||
| middleware.use(bodyParser.json()); | ||
| middleware.use('/logs', clientLogsMiddleware(options.logger)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add comments here explaining what these middleware features do
| } | ||
|
|
||
| function handleDeviceLogs(logger: Log, deviceId: string, deviceName: string, logs: any) { | ||
| for (let i = 0; i < logs.length; i++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| for (let i = 0; i < logs.length; i++) { | |
| for (const log of logs) { |
| @@ -0,0 +1,8 @@ | |||
| { | |||
| "extends": "@expo/babel-preset-cli/tsconfig.base", | |||
| "include": ["src/**/*.ts"], | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Be sure to exclude tests:
{
"extends": "@expo/babel-preset-cli/tsconfig.base",
"compilerOptions": {
"outDir": "build",
"rootDir": "src"
},
"include": ["src/**/*.ts"],
"exclude": ["**/__mocks__/*", "**/__tests__/*"]
}There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want __tests__ to be type checked however, as far as I know Jest compiles them with Babel which doesn't do type checking? Maybe we can only ignore them in .npmignore or files when publishing to npm?
packages/xdl/src/Project.ts
Outdated
| options.maxWorkers = startOptions.maxWorkers; | ||
| } | ||
| if (startOptions.target) { | ||
| options.target = startOptions.target; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thoughts on moving EXPO_TARGET here to keep the dev server package more agnostic?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea 👍
| } else if (getenv.boolish('EXPO_USE_DEV_SERVER', false)) { | ||
| await startDevServerAsync(projectRoot, options); | ||
| DevSession.startSession(projectRoot, exp, 'native'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIRC we talked about potentially putting this in another file so we could identify and deprecate the legacy code more easily.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rather do this as a part of splitting up XDL, I'll start working on it soon.
EvanBacon
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
It had the port number twice
cli-server-api 4.8.0 doesn't include TS declarations
6303af1 to
5d36147
Compare
Co-Authored-By: Evan Bacon <[email protected]>
Co-Authored-By: Evan Bacon <[email protected]>
Co-Authored-By: Evan Bacon <[email protected]>
Codecov Report
@@ Coverage Diff @@
## master #1845 +/- ##
=======================================
Coverage 45.09% 45.09%
=======================================
Files 120 120
Lines 4924 4924
Branches 1177 1177
=======================================
Hits 2220 2220
Misses 1898 1898
Partials 806 806 |
@expo/dev-serverwill use the newdev-server-apiand@expo/metro-configpackages to set up a Metro dev server compatible with React Native projects. In addition to the React Native development endpoints, it will include additional endpoints e.g. for serving Expo manifests and receiving logs from Expo client.