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