1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | const cli_framework_1 = require("@ionic/cli-framework");
|
4 | const color_1 = require("../../lib/color");
|
5 | const base_1 = require("./base");
|
6 | class AddCommand extends base_1.CapacitorCommand {
|
7 | async getMetadata() {
|
8 | return {
|
9 | name: 'add',
|
10 | type: 'project',
|
11 | summary: 'Add a native platform to your Ionic project',
|
12 | description: `
|
13 | ${color_1.input('ionic capacitor add')} will do the following:
|
14 | - Add a new platform specific folder to your project (ios, android, or electron)
|
15 | `,
|
16 | inputs: [
|
17 | {
|
18 | name: 'platform',
|
19 | summary: `The platform to add (e.g. ${['android', 'ios', 'electron'].map(v => color_1.input(v)).join(', ')})`,
|
20 | validators: [cli_framework_1.validators.required],
|
21 | },
|
22 | ],
|
23 | groups: ["beta" ],
|
24 | };
|
25 | }
|
26 | async preRun(inputs, options, runinfo) {
|
27 | await this.preRunChecks(runinfo);
|
28 | if (!inputs[0]) {
|
29 | const platform = await this.env.prompt({
|
30 | type: 'list',
|
31 | name: 'platform',
|
32 | message: 'What platform would you like to add?',
|
33 | choices: ['android', 'ios', 'electron'],
|
34 | });
|
35 | inputs[0] = platform.trim();
|
36 | }
|
37 | }
|
38 | async run(inputs, options) {
|
39 | const [platform] = inputs;
|
40 | const args = ['add'];
|
41 | if (platform) {
|
42 | args.push(platform);
|
43 | }
|
44 | await this.runCapacitor(args);
|
45 | }
|
46 | }
|
47 | exports.AddCommand = AddCommand;
|