@nestjs/cli 7.5.0 → 7.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/actions/abstract.action.js +1 -0
- package/actions/add.action.js +4 -3
- package/actions/build.action.js +7 -5
- package/actions/generate.action.js +7 -7
- package/actions/index.js +18 -11
- package/actions/info.action.js +4 -3
- package/actions/new.action.js +9 -8
- package/actions/start.action.js +7 -6
- package/actions/update.action.js +3 -2
- package/commands/abstract.command.js +1 -0
- package/commands/add.command.js +1 -0
- package/commands/build.command.js +1 -0
- package/commands/command.loader.js +1 -0
- package/commands/generate.command.js +8 -2
- package/commands/index.js +12 -4
- package/commands/info.command.js +1 -0
- package/commands/new.command.js +1 -0
- package/commands/start.command.js +1 -0
- package/commands/update.command.js +1 -0
- package/lib/compiler/assets-manager.js +3 -2
- package/lib/compiler/compiler.js +4 -3
- package/lib/compiler/defaults/webpack-defaults.js +1 -0
- package/lib/compiler/helpers/append-extension.js +1 -0
- package/lib/compiler/helpers/copy-path-resolve.js +2 -4
- package/lib/compiler/helpers/get-value-or-default.js +2 -1
- package/lib/compiler/helpers/tsconfig-provider.js +1 -0
- package/lib/compiler/hooks/tsconfig-paths.hook.js +12 -0
- package/lib/compiler/plugins-loader.js +11 -2
- package/lib/compiler/typescript-loader.d.ts +0 -1
- package/lib/compiler/typescript-loader.js +10 -26
- package/lib/compiler/watch-compiler.js +3 -2
- package/lib/compiler/webpack-compiler.d.ts +1 -1
- package/lib/compiler/webpack-compiler.js +8 -1
- package/lib/compiler/workspace-utils.js +2 -1
- package/lib/configuration/defaults.js +1 -0
- package/lib/configuration/index.js +13 -4
- package/lib/configuration/nest-configuration.loader.js +1 -0
- package/lib/dependency-managers/index.js +11 -4
- package/lib/dependency-managers/nest.dependency-manager.js +3 -2
- package/lib/package-managers/abstract.package-manager.d.ts +2 -2
- package/lib/package-managers/abstract.package-manager.js +5 -4
- package/lib/package-managers/index.js +17 -8
- package/lib/package-managers/npm.package-manager.d.ts +2 -2
- package/lib/package-managers/npm.package-manager.js +1 -0
- package/lib/package-managers/package-manager.factory.js +3 -2
- package/lib/package-managers/package-manager.js +1 -0
- package/lib/package-managers/yarn.package-manager.d.ts +2 -2
- package/lib/package-managers/yarn.package-manager.js +1 -0
- package/lib/questions/questions.js +1 -0
- package/lib/readers/file-system.reader.js +1 -0
- package/lib/readers/index.js +12 -4
- package/lib/runners/abstract.runner.d.ts +2 -1
- package/lib/runners/abstract.runner.js +6 -4
- package/lib/runners/git.runner.js +1 -0
- package/lib/runners/index.js +13 -6
- package/lib/runners/npm.runner.js +1 -0
- package/lib/runners/runner.factory.js +1 -0
- package/lib/runners/runner.js +1 -0
- package/lib/runners/schematic.runner.js +7 -10
- package/lib/runners/yarn.runner.js +1 -0
- package/lib/schematics/abstract.collection.js +1 -0
- package/lib/schematics/collection.factory.js +1 -0
- package/lib/schematics/collection.js +1 -0
- package/lib/schematics/custom.collection.js +1 -0
- package/lib/schematics/index.js +14 -7
- package/lib/schematics/nest.collection.d.ts +1 -0
- package/lib/schematics/nest.collection.js +101 -20
- package/lib/schematics/schematic.option.js +1 -0
- package/lib/ui/banner.js +1 -0
- package/lib/ui/emojis.js +1 -0
- package/lib/ui/errors.js +1 -0
- package/lib/ui/index.js +15 -8
- package/lib/ui/messages.js +1 -0
- package/lib/ui/prefixes.js +1 -0
- package/lib/utils/is-error.js +1 -0
- package/lib/utils/load-configuration.js +1 -0
- package/lib/utils/local-binaries.js +1 -0
- package/lib/utils/project-utils.js +2 -1
- package/lib/utils/remaining-flags.js +1 -0
- package/package.json +26 -25
package/actions/add.action.js
CHANGED
|
@@ -9,6 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.AddAction = void 0;
|
|
12
13
|
const chalk = require("chalk");
|
|
13
14
|
const get_value_or_default_1 = require("../lib/compiler/helpers/get-value-or-default");
|
|
14
15
|
const package_managers_1 = require("../lib/package-managers");
|
|
@@ -40,7 +41,7 @@ class AddAction extends abstract_action_1.AbstractAction {
|
|
|
40
41
|
return __awaiter(this, void 0, void 0, function* () {
|
|
41
42
|
const configuration = yield load_configuration_1.loadConfiguration();
|
|
42
43
|
const configurationProjects = configuration.projects;
|
|
43
|
-
const appName = inputs.find(option => option.name === 'project')
|
|
44
|
+
const appName = inputs.find((option) => option.name === 'project')
|
|
44
45
|
.value;
|
|
45
46
|
let sourceRoot = appName
|
|
46
47
|
? get_value_or_default_1.getValueOrDefault(configuration, 'sourceRoot', appName)
|
|
@@ -86,7 +87,7 @@ class AddAction extends abstract_action_1.AbstractAction {
|
|
|
86
87
|
return __awaiter(this, void 0, void 0, function* () {
|
|
87
88
|
console.info(ui_1.MESSAGES.LIBRARY_INSTALLATION_STARTS);
|
|
88
89
|
const schematicOptions = [];
|
|
89
|
-
schematicOptions.push(new schematics_1.SchematicOption('sourceRoot', options.find(option => option.name === 'sourceRoot').value));
|
|
90
|
+
schematicOptions.push(new schematics_1.SchematicOption('sourceRoot', options.find((option) => option.name === 'sourceRoot').value));
|
|
90
91
|
const extraFlagsString = extraFlags ? extraFlags.join(' ') : undefined;
|
|
91
92
|
try {
|
|
92
93
|
const collection = schematics_1.CollectionFactory.create(collectionName);
|
|
@@ -101,7 +102,7 @@ class AddAction extends abstract_action_1.AbstractAction {
|
|
|
101
102
|
});
|
|
102
103
|
}
|
|
103
104
|
getLibraryName(inputs) {
|
|
104
|
-
const libraryInput = inputs.find(input => input.name === 'library');
|
|
105
|
+
const libraryInput = inputs.find((input) => input.name === 'library');
|
|
105
106
|
if (!libraryInput) {
|
|
106
107
|
throw new Error('No library found in command input');
|
|
107
108
|
}
|
package/actions/build.action.js
CHANGED
|
@@ -9,6 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.BuildAction = void 0;
|
|
12
13
|
const chalk = require("chalk");
|
|
13
14
|
const path_1 = require("path");
|
|
14
15
|
const assets_manager_1 = require("../lib/compiler/assets-manager");
|
|
@@ -42,9 +43,9 @@ class BuildAction extends abstract_action_1.AbstractAction {
|
|
|
42
43
|
handle(inputs, options) {
|
|
43
44
|
return __awaiter(this, void 0, void 0, function* () {
|
|
44
45
|
try {
|
|
45
|
-
const watchModeOption = options.find(option => option.name === 'watch');
|
|
46
|
+
const watchModeOption = options.find((option) => option.name === 'watch');
|
|
46
47
|
const watchMode = !!(watchModeOption && watchModeOption.value);
|
|
47
|
-
const watchAssetsModeOption = options.find(option => option.name === 'watchAssets');
|
|
48
|
+
const watchAssetsModeOption = options.find((option) => option.name === 'watchAssets');
|
|
48
49
|
const watchAssetsMode = !!(watchAssetsModeOption && watchAssetsModeOption.value);
|
|
49
50
|
yield this.runBuild(inputs, options, watchMode, watchAssetsMode);
|
|
50
51
|
}
|
|
@@ -60,10 +61,11 @@ class BuildAction extends abstract_action_1.AbstractAction {
|
|
|
60
61
|
}
|
|
61
62
|
runBuild(inputs, options, watchMode, watchAssetsMode, isDebugEnabled = false, onSuccess) {
|
|
62
63
|
return __awaiter(this, void 0, void 0, function* () {
|
|
63
|
-
const configFileName = options.find(option => option.name === 'config')
|
|
64
|
+
const configFileName = options.find((option) => option.name === 'config')
|
|
64
65
|
.value;
|
|
65
66
|
const configuration = yield this.loader.load(configFileName);
|
|
66
|
-
const appName = inputs.find(input => input.name === 'app')
|
|
67
|
+
const appName = inputs.find((input) => input.name === 'app')
|
|
68
|
+
.value;
|
|
67
69
|
const pathToTsconfig = get_value_or_default_1.getValueOrDefault(configuration, 'compilerOptions.tsConfigPath', appName, 'path', options);
|
|
68
70
|
const { options: tsOptions } = this.tsConfigProvider.getByConfigFilename(pathToTsconfig);
|
|
69
71
|
const outDir = tsOptions.outDir || defaults_1.defaultOutDir;
|
|
@@ -77,7 +79,7 @@ class BuildAction extends abstract_action_1.AbstractAction {
|
|
|
77
79
|
}
|
|
78
80
|
if (watchMode) {
|
|
79
81
|
const tsCompilerOptions = {};
|
|
80
|
-
const isPreserveWatchOutputEnabled = options.find(option => option.name === 'preserveWatchOutput' && option.value === true);
|
|
82
|
+
const isPreserveWatchOutputEnabled = options.find((option) => option.name === 'preserveWatchOutput' && option.value === true);
|
|
81
83
|
if (isPreserveWatchOutputEnabled) {
|
|
82
84
|
tsCompilerOptions.preserveWatchOutput = true;
|
|
83
85
|
}
|
|
@@ -9,6 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.GenerateAction = void 0;
|
|
12
13
|
const chalk = require("chalk");
|
|
13
14
|
const get_value_or_default_1 = require("../lib/compiler/helpers/get-value-or-default");
|
|
14
15
|
const schematics_1 = require("../lib/schematics");
|
|
@@ -26,13 +27,12 @@ class GenerateAction extends abstract_action_1.AbstractAction {
|
|
|
26
27
|
exports.GenerateAction = GenerateAction;
|
|
27
28
|
const generateFiles = (inputs) => __awaiter(void 0, void 0, void 0, function* () {
|
|
28
29
|
const configuration = yield load_configuration_1.loadConfiguration();
|
|
29
|
-
const collectionOption = inputs.find(option => option.name === 'collection')
|
|
30
|
+
const collectionOption = inputs.find((option) => option.name === 'collection').value;
|
|
31
|
+
const schematic = inputs.find((option) => option.name === 'schematic')
|
|
30
32
|
.value;
|
|
31
|
-
const
|
|
33
|
+
const appName = inputs.find((option) => option.name === 'project')
|
|
32
34
|
.value;
|
|
33
|
-
const
|
|
34
|
-
.value;
|
|
35
|
-
const spec = inputs.find(option => option.name === 'spec');
|
|
35
|
+
const spec = inputs.find((option) => option.name === 'spec');
|
|
36
36
|
const collection = schematics_1.CollectionFactory.create(collectionOption || configuration.collection);
|
|
37
37
|
const schematicOptions = mapSchematicOptions(inputs);
|
|
38
38
|
schematicOptions.push(new schematics_1.SchematicOption('language', configuration.language));
|
|
@@ -68,7 +68,7 @@ const generateFiles = (inputs) => __awaiter(void 0, void 0, void 0, function* ()
|
|
|
68
68
|
schematicOptions.push(new schematics_1.SchematicOption('sourceRoot', sourceRoot));
|
|
69
69
|
schematicOptions.push(new schematics_1.SchematicOption('spec', generateSpec));
|
|
70
70
|
try {
|
|
71
|
-
const schematicInput = inputs.find(input => input.name === 'schematic');
|
|
71
|
+
const schematicInput = inputs.find((input) => input.name === 'schematic');
|
|
72
72
|
if (!schematicInput) {
|
|
73
73
|
throw new Error('Unable to find a schematic for this configuration');
|
|
74
74
|
}
|
|
@@ -83,7 +83,7 @@ const generateFiles = (inputs) => __awaiter(void 0, void 0, void 0, function* ()
|
|
|
83
83
|
const mapSchematicOptions = (inputs) => {
|
|
84
84
|
const excludedInputNames = ['schematic', 'spec'];
|
|
85
85
|
const options = [];
|
|
86
|
-
inputs.forEach(input => {
|
|
86
|
+
inputs.forEach((input) => {
|
|
87
87
|
if (!excludedInputNames.includes(input.name) && input.value !== undefined) {
|
|
88
88
|
options.push(new schematics_1.SchematicOption(input.name, input.value));
|
|
89
89
|
}
|
package/actions/index.js
CHANGED
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
function
|
|
3
|
-
|
|
4
|
-
}
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
5
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
__exportStar(require("./abstract.action"), exports);
|
|
14
|
+
__exportStar(require("./build.action"), exports);
|
|
15
|
+
__exportStar(require("./generate.action"), exports);
|
|
16
|
+
__exportStar(require("./info.action"), exports);
|
|
17
|
+
__exportStar(require("./new.action"), exports);
|
|
18
|
+
__exportStar(require("./update.action"), exports);
|
|
19
|
+
__exportStar(require("./start.action"), exports);
|
|
20
|
+
__exportStar(require("./add.action"), exports);
|
package/actions/info.action.js
CHANGED
|
@@ -9,6 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.InfoAction = void 0;
|
|
12
13
|
const chalk = require("chalk");
|
|
13
14
|
const fs_1 = require("fs");
|
|
14
15
|
const os_1 = require("os");
|
|
@@ -74,7 +75,7 @@ const readProjectPackageJsonDependencies = () => __awaiter(void 0, void 0, void
|
|
|
74
75
|
});
|
|
75
76
|
});
|
|
76
77
|
const displayNestVersions = (dependencies) => {
|
|
77
|
-
buildNestVersionsMessage(dependencies).forEach(dependency => console.info(dependency.name, chalk.blue(dependency.value)));
|
|
78
|
+
buildNestVersionsMessage(dependencies).forEach((dependency) => console.info(dependency.name, chalk.blue(dependency.value)));
|
|
78
79
|
};
|
|
79
80
|
const buildNestVersionsMessage = (dependencies) => {
|
|
80
81
|
const nestDependencies = collectNestDependencies(dependencies);
|
|
@@ -82,7 +83,7 @@ const buildNestVersionsMessage = (dependencies) => {
|
|
|
82
83
|
};
|
|
83
84
|
const collectNestDependencies = (dependencies) => {
|
|
84
85
|
const nestDependencies = [];
|
|
85
|
-
Object.keys(dependencies).forEach(key => {
|
|
86
|
+
Object.keys(dependencies).forEach((key) => {
|
|
86
87
|
if (key.indexOf('@nestjs') > -1) {
|
|
87
88
|
nestDependencies.push({
|
|
88
89
|
name: `${key.replace(/@nestjs\//, '')} version`,
|
|
@@ -95,7 +96,7 @@ const collectNestDependencies = (dependencies) => {
|
|
|
95
96
|
const format = (dependencies) => {
|
|
96
97
|
const sorted = dependencies.sort((dependencyA, dependencyB) => dependencyB.name.length - dependencyA.name.length);
|
|
97
98
|
const length = sorted[0].name.length;
|
|
98
|
-
sorted.forEach(dependency => {
|
|
99
|
+
sorted.forEach((dependency) => {
|
|
99
100
|
if (dependency.name.length < length) {
|
|
100
101
|
dependency.name = rightPad(dependency.name, length);
|
|
101
102
|
}
|
package/actions/new.action.js
CHANGED
|
@@ -9,6 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.exit = exports.retrieveCols = exports.NewAction = void 0;
|
|
12
13
|
const strings_1 = require("@angular-devkit/core/src/utils/strings");
|
|
13
14
|
const chalk = require("chalk");
|
|
14
15
|
const child_process_1 = require("child_process");
|
|
@@ -26,13 +27,13 @@ const abstract_action_1 = require("./abstract.action");
|
|
|
26
27
|
class NewAction extends abstract_action_1.AbstractAction {
|
|
27
28
|
handle(inputs, options) {
|
|
28
29
|
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
-
const directoryOption = options.find(option => option.name === 'directory');
|
|
30
|
-
const dryRunOption = options.find(option => option.name === 'dry-run');
|
|
30
|
+
const directoryOption = options.find((option) => option.name === 'directory');
|
|
31
|
+
const dryRunOption = options.find((option) => option.name === 'dry-run');
|
|
31
32
|
const isDryRunEnabled = dryRunOption && dryRunOption.value;
|
|
32
33
|
yield askForMissingInformation(inputs);
|
|
33
34
|
yield generateApplicationFiles(inputs, options).catch(exports.exit);
|
|
34
|
-
const shouldSkipInstall = options.some(option => option.name === 'skip-install' && option.value === true);
|
|
35
|
-
const shouldSkipGit = options.some(option => option.name === 'skip-git' && option.value === true);
|
|
35
|
+
const shouldSkipInstall = options.some((option) => option.name === 'skip-install' && option.value === true);
|
|
36
|
+
const shouldSkipGit = options.some((option) => option.name === 'skip-git' && option.value === true);
|
|
36
37
|
const projectDirectory = getProjectDirectory(getApplicationNameInput(inputs), directoryOption);
|
|
37
38
|
if (!shouldSkipInstall) {
|
|
38
39
|
yield installPackages(options, isDryRunEnabled, projectDirectory);
|
|
@@ -49,7 +50,7 @@ class NewAction extends abstract_action_1.AbstractAction {
|
|
|
49
50
|
}
|
|
50
51
|
}
|
|
51
52
|
exports.NewAction = NewAction;
|
|
52
|
-
const getApplicationNameInput = (inputs) => inputs.find(input => input.name === 'name');
|
|
53
|
+
const getApplicationNameInput = (inputs) => inputs.find((input) => input.name === 'name');
|
|
53
54
|
const getProjectDirectory = (applicationName, directoryOption) => {
|
|
54
55
|
return ((directoryOption && directoryOption.value) ||
|
|
55
56
|
strings_1.dasherize(applicationName.value));
|
|
@@ -67,11 +68,11 @@ const askForMissingInformation = (inputs) => __awaiter(void 0, void 0, void 0, f
|
|
|
67
68
|
}
|
|
68
69
|
});
|
|
69
70
|
const replaceInputMissingInformation = (inputs, answers) => {
|
|
70
|
-
return inputs.map(input => (input.value =
|
|
71
|
+
return inputs.map((input) => (input.value =
|
|
71
72
|
input.value !== undefined ? input.value : answers[input.name]));
|
|
72
73
|
};
|
|
73
74
|
const generateApplicationFiles = (args, options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
74
|
-
const collectionName = options.find(option => option.name === 'collection' && option.value != null).value;
|
|
75
|
+
const collectionName = options.find((option) => option.name === 'collection' && option.value != null).value;
|
|
75
76
|
const collection = schematics_1.CollectionFactory.create(collectionName || schematics_1.Collection.NESTJS);
|
|
76
77
|
const schematicOptions = mapSchematicOptions(args.concat(options));
|
|
77
78
|
yield collection.execute('application', schematicOptions);
|
|
@@ -87,7 +88,7 @@ const mapSchematicOptions = (options) => {
|
|
|
87
88
|
}, []);
|
|
88
89
|
};
|
|
89
90
|
const installPackages = (options, dryRunMode, installDirectory) => __awaiter(void 0, void 0, void 0, function* () {
|
|
90
|
-
const inputPackageManager = options.find(option => option.name === 'package-manager').value;
|
|
91
|
+
const inputPackageManager = options.find((option) => option.name === 'package-manager').value;
|
|
91
92
|
let packageManager;
|
|
92
93
|
if (dryRunMode) {
|
|
93
94
|
console.info();
|
package/actions/start.action.js
CHANGED
|
@@ -9,6 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.StartAction = void 0;
|
|
12
13
|
const chalk = require("chalk");
|
|
13
14
|
const child_process_1 = require("child_process");
|
|
14
15
|
const fs = require("fs");
|
|
@@ -22,17 +23,17 @@ class StartAction extends build_action_1.BuildAction {
|
|
|
22
23
|
handle(inputs, options) {
|
|
23
24
|
return __awaiter(this, void 0, void 0, function* () {
|
|
24
25
|
try {
|
|
25
|
-
const configFileName = options.find(option => option.name === 'config')
|
|
26
|
+
const configFileName = options.find((option) => option.name === 'config')
|
|
26
27
|
.value;
|
|
27
28
|
const configuration = yield this.loader.load(configFileName);
|
|
28
|
-
const appName = inputs.find(input => input.name === 'app')
|
|
29
|
+
const appName = inputs.find((input) => input.name === 'app')
|
|
29
30
|
.value;
|
|
30
31
|
const pathToTsconfig = get_value_or_default_1.getValueOrDefault(configuration, 'compilerOptions.tsConfigPath', appName, 'path', options);
|
|
31
|
-
const binaryToRunOption = options.find(option => option.name === 'exec');
|
|
32
|
-
const debugModeOption = options.find(option => option.name === 'debug');
|
|
33
|
-
const watchModeOption = options.find(option => option.name === 'watch');
|
|
32
|
+
const binaryToRunOption = options.find((option) => option.name === 'exec');
|
|
33
|
+
const debugModeOption = options.find((option) => option.name === 'debug');
|
|
34
|
+
const watchModeOption = options.find((option) => option.name === 'watch');
|
|
34
35
|
const isWatchEnabled = !!(watchModeOption && watchModeOption.value);
|
|
35
|
-
const watchAssetsModeOption = options.find(option => option.name === 'watchAssets');
|
|
36
|
+
const watchAssetsModeOption = options.find((option) => option.name === 'watchAssets');
|
|
36
37
|
const isWatchAssetsEnabled = !!(watchAssetsModeOption && watchAssetsModeOption.value);
|
|
37
38
|
const debugFlag = debugModeOption && debugModeOption.value;
|
|
38
39
|
const binaryToRun = binaryToRunOption && binaryToRunOption.value;
|
package/actions/update.action.js
CHANGED
|
@@ -9,14 +9,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.UpdateAction = void 0;
|
|
12
13
|
const dependency_managers_1 = require("../lib/dependency-managers");
|
|
13
14
|
const package_managers_1 = require("../lib/package-managers");
|
|
14
15
|
const abstract_action_1 = require("./abstract.action");
|
|
15
16
|
class UpdateAction extends abstract_action_1.AbstractAction {
|
|
16
17
|
handle(inputs, options) {
|
|
17
18
|
return __awaiter(this, void 0, void 0, function* () {
|
|
18
|
-
const force = options.find(option => option.name === 'force');
|
|
19
|
-
const tag = options.find(option => option.name === 'tag');
|
|
19
|
+
const force = options.find((option) => option.name === 'force');
|
|
20
|
+
const tag = options.find((option) => option.name === 'tag');
|
|
20
21
|
const manager = new dependency_managers_1.NestDependencyManager(yield package_managers_1.PackageManagerFactory.find());
|
|
21
22
|
yield manager.update(force.value, tag.value);
|
|
22
23
|
});
|
package/commands/add.command.js
CHANGED
|
@@ -9,6 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.AddCommand = void 0;
|
|
12
13
|
const remaining_flags_1 = require("../lib/utils/remaining-flags");
|
|
13
14
|
const abstract_command_1 = require("./abstract.command");
|
|
14
15
|
class AddCommand extends abstract_command_1.AbstractCommand {
|
|
@@ -9,6 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.BuildCommand = void 0;
|
|
12
13
|
const abstract_command_1 = require("./abstract.command");
|
|
13
14
|
class BuildCommand extends abstract_command_1.AbstractCommand {
|
|
14
15
|
load(program) {
|
|
@@ -9,6 +9,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.GenerateCommand = void 0;
|
|
13
|
+
const chalk = require("chalk");
|
|
12
14
|
const Table = require("cli-table3");
|
|
13
15
|
const schematics_1 = require("../lib/schematics");
|
|
14
16
|
const nest_collection_1 = require("../lib/schematics/nest.collection");
|
|
@@ -67,7 +69,7 @@ class GenerateCommand extends abstract_command_1.AbstractCommand {
|
|
|
67
69
|
buildSchematicsListAsTable() {
|
|
68
70
|
const leftMargin = ' ';
|
|
69
71
|
const tableConfig = {
|
|
70
|
-
head: ['name', 'alias'],
|
|
72
|
+
head: ['name', 'alias', 'description'],
|
|
71
73
|
chars: {
|
|
72
74
|
'left': leftMargin.concat('│'),
|
|
73
75
|
'top-left': leftMargin.concat('┌'),
|
|
@@ -80,7 +82,11 @@ class GenerateCommand extends abstract_command_1.AbstractCommand {
|
|
|
80
82
|
};
|
|
81
83
|
const table = new Table(tableConfig);
|
|
82
84
|
for (const schematic of nest_collection_1.NestCollection.getSchematics()) {
|
|
83
|
-
table.push([
|
|
85
|
+
table.push([
|
|
86
|
+
chalk.green(schematic.name),
|
|
87
|
+
chalk.cyan(schematic.alias),
|
|
88
|
+
schematic.description,
|
|
89
|
+
]);
|
|
84
90
|
}
|
|
85
91
|
return table.toString();
|
|
86
92
|
}
|
package/commands/index.js
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
function
|
|
3
|
-
|
|
4
|
-
}
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
5
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
|
|
13
|
+
__exportStar(require("./command.loader"), exports);
|
|
14
|
+
__exportStar(require("./command.input"), exports);
|
package/commands/info.command.js
CHANGED
|
@@ -9,6 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.InfoCommand = void 0;
|
|
12
13
|
const abstract_command_1 = require("./abstract.command");
|
|
13
14
|
class InfoCommand extends abstract_command_1.AbstractCommand {
|
|
14
15
|
load(program) {
|
package/commands/new.command.js
CHANGED
|
@@ -9,6 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.NewCommand = void 0;
|
|
12
13
|
const schematics_1 = require("../lib/schematics");
|
|
13
14
|
const abstract_command_1 = require("./abstract.command");
|
|
14
15
|
class NewCommand extends abstract_command_1.AbstractCommand {
|
|
@@ -9,6 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.StartCommand = void 0;
|
|
12
13
|
const abstract_command_1 = require("./abstract.command");
|
|
13
14
|
class StartCommand extends abstract_command_1.AbstractCommand {
|
|
14
15
|
load(program) {
|
|
@@ -9,6 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.UpdateCommand = void 0;
|
|
12
13
|
const abstract_command_1 = require("./abstract.command");
|
|
13
14
|
class UpdateCommand extends abstract_command_1.AbstractCommand {
|
|
14
15
|
load(program) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AssetsManager = void 0;
|
|
3
4
|
const chokidar = require("chokidar");
|
|
4
5
|
const path_1 = require("path");
|
|
5
6
|
const shell = require("shelljs");
|
|
@@ -15,7 +16,7 @@ class AssetsManager {
|
|
|
15
16
|
*/
|
|
16
17
|
closeWatchers() {
|
|
17
18
|
const timeoutMs = 300;
|
|
18
|
-
const closeFn = () => this.watchers.forEach(watcher => watcher.close());
|
|
19
|
+
const closeFn = () => this.watchers.forEach((watcher) => watcher.close());
|
|
19
20
|
setTimeout(closeFn, timeoutMs);
|
|
20
21
|
}
|
|
21
22
|
copyAssets(configuration, appName, outDir, watchAssetsMode) {
|
|
@@ -26,7 +27,7 @@ class AssetsManager {
|
|
|
26
27
|
try {
|
|
27
28
|
let sourceRoot = get_value_or_default_1.getValueOrDefault(configuration, 'sourceRoot', appName);
|
|
28
29
|
sourceRoot = path_1.join(process.cwd(), sourceRoot);
|
|
29
|
-
const filesToCopy = assets.map(item => {
|
|
30
|
+
const filesToCopy = assets.map((item) => {
|
|
30
31
|
if (typeof item === 'string') {
|
|
31
32
|
return {
|
|
32
33
|
glob: path_1.join(sourceRoot, item),
|
package/lib/compiler/compiler.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Compiler = void 0;
|
|
3
4
|
const ts = require("typescript");
|
|
4
5
|
const get_value_or_default_1 = require("./helpers/get-value-or-default");
|
|
5
6
|
const tsconfig_paths_hook_1 = require("./hooks/tsconfig-paths.hook");
|
|
@@ -12,7 +13,7 @@ class Compiler {
|
|
|
12
13
|
run(configuration, configFilename, appName, onSuccess) {
|
|
13
14
|
const tsBinary = this.typescriptLoader.load();
|
|
14
15
|
const formatHost = {
|
|
15
|
-
getCanonicalFileName: path => path,
|
|
16
|
+
getCanonicalFileName: (path) => path,
|
|
16
17
|
getCurrentDirectory: tsBinary.sys.getCurrentDirectory,
|
|
17
18
|
getNewLine: () => tsBinary.sys.newLine,
|
|
18
19
|
};
|
|
@@ -29,8 +30,8 @@ class Compiler {
|
|
|
29
30
|
const programRef = program.getProgram
|
|
30
31
|
? program.getProgram()
|
|
31
32
|
: program;
|
|
32
|
-
const before = plugins.beforeHooks.map(hook => hook(programRef));
|
|
33
|
-
const after = plugins.afterHooks.map(hook => hook(programRef));
|
|
33
|
+
const before = plugins.beforeHooks.map((hook) => hook(programRef));
|
|
34
|
+
const after = plugins.afterHooks.map((hook) => hook(programRef));
|
|
34
35
|
const emitResult = program.emit(undefined, undefined, undefined, undefined, {
|
|
35
36
|
before: before.concat(tsconfigPathsPlugin),
|
|
36
37
|
after,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.webpackDefaultsFactory = void 0;
|
|
3
4
|
const ForkTsCheckerWebpackPlugin = require("fork-ts-checker-webpack-plugin");
|
|
4
5
|
const path_1 = require("path");
|
|
5
6
|
const tsconfig_paths_webpack_plugin_1 = require("tsconfig-paths-webpack-plugin");
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.copyPathResolve = void 0;
|
|
3
4
|
const path = require("path");
|
|
4
5
|
/**
|
|
5
6
|
* Helper function for returning a copy destination filename
|
|
@@ -18,10 +19,7 @@ function dealWith(inPath, up) {
|
|
|
18
19
|
if (depth(inPath) < up) {
|
|
19
20
|
throw new Error('cant go up that far');
|
|
20
21
|
}
|
|
21
|
-
return path.join(...path
|
|
22
|
-
.normalize(inPath)
|
|
23
|
-
.split(path.sep)
|
|
24
|
-
.slice(up));
|
|
22
|
+
return path.join(...path.normalize(inPath).split(path.sep).slice(up));
|
|
25
23
|
}
|
|
26
24
|
function depth(string) {
|
|
27
25
|
return path.normalize(string).split(path.sep).length - 1;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getValueOrDefault = void 0;
|
|
3
4
|
function getValueOrDefault(configuration, propertyPath, appName, key, options = [], defaultValue) {
|
|
4
|
-
const item = options.find(option => option.name === key);
|
|
5
|
+
const item = options.find((option) => option.name === key);
|
|
5
6
|
const origValue = item && item.value;
|
|
6
7
|
if (origValue !== undefined && origValue !== null) {
|
|
7
8
|
return origValue;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.tsconfigPathsBeforeHookFactory = void 0;
|
|
3
4
|
const os = require("os");
|
|
4
5
|
const path_1 = require("path");
|
|
5
6
|
const typescript_loader_1 = require("../typescript-loader");
|
|
@@ -46,6 +47,17 @@ function getNotAliasedPath(sf, matcher, text) {
|
|
|
46
47
|
if (os.platform() === 'win32') {
|
|
47
48
|
result = result.replace(/\\/g, '/');
|
|
48
49
|
}
|
|
50
|
+
try {
|
|
51
|
+
// Installed packages (node modules) should take precedence over root files with the same name.
|
|
52
|
+
// Ref: https://github.com/nestjs/nest-cli/issues/838
|
|
53
|
+
const packagePath = require.resolve(text, {
|
|
54
|
+
paths: [process.cwd(), ...module.paths],
|
|
55
|
+
});
|
|
56
|
+
if (packagePath) {
|
|
57
|
+
return text;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
catch (_a) { }
|
|
49
61
|
const resolvedPath = path_1.posix.relative(path_1.dirname(sf.fileName), result) || './';
|
|
50
62
|
return resolvedPath[0] === '.' ? resolvedPath : './' + resolvedPath;
|
|
51
63
|
}
|
|
@@ -1,17 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PluginsLoader = void 0;
|
|
3
4
|
const path_1 = require("path");
|
|
4
5
|
const util_1 = require("util");
|
|
5
6
|
const ui_1 = require("../ui");
|
|
7
|
+
const PLUGIN_ENTRY_FILENAME = 'plugin';
|
|
6
8
|
class PluginsLoader {
|
|
7
9
|
load(plugins = []) {
|
|
8
|
-
const pluginNames = plugins.map(entry => util_1.isObject(entry) ? entry.name : entry);
|
|
10
|
+
const pluginNames = plugins.map((entry) => util_1.isObject(entry) ? entry.name : entry);
|
|
9
11
|
const nodeModulePaths = [
|
|
10
12
|
path_1.join(process.cwd(), 'node_modules'),
|
|
11
13
|
...module.paths,
|
|
12
14
|
];
|
|
13
|
-
const pluginRefs = pluginNames.map(item => {
|
|
15
|
+
const pluginRefs = pluginNames.map((item) => {
|
|
14
16
|
try {
|
|
17
|
+
try {
|
|
18
|
+
const binaryPath = require.resolve(path_1.join(item, PLUGIN_ENTRY_FILENAME), {
|
|
19
|
+
paths: nodeModulePaths,
|
|
20
|
+
});
|
|
21
|
+
return require(binaryPath);
|
|
22
|
+
}
|
|
23
|
+
catch (_a) { }
|
|
15
24
|
const binaryPath = require.resolve(item, { paths: nodeModulePaths });
|
|
16
25
|
return require(binaryPath);
|
|
17
26
|
}
|