UNPKG

3.77 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('--sourceRoot [sourceRoot]', 'Points at the root of the source code for the single project in standard mode structures, or the default project in monorepo mode structures.')
27 .option('--entryFile [entryFile]', "Path to the entry file where this command will work with. Defaults to the one defined at your Nest's CLI config file.")
28 .option('-e, --exec [binary]', 'Binary to run (default: "node").')
29 .option('--preserveWatchOutput', 'Use "preserveWatchOutput" option when tsc watch mode.')
30 .description('Run Nest application.')
31 .action((app, command) => __awaiter(this, void 0, void 0, function* () {
32 const options = [];
33 options.push({
34 name: 'config',
35 value: command.config,
36 });
37 const isWebpackEnabled = command.tsc ? false : command.webpack;
38 options.push({ name: 'webpack', value: isWebpackEnabled });
39 options.push({ name: 'debug', value: command.debug });
40 options.push({ name: 'watch', value: !!command.watch });
41 options.push({ name: 'watchAssets', value: !!command.watchAssets });
42 options.push({
43 name: 'path',
44 value: command.path,
45 });
46 options.push({
47 name: 'webpackPath',
48 value: command.webpackPath,
49 });
50 options.push({
51 name: 'exec',
52 value: command.exec,
53 });
54 options.push({
55 name: 'sourceRoot',
56 value: command.sourceRoot,
57 });
58 options.push({
59 name: 'entryFile',
60 value: command.entryFile,
61 });
62 options.push({
63 name: 'preserveWatchOutput',
64 value: !!command.preserveWatchOutput &&
65 !!command.watch &&
66 !isWebpackEnabled,
67 });
68 const inputs = [];
69 inputs.push({ name: 'app', value: app });
70 yield this.action.handle(inputs, options);
71 }));
72 }
73}
74exports.StartCommand = StartCommand;