diff --git a/local-cli/bundle/ramBundle.js b/local-cli/bundle/ramBundle.js new file mode 100644 index 00000000000000..1d85ba3c4c3292 --- /dev/null +++ b/local-cli/bundle/ramBundle.js @@ -0,0 +1,34 @@ +/** + * Copyright (c) 2015-present, Facebook, Inc. + * + * 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 bundleWithOutput = require('./bundle').withOutput; +const bundleCommandLineArgs = require('./bundleCommandLineArgs'); +const outputUnbundle = require('metro/src/shared/output/unbundle'); + +/** + * Builds the bundle starting to look for dependencies at the given entry path. + */ +function ramBundle(argv, config, args) { + return bundleWithOutput(argv, config, args, outputUnbundle); +} + +module.exports = { + name: 'ram-bundle', + description: + 'builds javascript as a "Random Access Module" bundle for offline use', + func: ramBundle, + options: bundleCommandLineArgs.concat({ + command: '--indexed-ram-bundle', + description: + 'Force the "Indexed RAM" bundle file format, even when building for android', + default: false, + }), +}; diff --git a/local-cli/bundle/unbundle.js b/local-cli/bundle/unbundle.js index da4a4f70d6a8e5..dfc7fa2483b1ac 100644 --- a/local-cli/bundle/unbundle.js +++ b/local-cli/bundle/unbundle.js @@ -9,25 +9,22 @@ 'use strict'; -const bundleWithOutput = require('./bundle').withOutput; const bundleCommandLineArgs = require('./bundleCommandLineArgs'); -const outputUnbundle = require('metro/src/shared/output/unbundle'); - -/** - * Builds the bundle starting to look for dependencies at the given entry path. - */ -function unbundle(argv, config, args) { - return bundleWithOutput(argv, config, args, outputUnbundle); -} module.exports = { name: 'unbundle', - description: 'builds javascript as "unbundle" for offline use', - func: unbundle, + description: 'Deprecated. Renamed to `ram-bundle`.', + func: () => { + throw new Error( + 'The `unbundle` command has been renamed `ram-bundle` to better ' + + 'represent the actual functionality. `ram` mean "Random Access ' + + 'Module", this particular format of bundle. Functionality remained ' + + 'unchanged.', + ); + }, options: bundleCommandLineArgs.concat({ command: '--indexed-unbundle', - description: - 'Force indexed unbundle file format, even when building for android', + description: 'Deprecated. Renamed to `--indexed-ram-bundle`.', default: false, }), }; diff --git a/local-cli/commands.js b/local-cli/commands.js index f75207bd3bc5cb..2a704aa5d4465f 100644 --- a/local-cli/commands.js +++ b/local-cli/commands.js @@ -42,6 +42,7 @@ const documentedCommands = [ require('./library/library'), require('./bundle/bundle'), require('./bundle/unbundle'), + require('./bundle/ramBundle'), require('./eject/eject'), require('./link/link'), require('./link/unlink'),