Bundle command

Summary:
Command which transpiles and bundles plugin code.

It is supposed to be used in "prepack" script for all open-sourced plugin packages to bundle them before publishing like this:
```
{
  "devDependencies": {
    "flipper-pkg": "latest"
  },
  "scripts": {
    "prepack": "flipper-pkg bundle"
  }
}
```

Also made directory parameter of other command "pack" optional so it also can be called from plugin directory simply by `flipper-pkg pack`.

Changelog: "flipper-pkg bundle" command for bundling plugins before publishing.

Reviewed By: mweststrate

Differential Revision: D21129691

fbshipit-source-id: 8f97bc950c28cf9ad8b0117c0e1d811ed1b988eb
This commit is contained in:
Anton Nikolaev
2020-04-20 11:10:27 -07:00
committed by Facebook GitHub Bot
parent 105345facd
commit 1491e111c9
3 changed files with 86 additions and 6 deletions

View File

@@ -8,6 +8,7 @@
*/
import {Command, flags} from '@oclif/command';
import {args} from '@oclif/parser';
import {promises as fs} from 'fs';
import {mkdirp, pathExists, readJSON, ensureDir} from 'fs-extra';
import * as inquirer from 'inquirer';
@@ -32,11 +33,19 @@ export default class Pack extends Command {
char: 'o',
default: '.',
description:
"Where to output the package, file or directory. Defaults to '.'.",
'Where to output the package, file or directory. Defaults to the current working directory.',
}),
};
public static args = [{name: 'directory', required: true}];
public static args: args.IArg[] = [
{
name: 'directory',
required: false,
default: '.',
description:
'Path to plugin package directory to pack. Defaults to the current working directory.',
},
];
public async run() {
const {args, flags: parsedFlags} = this.parse(Pack);