1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | const command_1 = require("@anycli/command");
|
4 | const cli_ux_1 = require("cli-ux");
|
5 | const fs = require("fs-extra");
|
6 | const path = require("path");
|
7 | class Manifest extends command_1.Command {
|
8 | constructor() {
|
9 | super(...arguments);
|
10 | this.options = command_1.parse(this.argv, Manifest);
|
11 | }
|
12 | async run() {
|
13 | const root = path.resolve(this.options.args.path);
|
14 | const plugin = await this.config.engine.loadPlugin({ root, type: 'dev' });
|
15 | if (!plugin)
|
16 | throw new Error(`${this.config.name} plugin not found`);
|
17 | if (process.env.ANYCLI_NEXT_VERSION) {
|
18 | plugin.manifest.version = process.env.ANYCLI_NEXT_VERSION;
|
19 | }
|
20 | if (this.options.flags.out) {
|
21 | await fs.outputJSON(this.options.flags.out, plugin);
|
22 | }
|
23 | else {
|
24 | cli_ux_1.default.styledJSON(plugin.manifest);
|
25 | }
|
26 | }
|
27 | }
|
28 | Manifest.title = 'generates plugin manifest json';
|
29 | Manifest.flags = {
|
30 | out: command_1.flags.string({ char: 'o', description: 'output to file at path' }),
|
31 | };
|
32 | Manifest.args = [
|
33 | { name: 'path', description: 'path to plugin', default: '.' }
|
34 | ];
|
35 | exports.default = Manifest;
|