UNPKG

1.71 kBJavaScriptView Raw
1"use strict";
2var __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};
10const cli_utils_1 = require("@ionic/cli-utils");
11const commands_1 = require("./commands");
12const chalk = require("chalk");
13function 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 // This module does not support v1 projects.
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}
26exports.run = run;
27function getAllCommandMetadata() {
28 const coreNamespace = new commands_1.CoreNamespace();
29 return cli_utils_1.getCommandMetadataList(coreNamespace);
30}
31exports.getAllCommandMetadata = getAllCommandMetadata;