Skip to content

Commit

Permalink
BREAKING: metro: rename 'unbundle' to 'ram bundle'
Browse files Browse the repository at this point in the history
Summary:
@public

Let's get rid of the "unbundle" terminology and instead use "RAM bundle", short for "Random Access Bundle" format. THIS IS A BREAKING CHANGE FOR OSS, as the command becomes `ram-bundle` instead of `unbundle`. It realy shouldn't be a command to start with (only a "format" specifier for the `bundle` command), but I don't want to do that change at this point.

Reviewed By: davidaurelio

Differential Revision: D8894433

fbshipit-source-id: 5565f9ae94c7c2d7f6b25f95ae45b64f27f6aec8
  • Loading branch information
Jean Lauliac authored and facebook-github-bot committed Jul 20, 2018
1 parent 583cb13 commit ebf5aea
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 13 deletions.
34 changes: 34 additions & 0 deletions 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,
}),
};
23 changes: 10 additions & 13 deletions local-cli/bundle/unbundle.js
Expand Up @@ -9,25 +9,22 @@


'use strict'; 'use strict';


const bundleWithOutput = require('./bundle').withOutput;
const bundleCommandLineArgs = require('./bundleCommandLineArgs'); 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 = { module.exports = {
name: 'unbundle', name: 'unbundle',
description: 'builds javascript as "unbundle" for offline use', description: 'Deprecated. Renamed to `ram-bundle`.',
func: unbundle, 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({ options: bundleCommandLineArgs.concat({
command: '--indexed-unbundle', command: '--indexed-unbundle',
description: description: 'Deprecated. Renamed to `--indexed-ram-bundle`.',

This comment has been minimized.

Copy link
@grabbou

grabbou Jul 23, 2018

Contributor

Not sure I understand this - how's that renamed to a flag if the function is throwing an error in all the cases?

This comment has been minimized.

Copy link
@jeanlauliac

jeanlauliac Jul 30, 2018

It's just for the description generated by yargs, afaik? I want to make sure folks can see which is the new option name in addition to the command rename, whichever this shows up.

This comment has been minimized.

Copy link
@jeanlauliac

jeanlauliac Jul 30, 2018

I sent a change to rename in the docs as well, let me know what you think (facebook/react-native-website#477).

'Force indexed unbundle file format, even when building for android',
default: false, default: false,
}), }),
}; };
1 change: 1 addition & 0 deletions local-cli/commands.js
Expand Up @@ -42,6 +42,7 @@ const documentedCommands = [
require('./library/library'), require('./library/library'),
require('./bundle/bundle'), require('./bundle/bundle'),
require('./bundle/unbundle'), require('./bundle/unbundle'),
require('./bundle/ramBundle'),
require('./eject/eject'), require('./eject/eject'),
require('./link/link'), require('./link/link'),
require('./link/unlink'), require('./link/unlink'),
Expand Down

0 comments on commit ebf5aea

Please sign in to comment.