UNPKG

1.24 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3const command_1 = require("@anycli/command");
4const cli_ux_1 = require("cli-ux");
5const fs = require("fs-extra");
6const path = require("path");
7class 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}
28Manifest.title = 'generates plugin manifest json';
29Manifest.flags = {
30 out: command_1.flags.string({ char: 'o', description: 'output to file at path' }),
31};
32Manifest.args = [
33 { name: 'path', description: 'path to plugin', default: '.' }
34];
35exports.default = Manifest;