Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 96dda4b

Browse files
andreicoman11facebook-github-bot-3
authored and
facebook-github-bot-3
committed
Revert D2531438
Differential Revision: D2531532 fb-gh-sync-id: c86bbcde3254df78f3dca88285ef1cd5a3563123
1 parent c075be6 commit 96dda4b

File tree

3 files changed

+35
-53
lines changed

3 files changed

+35
-53
lines changed

private-cli/src/bundle/bundle.js

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
'use strict';
1010

1111
const log = require('../util/log').out('bundle');
12-
const parseBundleCommandLine = require('./parseBundleCommandLine');
12+
const parseCommandLine = require('../../../packager/parseCommandLine');
1313
const processBundle = require('./processBundle');
1414
const Promise = require('promise');
1515
const ReactPackager = require('../../../packager/react-packager');
@@ -25,7 +25,36 @@ function bundle(argv, config) {
2525
}
2626

2727
function _bundle(argv, config, resolve, reject) {
28-
const args = parseBundleCommandLine(argv);
28+
const args = parseCommandLine([
29+
{
30+
command: 'entry-file',
31+
description: 'Path to the root JS file, either absolute or relative to JS root',
32+
type: 'string',
33+
required: true,
34+
}, {
35+
command: 'platform',
36+
description: 'Either "ios" or "android"',
37+
type: 'string',
38+
required: true,
39+
}, {
40+
command: 'dev',
41+
description: 'If false, warnings are disabled and the bundle is minified',
42+
default: true,
43+
}, {
44+
command: 'bundle-output',
45+
description: 'File name where to store the resulting bundle, ex. /tmp/groups.bundle',
46+
type: 'string',
47+
required: true,
48+
}, {
49+
command: 'sourcemap-output',
50+
description: 'File name where to store the sourcemap file for resulting bundle, ex. /tmp/groups.map',
51+
type: 'string',
52+
}, {
53+
command: 'assets-dest',
54+
description: 'Directory name where to store assets referenced in the bundle',
55+
type: 'string',
56+
}
57+
], argv);
2958

3059
// This is used by a bazillion of npm modules we don't control so we don't
3160
// have other choice than defining it as an env variable here.

private-cli/src/bundle/parseBundleCommandLine.js

Lines changed: 0 additions & 44 deletions
This file was deleted.

private-cli/src/cli.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,16 @@ const hiddenCommands = {
2929
*/
3030
function run(command, commandArgs) {
3131
if (!command) {
32-
return Promise.reject(helpMessage());
32+
throw new Error(helpMessage());
3333
}
3434
commandArgs = commandArgs || [];
3535

3636
const commandToExec = documentedCommands[command] || hiddenCommands[command];
3737
if (!commandToExec) {
38-
return Promise.reject(helpMessage(command));
38+
throw new Error(helpMessage(command));
3939
}
4040

41-
return commandToExec(commandArgs, Config.get());
41+
commandToExec(commandArgs, Config.get()).done();
4242
}
4343

4444
function helpMessage(command) {
@@ -61,7 +61,4 @@ function help() {
6161
return Promise.resolve();
6262
}
6363

64-
module.exports = {
65-
run: run,
66-
commands: documentedCommands,
67-
};
64+
module.exports.run = run;

0 commit comments

Comments
 (0)