Skip to content

Commit

Permalink
Use new config internally in Metro
Browse files Browse the repository at this point in the history
Summary: Change the internals of Metro to use the new configuration instead of `ServerOptions`.

Reviewed By: rafeca

Differential Revision: D8734685

fbshipit-source-id: 1215f799419fcaa0e5fb7814683da1cbba96795c
  • Loading branch information
Ives van Hoorne authored and facebook-github-bot committed Jul 25, 2018
1 parent a32620d commit aaf797a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 10 deletions.
5 changes: 1 addition & 4 deletions local-cli/bundle/buildBundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ const Server = require('metro/src/Server');

/* $FlowFixMe(site=react_native_oss) */
const outputBundle = require('metro/src/shared/output/bundle');
const {convert} = require('metro-config');
const path = require('path');
const saveAssets = require('./saveAssets');

Expand Down Expand Up @@ -57,9 +56,7 @@ async function buildBundle(
platform: args.platform,
};

const {serverOptions} = convert.convertNewToOld(config);

const server = new Server(serverOptions);
const server = new Server(config);

try {
const bundle = await output.build(server, requestOpts);
Expand Down
5 changes: 1 addition & 4 deletions local-cli/dependencies/dependencies.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
'use strict';

const Metro = require('metro');
const {convert} = require('metro-config');

const denodeify = require('denodeify');
const fs = require('fs');
Expand Down Expand Up @@ -48,12 +47,10 @@ async function dependencies(argv, configPromise, args, packagerInstance) {
? fs.createWriteStream(args.output)
: process.stdout;

const {serverOptions} = convert.convertNewToOld(config);

return Promise.resolve(
(packagerInstance
? packagerInstance.getOrderedDependencyPaths(options)
: Metro.getOrderedDependencyPaths(serverOptions, options)
: Metro.getOrderedDependencyPaths(config, options)
).then(deps => {
deps.forEach(modulePath => {
// Temporary hack to disable listing dependencies not under this directory.
Expand Down
3 changes: 1 addition & 2 deletions local-cli/server/runServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ async function runServer(args: Args, config: ConfigT) {
config.server.enhanceMiddleware = middleware =>
middlewareManager.getConnectInstance().use(middleware);

const serverInstance = await Metro.runServer({
config,
const serverInstance = await Metro.runServer(config, {
host: args.host,
secure: args.https,
secureCert: args.cert,
Expand Down

0 comments on commit aaf797a

Please sign in to comment.