1 | "use strict";
|
2 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3 | return new (P || (P = Promise))(function (resolve, reject) {
|
4 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
5 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
6 | function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
7 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
8 | });
|
9 | };
|
10 | const cli_utils_1 = require("@ionic/cli-utils");
|
11 | const commands_1 = require("./commands");
|
12 | const chalk = require("chalk");
|
13 | function run(pargv, env) {
|
14 | return __awaiter(this, void 0, void 0, function* () {
|
15 | const coreNamespace = new commands_1.CoreNamespace();
|
16 | const commandEnvironment = yield cli_utils_1.createCommandEnvironment(pargv, env, coreNamespace);
|
17 |
|
18 | let projectData = yield commandEnvironment.project.load();
|
19 | if (!projectData.v2) {
|
20 | throw new cli_utils_1.FatalException(`Ionic CLI v3 only supports Ionic2 projects. If you are currently working on v1 projects\n` +
|
21 | `then you should continue to use Ionic CLI v2 for now. ${chalk.bold('npm install -g ionic@2')}\n`);
|
22 | }
|
23 | yield cli_utils_1.runCommand(commandEnvironment);
|
24 | });
|
25 | }
|
26 | exports.run = run;
|
27 | function getAllCommandMetadata() {
|
28 | const coreNamespace = new commands_1.CoreNamespace();
|
29 | return cli_utils_1.getCommandMetadataList(coreNamespace);
|
30 | }
|
31 | exports.getAllCommandMetadata = getAllCommandMetadata;
|