Skip to content
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
Make local-cli run
  • Loading branch information
Esemesek authored and grabbou committed Nov 6, 2018
commit b02fb8232e3cbd4ca18d2e23f4fc8315902af730
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"private": true,
"workspaces": ["packages/*"]
}
2 changes: 1 addition & 1 deletion packages/local-cli/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ require('graceful-fs').gracefulify(require('fs'));
// it is not supported. This is why the rest of the cli code is in `cliEntry.js`.
require('./server/checkNodeVersion')();

require('../setupBabel')();
require('./util/setupBabel')();

var cliEntry = require('./cliEntry');

Expand Down
2 changes: 1 addition & 1 deletion packages/local-cli/cliEntry.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const commander = require('commander');
const commands = require('./commands');
const init = require('./init/init');
const path = require('path');
const pkg = require('../package.json');
const pkg = require('./package.json');

import type {CommandT} from './commands';
import type {RNConfig} from './core';
Expand Down
3 changes: 2 additions & 1 deletion packages/local-cli/core/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ const pluginPlatforms = plugins.platforms.reduce((acc, pathToPlatforms) => {
}, {});

const defaultConfig = {
hasteImplModulePath: require.resolve('../../jest/hasteImpl'),
// @todo fix
// hasteImplModulePath: require.resolve('../../jest/hasteImpl'),

getPlatforms(): Array<string> {
return ['ios', 'android', 'native', ...plugins.haste.platforms];
Expand Down
52 changes: 52 additions & 0 deletions packages/local-cli/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"name": "react-native-local-cli",
"version": "0.57.0",
"description": "Local CLI package used with React Native",
"license": "MIT",
"main": "cli.js",
"engines": {
"node": ">= 8.3"
},
"dependencies": {
"absolute-path": "^0.0.0",
"chalk": "^1.1.1",
"commander": "^2.9.0",
"compression": "^1.7.1",
"connect": "^3.6.5",
"denodeify": "^1.2.1",
"envinfo": "^5.7.0",
"errorhandler": "^1.5.0",
"fs-extra": "^1.0.0",
"glob": "^7.1.1",
"graceful-fs": "^4.1.3",
"inquirer": "^3.0.6",
"lodash": "^4.17.5",
"metro": "^0.48.1",
"metro-babel-register": "^0.48.1",
"metro-core": "^0.48.1",
"metro-memory-fs": "^0.48.1",
"mime": "^1.3.4",
"minimist": "^1.2.0",
"mkdirp": "^0.5.1",
"morgan": "^1.9.0",
"node-fetch": "^2.2.0",
"node-notifier": "^5.2.1",
"npmlog": "^2.0.4",
"opn": "^3.0.2",
"optimist": "^0.6.1",
"plist": "^3.0.0",
"promise": "^7.1.1",
"semver": "^5.0.3",
"serve-static": "^1.13.1",
"shell-quote": "1.6.1",
"ws": "^1.1.0",
"xcode": "^1.0.0",
"xmldoc": "^0.4.0"
},
"devDependencies": {
"@babel/core": "^7.0.0",
"eslint": "^5.7.0",
"flow-bin": "^0.83.0",
"jest": "23.4.1"
}
}
2 changes: 1 addition & 1 deletion packages/local-cli/server/runServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

'use strict';

require('../../setupBabel')();
require('../util/setupBabel')();

const Metro = require('metro');

Expand Down
5 changes: 3 additions & 2 deletions packages/local-cli/util/Config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
'use strict';

const findSymlinkedModules = require('./findSymlinkedModules');
const getPolyfills = require('../../rn-get-polyfills');
// @todo what to do with this file?
// const getPolyfills = require('../../../react-native/rn-get-polyfills');
const path = require('path');

const {createBlacklist} = require('metro');
Expand Down Expand Up @@ -74,7 +75,7 @@ const Config = {
getModulesRunBeforeMainModule: () => [
require.resolve('../../Libraries/Core/InitializeCore'),
],
getPolyfills,
// getPolyfills,
},
server: {
port: process.env.RCT_METRO_PORT || 8081,
Expand Down
27 changes: 27 additions & 0 deletions packages/local-cli/util/setupBabel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
*/

'use strict';

const babelRegisterOnly = require('metro-babel-register');

const BABEL_ENABLED_PATHS = ['../'];

/**
* Centralized place to register all the directories that need a Babel
* transformation before being fed to Node.js. Notably, this is necessary to
* support Flow type annotations.
*/
function setupBabel() {
babelRegisterOnly(
babelRegisterOnly.buildRegExps(__dirname, BABEL_ENABLED_PATHS),
);
}

module.exports = setupBabel;
Loading