source: trip-planner-front/node_modules/@angular/cli/commands/doc-impl.js@ fa375fe

Last change on this file since fa375fe was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 3.0 KB
RevLine 
[6a3a178]1"use strict";
2/**
3 * @license
4 * Copyright Google LLC All Rights Reserved.
5 *
6 * Use of this source code is governed by an MIT-style license that can be
7 * found in the LICENSE file at https://angular.io/license
8 */
9var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10 if (k2 === undefined) k2 = k;
11 Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
12}) : (function(o, m, k, k2) {
13 if (k2 === undefined) k2 = k;
14 o[k2] = m[k];
15}));
16var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17 Object.defineProperty(o, "default", { enumerable: true, value: v });
18}) : function(o, v) {
19 o["default"] = v;
20});
21var __importStar = (this && this.__importStar) || function (mod) {
22 if (mod && mod.__esModule) return mod;
23 var result = {};
24 if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25 __setModuleDefault(result, mod);
26 return result;
27};
28var __importDefault = (this && this.__importDefault) || function (mod) {
29 return (mod && mod.__esModule) ? mod : { "default": mod };
30};
31Object.defineProperty(exports, "__esModule", { value: true });
32exports.DocCommand = void 0;
33const open_1 = __importDefault(require("open"));
34const command_1 = require("../models/command");
35class DocCommand extends command_1.Command {
36 async run(options) {
37 if (!options.keyword) {
38 this.logger.error('You should specify a keyword, for instance, `ng doc ActivatedRoute`.');
39 return 0;
40 }
41 let domain = 'angular.io';
42 if (options.version) {
43 // version can either be a string containing "next"
44 if (options.version == 'next') {
45 domain = 'next.angular.io';
46 // or a number where version must be a valid Angular version (i.e. not 0, 1 or 3)
47 }
48 else if (!isNaN(+options.version) && ![0, 1, 3].includes(+options.version)) {
49 domain = `v${options.version}.angular.io`;
50 }
51 else {
52 this.logger.error('Version should either be a number (2, 4, 5, 6...) or "next"');
53 return 0;
54 }
55 }
56 else {
57 // we try to get the current Angular version of the project
58 // and use it if we can find it
59 try {
60 /* eslint-disable-next-line import/no-extraneous-dependencies */
61 const currentNgVersion = (await Promise.resolve().then(() => __importStar(require('@angular/core')))).VERSION.major;
62 domain = `v${currentNgVersion}.angular.io`;
63 }
64 catch (e) { }
65 }
66 let searchUrl = `https://${domain}/api?query=${options.keyword}`;
67 if (options.search) {
68 searchUrl = `https://${domain}/docs?search=${options.keyword}`;
69 }
70 await open_1.default(searchUrl, {
71 wait: false,
72 });
73 }
74}
75exports.DocCommand = DocCommand;
Note: See TracBrowser for help on using the repository browser.