UNPKG

2.47 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 BuildCommand extends abstract_command_1.AbstractCommand {
14 load(program) {
15 program
16 .command('build [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('--webpack', 'Use webpack for compilation.')
22 .option('--webpackPath [path]', 'Path to webpack configuration.')
23 .option('--tsc', 'Use tsc for compilation.')
24 .description('Build Nest application.')
25 .action((app, command) => __awaiter(this, void 0, void 0, function* () {
26 const options = [];
27 options.push({
28 name: 'config',
29 value: command.config,
30 });
31 const isWebpackEnabled = command.tsc ? false : command.webpack;
32 options.push({ name: 'webpack', value: isWebpackEnabled });
33 options.push({ name: 'watch', value: !!command.watch });
34 options.push({ name: 'watchAssets', value: !!command.watchAssets });
35 options.push({
36 name: 'path',
37 value: command.path,
38 });
39 options.push({
40 name: 'webpackPath',
41 value: command.webpackPath,
42 });
43 const inputs = [];
44 inputs.push({ name: 'app', value: app });
45 yield this.action.handle(inputs, options);
46 }));
47 }
48}
49exports.BuildCommand = BuildCommand;