UNPKG

3.17 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 });
12exports.StartCommand = void 0;
13const abstract_command_1 = require("./abstract.command");
14class StartCommand extends abstract_command_1.AbstractCommand {
15 load(program) {
16 program
17 .command('start [app]')
18 .option('-c, --config [path]', 'Path to nest-cli configuration file.')
19 .option('-p, --path [path]', 'Path to tsconfig file.')
20 .option('-w, --watch', 'Run in watch mode (live-reload).')
21 .option('--watchAssets', 'Watch non-ts (e.g., .graphql) files mode.')
22 .option('-d, --debug [hostport] ', 'Run in debug mode (with --inspect flag).')
23 .option('--webpack', 'Use webpack for compilation.')
24 .option('--webpackPath [path]', 'Path to webpack configuration.')
25 .option('--tsc', 'Use tsc for compilation.')
26 .option('-e, --exec [binary]', 'Binary to run (default: "node").')
27 .option('--preserveWatchOutput', 'Use "preserveWatchOutput" option when tsc watch mode.')
28 .description('Run Nest application.')
29 .action((app, command) => __awaiter(this, void 0, void 0, function* () {
30 const options = [];
31 options.push({
32 name: 'config',
33 value: command.config,
34 });
35 const isWebpackEnabled = command.tsc ? false : command.webpack;
36 options.push({ name: 'webpack', value: isWebpackEnabled });
37 options.push({ name: 'debug', value: command.debug });
38 options.push({ name: 'watch', value: !!command.watch });
39 options.push({ name: 'watchAssets', value: !!command.watchAssets });
40 options.push({
41 name: 'path',
42 value: command.path,
43 });
44 options.push({
45 name: 'webpackPath',
46 value: command.webpackPath,
47 });
48 options.push({
49 name: 'exec',
50 value: command.exec,
51 });
52 options.push({
53 name: 'preserveWatchOutput',
54 value: !!command.preserveWatchOutput &&
55 !!command.watch &&
56 !isWebpackEnabled,
57 });
58 const inputs = [];
59 inputs.push({ name: 'app', value: app });
60 yield this.action.handle(inputs, options);
61 }));
62 }
63}
64exports.StartCommand = StartCommand;