Rename command "bundle" to "pack"

Summary: Renamed command "bundle" to "pack" because the latter name better describe what the command does. Also I'm going to add another command which will only bundle the plugin code and it will be called "bundle" (see the next diff in this stack)

Reviewed By: mweststrate

Differential Revision: D21129690

fbshipit-source-id: 2dde30501c3776d6796c27c68d49948d1f84f822
This commit is contained in:
Anton Nikolaev
2020-04-20 11:10:27 -07:00
committed by Facebook GitHub Bot
parent 3ff2d3bf99
commit 105345facd
3 changed files with 27 additions and 26 deletions

View File

@@ -15,7 +15,7 @@ $ npm install -g flipper-pkg
$ flipper-pkg COMMAND
running command...
$ flipper-pkg (-v|--version|version)
flipper-pkg/0.35.0 darwin-x64 node-v12.15.0
flipper-pkg/0.37.0 darwin-x64 node-v12.15.0
$ flipper-pkg --help [COMMAND]
USAGE
$ flipper-pkg COMMAND
@@ -24,25 +24,8 @@ USAGE
<!-- usagestop -->
# Commands
<!-- commands -->
* [`flipper-pkg bundle DIRECTORY`](#flipper-pkg-bundle-directory)
* [`flipper-pkg help [COMMAND]`](#flipper-pkg-help-command)
## `flipper-pkg bundle DIRECTORY`
bundle a plugin folder into a distributable archive
```
USAGE
$ flipper-pkg bundle DIRECTORY
OPTIONS
-o, --output=output [default: .] Where to output the bundle, file or directory. Defaults to '.'.
EXAMPLE
$ flipper-pkg bundle path/to/plugin
```
_See code: [src/commands/bundle.ts](https://github.com/facebook/flipper/blob/v0.35.0/src/commands/bundle.ts)_
* [`flipper-pkg pack DIRECTORY`](#flipper-pkg-pack-directory)
## `flipper-pkg help [COMMAND]`
@@ -60,6 +43,23 @@ OPTIONS
```
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v2.2.3/src/commands/help.ts)_
## `flipper-pkg pack DIRECTORY`
packs a plugin folder into a distributable archive
```
USAGE
$ flipper-pkg pack DIRECTORY
OPTIONS
-o, --output=output [default: .] Where to output the package, file or directory. Defaults to '.'.
EXAMPLE
$ flipper-pkg pack path/to/plugin
```
_See code: [src/commands/pack.ts](https://github.com/facebook/flipper/blob/v0.37.0/src/commands/pack.ts)_
<!-- commandsstop -->

View File

@@ -37,6 +37,7 @@
"scripts": {
"reset": "rimraf lib *.tsbuildinfo",
"build": "tsc -b",
"readme": "oclif-dev readme",
"postpack": "rimraf oclif.manifest.json",
"prepack": "yarn reset && yarn build && oclif-dev manifest && oclif-dev readme",
"run": "yarn build && bin/run",

View File

@@ -21,25 +21,25 @@ async function deriveOutputFileName(inputDirectory: string): Promise<string> {
return `${packageJson.name || ''}-${packageJson.version}.tgz`;
}
export default class Bundle extends Command {
export default class Pack extends Command {
public static description =
'bundle a plugin folder into a distributable archive';
'packs a plugin folder into a distributable archive';
public static examples = [`$ flipper-pkg bundle path/to/plugin`];
public static examples = [`$ flipper-pkg pack path/to/plugin`];
public static flags = {
output: flags.string({
char: 'o',
default: '.',
description:
"Where to output the bundle, file or directory. Defaults to '.'.",
"Where to output the package, file or directory. Defaults to '.'.",
}),
};
public static args = [{name: 'directory', required: true}];
public async run() {
const {args, flags: parsedFlags} = this.parse(Bundle);
const {args, flags: parsedFlags} = this.parse(Pack);
const stat = await fs.lstat(args.directory);
if (!stat.isDirectory()) {
@@ -94,7 +94,7 @@ export default class Bundle extends Command {
const inputDirectory = path.resolve(args.directory);
const outputFile = path.resolve(output);
this.log(`⚙️ Bundling ${inputDirectory} to ${outputFile}...`);
this.log(`⚙️ Packing ${inputDirectory} to ${outputFile}...`);
cli.action.start('Installing dependencies');
await yarn.install(inputDirectory);
@@ -114,6 +114,6 @@ export default class Bundle extends Command {
await yarn.pack(inputDirectory, outputFile);
cli.action.stop();
this.log(`Bundled ${inputDirectory} to ${outputFile}`);
this.log(`Packed ${inputDirectory} to ${outputFile}`);
}
}