@nestjs/cli
Advanced tools
Comparing version 9.1.5 to 9.1.6
@@ -91,3 +91,2 @@ "use strict"; | ||
this.compiler.run(configuration, pathToTsconfig, appName, onSuccess); | ||
this.assetsManager.closeWatchers(); | ||
} | ||
@@ -94,0 +93,0 @@ }); |
@@ -33,3 +33,3 @@ "use strict"; | ||
const isDryRunEnabled = dryRunOption && dryRunOption.value; | ||
yield askForMissingInformation(inputs); | ||
yield askForMissingInformation(inputs, options); | ||
yield generateApplicationFiles(inputs, options).catch(exports.exit); | ||
@@ -55,2 +55,3 @@ const shouldSkipInstall = options.some((option) => option.name === 'skip-install' && option.value === true); | ||
const getApplicationNameInput = (inputs) => inputs.find((input) => input.name === 'name'); | ||
const getPackageManagerInput = (inputs) => inputs.find((options) => options.name === 'packageManager'); | ||
const getProjectDirectory = (applicationName, directoryOption) => { | ||
@@ -60,3 +61,3 @@ return ((directoryOption && directoryOption.value) || | ||
}; | ||
const askForMissingInformation = (inputs) => __awaiter(void 0, void 0, void 0, function* () { | ||
const askForMissingInformation = (inputs, options) => __awaiter(void 0, void 0, void 0, function* () { | ||
console.info(ui_1.MESSAGES.PROJECT_INFORMATION_START); | ||
@@ -72,2 +73,7 @@ console.info(); | ||
} | ||
const packageManagerInput = getPackageManagerInput(options); | ||
if (!packageManagerInput.value) { | ||
const answers = yield askForPackageManager(); | ||
replaceInputMissingInformation(options, answers); | ||
} | ||
}); | ||
@@ -87,4 +93,3 @@ const replaceInputMissingInformation = (inputs, answers) => { | ||
return options.reduce((schematicOptions, option) => { | ||
if (option.name !== 'skip-install' && | ||
option.value !== 'package-manager') { | ||
if (option.name !== 'skip-install') { | ||
schematicOptions.push(new schematics_1.SchematicOption(option.name, option.value)); | ||
@@ -96,3 +101,3 @@ } | ||
const installPackages = (options, dryRunMode, installDirectory) => __awaiter(void 0, void 0, void 0, function* () { | ||
const inputPackageManager = options.find((option) => option.name === 'package-manager').value; | ||
const inputPackageManager = getPackageManagerInput(options).value; | ||
let packageManager; | ||
@@ -105,25 +110,15 @@ if (dryRunMode) { | ||
} | ||
if (inputPackageManager !== undefined) { | ||
try { | ||
packageManager = package_managers_1.PackageManagerFactory.create(inputPackageManager); | ||
yield packageManager.install(installDirectory, inputPackageManager); | ||
try { | ||
packageManager = package_managers_1.PackageManagerFactory.create(inputPackageManager); | ||
yield packageManager.install(installDirectory, inputPackageManager); | ||
} | ||
catch (error) { | ||
if (error && error.message) { | ||
console.error(chalk.red(error.message)); | ||
} | ||
catch (error) { | ||
if (error && error.message) { | ||
console.error(chalk.red(error.message)); | ||
} | ||
} | ||
} | ||
else { | ||
packageManager = yield selectPackageManager(); | ||
yield packageManager.install(installDirectory, packageManager.name.toLowerCase()); | ||
} | ||
}); | ||
const selectPackageManager = () => __awaiter(void 0, void 0, void 0, function* () { | ||
const answers = yield askForPackageManager(); | ||
return package_managers_1.PackageManagerFactory.create(answers['package-manager']); | ||
}); | ||
const askForPackageManager = () => __awaiter(void 0, void 0, void 0, function* () { | ||
const questions = [ | ||
(0, questions_1.generateSelect)('package-manager')(ui_1.MESSAGES.PACKAGE_MANAGER_QUESTION)([ | ||
(0, questions_1.generateSelect)('packageManager')(ui_1.MESSAGES.PACKAGE_MANAGER_QUESTION)([ | ||
package_managers_1.PackageManager.NPM, | ||
@@ -130,0 +125,0 @@ package_managers_1.PackageManager.YARN, |
@@ -25,3 +25,3 @@ "use strict"; | ||
.option('-s, --skip-install', 'Skip package installation.', false) | ||
.option('-p, --package-manager [package-manager]', 'Specify package manager.') | ||
.option('-p, --package-manager [packageManager]', 'Specify package manager.') | ||
.option('-l, --language [language]', 'Programming language to be used (TypeScript or JavaScript)', 'TypeScript') | ||
@@ -39,3 +39,3 @@ .option('-c, --collection [collectionName]', 'Schematics collection to use', schematics_1.Collection.NESTJS) | ||
options.push({ | ||
name: 'package-manager', | ||
name: 'packageManager', | ||
value: command.packageManager, | ||
@@ -42,0 +42,0 @@ }); |
@@ -13,2 +13,3 @@ "use strict"; | ||
exports.StartCommand = void 0; | ||
const remaining_flags_1 = require("../lib/utils/remaining-flags"); | ||
const abstract_command_1 = require("./abstract.command"); | ||
@@ -71,3 +72,9 @@ class StartCommand extends abstract_command_1.AbstractCommand { | ||
inputs.push({ name: 'app', value: app }); | ||
yield this.action.handle(inputs, options); | ||
const flags = (0, remaining_flags_1.getRemainingFlags)(program); | ||
try { | ||
yield this.action.handle(inputs, options, flags); | ||
} | ||
catch (err) { | ||
process.exit(1); | ||
} | ||
})); | ||
@@ -74,0 +81,0 @@ } |
@@ -5,9 +5,2 @@ import { Configuration } from '../configuration'; | ||
private watchers; | ||
private actionInProgress; | ||
/** | ||
* Using on `nest build` to close file watch or the build process will not end | ||
* Interval like process | ||
* If no action has been taken recently close watchers | ||
* If action has been taken recently flag and try again | ||
*/ | ||
closeWatchers(): void; | ||
@@ -14,0 +7,0 @@ copyAssets(configuration: Required<Configuration>, appName: string, outDir: string, watchAssetsMode: boolean): void; |
@@ -13,23 +13,5 @@ "use strict"; | ||
this.watchers = []; | ||
this.actionInProgress = false; | ||
} | ||
/** | ||
* Using on `nest build` to close file watch or the build process will not end | ||
* Interval like process | ||
* If no action has been taken recently close watchers | ||
* If action has been taken recently flag and try again | ||
*/ | ||
closeWatchers() { | ||
// Consider adjusting this for larger files | ||
const timeoutMs = 500; | ||
const closeFn = () => { | ||
if (this.actionInProgress) { | ||
this.actionInProgress = false; | ||
setTimeout(closeFn, timeoutMs); | ||
} | ||
else { | ||
this.watchers.forEach((watcher) => watcher.close()); | ||
} | ||
}; | ||
setTimeout(closeFn, timeoutMs); | ||
this.watchers.forEach((watcher) => watcher.close()); | ||
} | ||
@@ -74,2 +56,5 @@ copyAssets(configuration, appName, outDir, watchAssetsMode) { | ||
.on('unlink', (path) => this.actionOnFile(Object.assign(Object.assign({}, option), { path, action: 'unlink' }))); | ||
if (!isWatchEnabled) { | ||
watcher.on('ready', () => watcher.close()); | ||
} | ||
this.watchers.push(watcher); | ||
@@ -91,4 +76,2 @@ } | ||
this.watchAssetsKeyValue[path] = true; | ||
// Set action to true to avoid watches getting cutoff | ||
this.actionInProgress = true; | ||
const dest = (0, copy_path_resolve_1.copyPathResolve)(path, item.outDir, sourceRoot.split(path_1.sep).length); | ||
@@ -95,0 +78,0 @@ // Copy to output dir if file is changed or added |
{ | ||
"name": "@nestjs/cli", | ||
"version": "9.1.5", | ||
"version": "9.1.6", | ||
"description": "Nest - modern, fast, powerful node.js web framework (@cli)", | ||
@@ -41,11 +41,11 @@ "publishConfig": { | ||
"dependencies": { | ||
"@angular-devkit/core": "14.2.2", | ||
"@angular-devkit/schematics": "14.2.2", | ||
"@angular-devkit/schematics-cli": "14.2.2", | ||
"@angular-devkit/core": "14.2.10", | ||
"@angular-devkit/schematics": "14.2.10", | ||
"@angular-devkit/schematics-cli": "14.2.10", | ||
"@nestjs/schematics": "^9.0.0", | ||
"chalk": "3.0.0", | ||
"chokidar": "3.5.3", | ||
"cli-table3": "0.6.2", | ||
"cli-table3": "0.6.3", | ||
"commander": "4.1.1", | ||
"fork-ts-checker-webpack-plugin": "7.2.13", | ||
"fork-ts-checker-webpack-plugin": "7.2.14", | ||
"inquirer": "7.3.3", | ||
@@ -59,15 +59,15 @@ "node-emoji": "1.11.0", | ||
"tree-kill": "1.2.2", | ||
"tsconfig-paths": "4.1.0", | ||
"tsconfig-paths": "4.1.1", | ||
"tsconfig-paths-webpack-plugin": "4.0.0", | ||
"typescript": "4.8.4", | ||
"webpack": "5.74.0", | ||
"webpack": "5.75.0", | ||
"webpack-node-externals": "3.0.0" | ||
}, | ||
"devDependencies": { | ||
"@commitlint/cli": "17.1.2", | ||
"@commitlint/config-angular": "17.1.0", | ||
"@commitlint/cli": "17.3.0", | ||
"@commitlint/config-angular": "17.3.0", | ||
"@types/copyfiles": "2.4.1", | ||
"@types/inquirer": "8.2.4", | ||
"@types/jest": "28.1.8", | ||
"@types/node": "18.11.7", | ||
"@types/inquirer": "8.2.5", | ||
"@types/jest": "29.2.4", | ||
"@types/node": "18.11.18", | ||
"@types/node-emoji": "1.8.2", | ||
@@ -79,6 +79,6 @@ "@types/ora": "3.2.0", | ||
"@types/webpack-node-externals": "2.5.3", | ||
"@typescript-eslint/eslint-plugin": "5.41.0", | ||
"@typescript-eslint/parser": "5.41.0", | ||
"@typescript-eslint/eslint-plugin": "5.42.1", | ||
"@typescript-eslint/parser": "5.42.1", | ||
"delete-empty": "3.0.0", | ||
"eslint": "8.26.0", | ||
"eslint": "8.30.0", | ||
"eslint-config-prettier": "8.5.0", | ||
@@ -88,9 +88,9 @@ "eslint-plugin-import": "2.26.0", | ||
"gulp-clean": "0.4.0", | ||
"husky": "8.0.1", | ||
"jest": "28.1.3", | ||
"husky": "8.0.2", | ||
"jest": "29.3.1", | ||
"lint-staged": "13.0.3", | ||
"prettier": "2.7.1", | ||
"release-it": "15.5.0", | ||
"ts-jest": "28.0.8", | ||
"ts-loader": "9.4.1", | ||
"release-it": "15.5.1", | ||
"ts-jest": "29.0.3", | ||
"ts-loader": "9.4.2", | ||
"ts-node": "10.9.1" | ||
@@ -97,0 +97,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
208754
4042
+ Added@angular-devkit/core@14.2.10(transitive)
+ Added@angular-devkit/schematics@14.2.10(transitive)
+ Added@angular-devkit/schematics-cli@14.2.10(transitive)
+ Addedcli-table3@0.6.3(transitive)
+ Addedfork-ts-checker-webpack-plugin@7.2.14(transitive)
+ Addedtsconfig-paths@4.1.1(transitive)
+ Addedwebpack@5.75.0(transitive)
- Removed@angular-devkit/core@14.2.2(transitive)
- Removed@angular-devkit/schematics@14.2.2(transitive)
- Removed@angular-devkit/schematics-cli@14.2.2(transitive)
- Removedcli-table3@0.6.2(transitive)
- Removedfork-ts-checker-webpack-plugin@7.2.13(transitive)
- Removedtsconfig-paths@4.1.0(transitive)
- Removedwebpack@5.74.0(transitive)
Updated@angular-devkit/core@14.2.10
Updatedcli-table3@0.6.3
Updatedtsconfig-paths@4.1.1
Updatedwebpack@5.75.0