From a96e99fae514e47cce39ecda2e6642094ebe2e0b Mon Sep 17 00:00:00 2001 From: Peter van der Zee Date: Fri, 15 Dec 2017 06:21:09 -0800 Subject: [PATCH] Move Terminal to metro-core Reviewed By: rafeca Differential Revision: D6532920 fbshipit-source-id: d1463aa0759a6b6d5cc46b05157518a4ce3eb9bf --- packages/metro-core/README.md | 5 +++++ packages/metro-core/package.json | 14 ++++++++++++++ .../lib => metro-core/src/Terminal}/Terminal.js | 0 .../src/Terminal}/__tests__/Terminal-test.js | 0 packages/metro-core/src/Terminal/index.js | 17 +++++++++++++++++ packages/metro-core/src/index.js | 17 +++++++++++++++++ packages/metro/src/index.js | 2 +- packages/metro/src/lib/TerminalReporter.js | 2 +- packages/metro/src/lib/reporting.js | 3 ++- yarn.lock | 6 +++--- 10 files changed, 60 insertions(+), 6 deletions(-) create mode 100644 packages/metro-core/README.md create mode 100644 packages/metro-core/package.json rename packages/{metro/src/lib => metro-core/src/Terminal}/Terminal.js (100%) rename packages/{metro/src/lib => metro-core/src/Terminal}/__tests__/Terminal-test.js (100%) create mode 100644 packages/metro-core/src/Terminal/index.js create mode 100644 packages/metro-core/src/index.js diff --git a/packages/metro-core/README.md b/packages/metro-core/README.md new file mode 100644 index 00000000..67271c95 --- /dev/null +++ b/packages/metro-core/README.md @@ -0,0 +1,5 @@ +# Metro + +🚇 This package contains core files for [Metro](https://facebook.github.io/metro/). + +(TODO) diff --git a/packages/metro-core/package.json b/packages/metro-core/package.json new file mode 100644 index 00000000..4614dd9a --- /dev/null +++ b/packages/metro-core/package.json @@ -0,0 +1,14 @@ +{ + "version": "0.23.0", + "name": "metro-core", + "description": "🚇 Core files for Metro", + "main": "src/index.js", + "repository": { + "type": "git", + "url": "git@github.com:facebook/metro.git" + }, + "scripts": { + "prepare-release": "test -d build && rm -rf src.real && mv src src.real && mv build src", + "cleanup-release": "test ! -e build && mv src build && mv src.real src" + } +} diff --git a/packages/metro/src/lib/Terminal.js b/packages/metro-core/src/Terminal/Terminal.js similarity index 100% rename from packages/metro/src/lib/Terminal.js rename to packages/metro-core/src/Terminal/Terminal.js diff --git a/packages/metro/src/lib/__tests__/Terminal-test.js b/packages/metro-core/src/Terminal/__tests__/Terminal-test.js similarity index 100% rename from packages/metro/src/lib/__tests__/Terminal-test.js rename to packages/metro-core/src/Terminal/__tests__/Terminal-test.js diff --git a/packages/metro-core/src/Terminal/index.js b/packages/metro-core/src/Terminal/index.js new file mode 100644 index 00000000..c8cf4950 --- /dev/null +++ b/packages/metro-core/src/Terminal/index.js @@ -0,0 +1,17 @@ +/** + * Copyright (c) 2015-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * @flow + * @format + */ + +'use strict'; + +const Terminal = require('./Terminal'); + +module.exports = Terminal; diff --git a/packages/metro-core/src/index.js b/packages/metro-core/src/index.js new file mode 100644 index 00000000..aff856bf --- /dev/null +++ b/packages/metro-core/src/index.js @@ -0,0 +1,17 @@ +/** + * Copyright (c) 2015-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * @flow + * @format + */ + +'use strict'; + +const Terminal = require('./Terminal'); + +module.exports = {Terminal}; diff --git a/packages/metro/src/index.js b/packages/metro/src/index.js index 02150175..90c87f3a 100644 --- a/packages/metro/src/index.js +++ b/packages/metro/src/index.js @@ -17,7 +17,6 @@ const Http = require('http'); const Https = require('https'); const MetroBundler = require('./shared/output/bundle'); const MetroServer = require('./Server'); -const Terminal = require('./lib/Terminal'); const TerminalReporter = require('./lib/TerminalReporter'); const TransformCaching = require('./lib/TransformCaching'); @@ -25,6 +24,7 @@ const defaults = require('./defaults'); const {realpath} = require('fs'); const {readFile} = require('fs-extra'); +const {Terminal} = require('metro-core'); import type {ConfigT} from './Config'; import type {RequestOptions, OutputOptions} from './shared/types.flow.js'; diff --git a/packages/metro/src/lib/TerminalReporter.js b/packages/metro/src/lib/TerminalReporter.js index 9b6b3772..f80ffeee 100644 --- a/packages/metro/src/lib/TerminalReporter.js +++ b/packages/metro/src/lib/TerminalReporter.js @@ -23,8 +23,8 @@ const { } = require('../node-haste/DependencyGraph/ResolutionRequest'); import type {BundleOptions} from '../shared/types.flow'; -import type Terminal from './Terminal'; import type {ReportableEvent, GlobalCacheDisabledReason} from './reporting'; +import type {Terminal} from 'metro-core'; const DEP_GRAPH_MESSAGE = 'Loading dependency graph'; const GLOBAL_CACHE_DISABLED_MESSAGE_FORMAT = diff --git a/packages/metro/src/lib/reporting.js b/packages/metro/src/lib/reporting.js index eef89521..acc6db09 100644 --- a/packages/metro/src/lib/reporting.js +++ b/packages/metro/src/lib/reporting.js @@ -15,8 +15,9 @@ const chalk = require('chalk'); const util = require('util'); +const {Terminal} = require('metro-core'); + import type {BundleOptions} from '../shared/types.flow'; -import type Terminal from './Terminal'; export type GlobalCacheDisabledReason = 'too_many_errors' | 'too_many_misses'; diff --git a/yarn.lock b/yarn.lock index aaba462d..7be9602d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2355,9 +2355,9 @@ flat-cache@^1.2.1: graceful-fs "^4.1.2" write "^0.2.1" -flow-bin@0.59.0: - version "0.59.0" - resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.59.0.tgz#8c151ee7f09f1deed9bf0b9d1f2e8ab9d470f1bb" +flow-bin@^0.60.1: + version "0.60.1" + resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.60.1.tgz#0f4fa7b49be2a916f18cd946fc4a51e32ffe4b48" for-in@^1.0.1: version "1.0.2"