Skip to content
This repository has been archived by the owner on Jan 18, 2024. It is now read-only.

refactor: add @expo/dev-server #1845

Merged
merged 36 commits into from
Apr 29, 2020
Merged

refactor: add @expo/dev-server #1845

merged 36 commits into from
Apr 29, 2020

Conversation

fson
Copy link
Contributor

@fson fson commented Apr 9, 2020

@expo/dev-server will use the new dev-server-api and @expo/metro-config packages 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.

);
}

type ConsoleLogLevel = 'info' | 'warn' | 'error' | 'debug';
Copy link
Contributor

Choose a reason for hiding this comment

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

Move to the top

@fson fson marked this pull request as ready for review April 26, 2020 13:45
@fson fson requested a review from EvanBacon April 26, 2020 13:45
watchFolders: [...metroConfig.watchFolders],
});
middleware.use(bodyParser.json());
middleware.use('/logs', clientLogsMiddleware(options.logger));
Copy link
Contributor

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++) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
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"],
Copy link
Contributor

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__/*"]
}

Copy link
Contributor Author

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?

options.maxWorkers = startOptions.maxWorkers;
}
if (startOptions.target) {
options.target = startOptions.target;
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea 👍

Comment on lines +2397 to +2399
} else if (getenv.boolish('EXPO_USE_DEV_SERVER', false)) {
await startDevServerAsync(projectRoot, options);
DevSession.startSession(projectRoot, exp, 'native');
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

@EvanBacon EvanBacon left a comment

Choose a reason for hiding this comment

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

LGTM

@codecov-io
Copy link

codecov-io commented Apr 29, 2020

Codecov Report

Merging #1845 into master will not change coverage.
The diff coverage is n/a.

Flag Coverage Δ
#babelPresetCli 100.00% <0.00%> (ø)
#config 60.91% <0.00%> (ø)
#devServer 60.53% <0.00%> (ø)
#expoCli 33.71% <0.00%> (ø)
#expoCodemod 83.81% <0.00%> (ø)
#jsonFile 65.49% <0.00%> (ø)
#packageManager 16.67% <0.00%> (ø)
#plist 70.64% <0.00%> (ø)
#pwa 34.32% <0.00%> (ø)
#schemer 69.88% <0.00%> (ø)
#uriScheme 32.05% <0.00%> (ø)
#webpackConfig 53.41% <0.00%> (ø)
#xdl 23.37% <0.00%> (ø)
@@           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           

@fson fson merged commit 0cb5979 into master Apr 29, 2020
@fson fson deleted the @fson/metro-dev-server branch April 29, 2020 15:33
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants