UNPKG

2.09 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};
10Object.defineProperty(exports, "__esModule", { value: true });
11const cli_utils_1 = require("@ionic/cli-utils");
12const commands_1 = require("./commands");
13exports.name = '@ionic/cli-plugin-cordova';
14exports.version = '1.3.0';
15exports.preferGlobal = false;
16exports.namespace = new commands_1.CordovaNamespace();
17exports.namespace.source = exports.name;
18function registerHooks(hooks) {
19 hooks.register(exports.name, 'command:info', () => __awaiter(this, void 0, void 0, function* () {
20 let cordovaPlatforms;
21 const cordovaVersion = yield cli_utils_1.getCommandInfo('cordova', ['-v']);
22 if (cordovaVersion) {
23 cordovaPlatforms = yield cli_utils_1.getCommandInfo('cordova', ['platform', 'ls']);
24 if (cordovaPlatforms) {
25 cordovaPlatforms = cordovaPlatforms.replace(/\s+/g, ' ');
26 cordovaPlatforms = cordovaPlatforms.replace('Installed platforms:', '');
27 cordovaPlatforms = cordovaPlatforms.replace(/Available platforms.+/, '');
28 cordovaPlatforms = cordovaPlatforms.trim();
29 }
30 }
31 return [
32 { type: 'global-packages', name: 'Cordova CLI', version: cordovaVersion || 'not installed' },
33 { type: 'local-packages', name: exports.name, version: exports.version },
34 { type: 'local-packages', name: 'Cordova Platforms', version: cordovaPlatforms || 'none' },
35 ];
36 }));
37}
38exports.registerHooks = registerHooks;