UNPKG

3.14 kBJavaScriptView Raw
1"use strict";
2var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3 function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4 return new (P || (P = Promise))(function (resolve, reject) {
5 function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6 function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7 function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8 step((generator = generator.apply(thisArg, _arguments || [])).next());
9 });
10};
11Object.defineProperty(exports, "__esModule", { value: true });
12const abstract_command_1 = require("./abstract.command");
13class StartCommand extends abstract_command_1.AbstractCommand {
14 load(program) {
15 program
16 .command('start [app]')
17 .option('-c, --config [path]', 'Path to nest-cli configuration file.')
18 .option('-p, --path [path]', 'Path to tsconfig file.')
19 .option('-w, --watch', 'Run in watch mode (live-reload).')
20 .option('--watchAssets', 'Watch non-ts (e.g., .graphql) files mode.')
21 .option('-d, --debug [hostport] ', 'Run in debug mode (with --inspect flag).')
22 .option('--webpack', 'Use webpack for compilation.')
23 .option('--webpackPath [path]', 'Path to webpack configuration.')
24 .option('--tsc', 'Use tsc for compilation.')
25 .option('-e, --exec [binary]', 'Binary to run (default: "node").')
26 .option('--preserveWatchOutput', 'Use "preserveWatchOutput" option when tsc watch mode.')
27 .description('Run Nest application.')
28 .action((app, command) => __awaiter(this, void 0, void 0, function* () {
29 const options = [];
30 options.push({
31 name: 'config',
32 value: command.config,
33 });
34 const isWebpackEnabled = command.tsc ? false : command.webpack;
35 options.push({ name: 'webpack', value: isWebpackEnabled });
36 options.push({ name: 'debug', value: command.debug });
37 options.push({ name: 'watch', value: !!command.watch });
38 options.push({ name: 'watchAssets', value: !!command.watchAssets });
39 options.push({
40 name: 'path',
41 value: command.path,
42 });
43 options.push({
44 name: 'webpackPath',
45 value: command.webpackPath,
46 });
47 options.push({
48 name: 'exec',
49 value: command.exec,
50 });
51 options.push({
52 name: 'preserveWatchOutput',
53 value: !!command.preserveWatchOutput &&
54 !!command.watch &&
55 !isWebpackEnabled,
56 });
57 const inputs = [];
58 inputs.push({ name: 'app', value: app });
59 yield this.action.handle(inputs, options);
60 }));
61 }
62}
63exports.StartCommand = StartCommand;