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:
committed by
Facebook GitHub Bot
parent
3ff2d3bf99
commit
105345facd
@@ -15,7 +15,7 @@ $ npm install -g flipper-pkg
|
|||||||
$ flipper-pkg COMMAND
|
$ flipper-pkg COMMAND
|
||||||
running command...
|
running command...
|
||||||
$ flipper-pkg (-v|--version|version)
|
$ 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]
|
$ flipper-pkg --help [COMMAND]
|
||||||
USAGE
|
USAGE
|
||||||
$ flipper-pkg COMMAND
|
$ flipper-pkg COMMAND
|
||||||
@@ -24,25 +24,8 @@ USAGE
|
|||||||
<!-- usagestop -->
|
<!-- usagestop -->
|
||||||
# Commands
|
# Commands
|
||||||
<!-- commands -->
|
<!-- commands -->
|
||||||
* [`flipper-pkg bundle DIRECTORY`](#flipper-pkg-bundle-directory)
|
|
||||||
* [`flipper-pkg help [COMMAND]`](#flipper-pkg-help-command)
|
* [`flipper-pkg help [COMMAND]`](#flipper-pkg-help-command)
|
||||||
|
* [`flipper-pkg pack DIRECTORY`](#flipper-pkg-pack-directory)
|
||||||
## `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 help [COMMAND]`
|
## `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)_
|
_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 -->
|
<!-- commandsstop -->
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -37,6 +37,7 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"reset": "rimraf lib *.tsbuildinfo",
|
"reset": "rimraf lib *.tsbuildinfo",
|
||||||
"build": "tsc -b",
|
"build": "tsc -b",
|
||||||
|
"readme": "oclif-dev readme",
|
||||||
"postpack": "rimraf oclif.manifest.json",
|
"postpack": "rimraf oclif.manifest.json",
|
||||||
"prepack": "yarn reset && yarn build && oclif-dev manifest && oclif-dev readme",
|
"prepack": "yarn reset && yarn build && oclif-dev manifest && oclif-dev readme",
|
||||||
"run": "yarn build && bin/run",
|
"run": "yarn build && bin/run",
|
||||||
|
|||||||
@@ -21,25 +21,25 @@ async function deriveOutputFileName(inputDirectory: string): Promise<string> {
|
|||||||
return `${packageJson.name || ''}-${packageJson.version}.tgz`;
|
return `${packageJson.name || ''}-${packageJson.version}.tgz`;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class Bundle extends Command {
|
export default class Pack extends Command {
|
||||||
public static description =
|
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 = {
|
public static flags = {
|
||||||
output: flags.string({
|
output: flags.string({
|
||||||
char: 'o',
|
char: 'o',
|
||||||
default: '.',
|
default: '.',
|
||||||
description:
|
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 static args = [{name: 'directory', required: true}];
|
||||||
|
|
||||||
public async run() {
|
public async run() {
|
||||||
const {args, flags: parsedFlags} = this.parse(Bundle);
|
const {args, flags: parsedFlags} = this.parse(Pack);
|
||||||
|
|
||||||
const stat = await fs.lstat(args.directory);
|
const stat = await fs.lstat(args.directory);
|
||||||
if (!stat.isDirectory()) {
|
if (!stat.isDirectory()) {
|
||||||
@@ -94,7 +94,7 @@ export default class Bundle extends Command {
|
|||||||
const inputDirectory = path.resolve(args.directory);
|
const inputDirectory = path.resolve(args.directory);
|
||||||
const outputFile = path.resolve(output);
|
const outputFile = path.resolve(output);
|
||||||
|
|
||||||
this.log(`⚙️ Bundling ${inputDirectory} to ${outputFile}...`);
|
this.log(`⚙️ Packing ${inputDirectory} to ${outputFile}...`);
|
||||||
|
|
||||||
cli.action.start('Installing dependencies');
|
cli.action.start('Installing dependencies');
|
||||||
await yarn.install(inputDirectory);
|
await yarn.install(inputDirectory);
|
||||||
@@ -114,6 +114,6 @@ export default class Bundle extends Command {
|
|||||||
await yarn.pack(inputDirectory, outputFile);
|
await yarn.pack(inputDirectory, outputFile);
|
||||||
cli.action.stop();
|
cli.action.stop();
|
||||||
|
|
||||||
this.log(`✅ Bundled ${inputDirectory} to ${outputFile}`);
|
this.log(`✅ Packed ${inputDirectory} to ${outputFile}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user