UNPKG

2.36 kBJavaScriptView Raw
1"use strict";
2/**
3 * @license
4 * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
5 * This code may only be used under the BSD style license found at
6 * http://polymer.github.io/LICENSE.txt
7 * The complete set of authors may be found at
8 * http://polymer.github.io/AUTHORS.txt
9 * The complete set of contributors may be found at
10 * http://polymer.github.io/CONTRIBUTORS.txt
11 * Code distributed by Google as part of the polymer project is also
12 * subject to an additional IP rights grant found at
13 * http://polymer.github.io/PATENTS.txt
14 */
15var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
16 return new (P || (P = Promise))(function (resolve, reject) {
17 function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
18 function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
19 function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
20 step((generator = generator.apply(thisArg, _arguments || [])).next());
21 });
22};
23Object.defineProperty(exports, "__esModule", { value: true });
24// Be mindful of adding imports here, as this is on the hot path of all
25// commands.
26const logging = require("plylog");
27const updateNotifier = require("update-notifier");
28const polymer_cli_1 = require("./polymer-cli");
29const packageJson = require('../package.json');
30const logger = logging.getLogger('cli.main');
31// Update Notifier: Asynchronously check for package updates and, if needed,
32// notify on the next time the CLI is run.
33// See https://github.com/yeoman/update-notifier#how for info on how this works.
34updateNotifier({ pkg: packageJson }).notify();
35(() => __awaiter(this, void 0, void 0, function* () {
36 const args = process.argv.slice(2);
37 const cli = new polymer_cli_1.PolymerCli(args);
38 try {
39 const result = yield cli.run();
40 if (result && result.constructor &&
41 result.constructor.name === 'CommandResult') {
42 process.exit(result.exitCode);
43 }
44 }
45 catch (err) {
46 logger.error('cli runtime exception: ' + err);
47 if (err.stack) {
48 logger.error(err.stack);
49 }
50 process.exit(1);
51 }
52}))();
53//# sourceMappingURL=run.js.map
\No newline at end of file