Socket
Socket
Sign inDemoInstall

@nestjs/cli

Package Overview
Dependencies
222
Maintainers
4
Versions
215
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 5.8.0 to 6.0.0

65

actions/new.action.js

@@ -25,10 +25,9 @@ "use strict";

return __awaiter(this, void 0, void 0, function* () {
const questions = generateQuestionsForMissingInputs(inputs);
const answers = yield askForMissingInformation(questions);
const args = replaceInputMissingInformation(inputs, answers);
const dryRunOption = options.find(option => option.name === 'dry-run');
const isDryRunEnabled = dryRunOption && dryRunOption.value;
yield generateApplicationFiles(inputs, options, isDryRunEnabled).catch(exports.exit);
yield askForMissingInformation(inputs);
yield generateApplicationFiles(inputs, options).catch(exports.exit);
const shouldSkipInstall = options.some(option => option.name === 'skip-install' && option.value === true);
const projectDirectory = strings_1.dasherize(inputs.find(input => input.name === 'name').value);
const projectDirectory = strings_1.dasherize(getApplicationNameInput(inputs)
.value);
if (!shouldSkipInstall) {

@@ -45,31 +44,14 @@ yield installPackages(options, isDryRunEnabled, projectDirectory);

exports.NewAction = NewAction;
const generateQuestionsForMissingInputs = (inputs) => {
return inputs
.map(input => questions_1.generateInput(input.name)(input.value)(generateDefaultAnswer(input.name)))
.filter(question => question !== undefined);
};
const generateDefaultAnswer = (name) => {
switch (name) {
case 'name':
return 'nestjs-app-name';
case 'description':
return 'description';
case 'version':
return '0.0.0';
case 'author':
default:
return '';
}
};
const askForMissingInformation = (questions) => __awaiter(this, void 0, void 0, function* () {
console.info();
const getApplicationNameInput = (inputs) => inputs.find(input => input.name === 'name');
const askForMissingInformation = (inputs) => __awaiter(this, void 0, void 0, function* () {
console.info(ui_1.messages.PROJECT_INFORMATION_START);
console.info(ui_1.messages.ADDITIONAL_INFORMATION);
console.info();
const prompt = inquirer.createPromptModule();
const answers = yield prompt(questions);
console.info();
console.info(ui_1.messages.PROJECT_INFORMATION_COLLECTED);
console.info();
return answers;
const nameInput = getApplicationNameInput(inputs);
if (!nameInput.value) {
const message = 'What name would you like to use for the new project?';
const questions = [questions_1.generateInput('name', message)('nest-app')];
const answers = yield prompt(questions);
replaceInputMissingInformation(inputs, answers);
}
});

@@ -80,9 +62,6 @@ const replaceInputMissingInformation = (inputs, answers) => {

};
const generateApplicationFiles = (args, options, isDryRunEnabled) => __awaiter(this, void 0, void 0, function* () {
const generateApplicationFiles = (args, options) => __awaiter(this, void 0, void 0, function* () {
const collection = schematics_1.CollectionFactory.create(schematics_1.Collection.NESTJS);
const schematicOptions = mapSchematicOptions(args.concat(options));
yield collection.execute('application', schematicOptions);
if (!isDryRunEnabled) {
yield generateConfigurationFile(args, options, collection);
}
console.info();

@@ -99,18 +78,2 @@ });

};
const generateConfigurationFile = (args, options, collection) => __awaiter(this, void 0, void 0, function* () {
const schematicOptions = mapConfigurationSchematicOptions(args.concat(options));
schematicOptions.push(new schematics_1.SchematicOption('collection', '@nestjs/schematics'));
yield collection.execute('configuration', schematicOptions);
});
const mapConfigurationSchematicOptions = (inputs) => {
return inputs.reduce((schematicsOptions, option) => {
if (option.name === 'name') {
schematicsOptions.push(new schematics_1.SchematicOption('project', strings_1.dasherize(option.value)));
}
if (option.name === 'language') {
schematicsOptions.push(new schematics_1.SchematicOption(option.name, option.value));
}
return schematicsOptions;
}, []);
};
const installPackages = (options, dryRunMode, installDirectory) => __awaiter(this, void 0, void 0, function* () {

@@ -117,0 +80,0 @@ const inputPackageManager = options.find(option => option.name === 'package-manager').value;

@@ -16,3 +16,3 @@ "use strict";

.command('add <library>')
.description('Allow user to add a library')
.description('Add a library')
.action((library) => __awaiter(this, void 0, void 0, function* () {

@@ -19,0 +19,0 @@ const inputs = [];

@@ -39,3 +39,3 @@ "use strict";

buildDescription() {
return ('Generate a Nest element.\n' +
return ('Generate a Nest element\n' +
' Available schematics:\n' +

@@ -42,0 +42,0 @@ this.buildSchematicsListAsTable());

@@ -15,5 +15,5 @@ "use strict";

program
.command('new [name] [description] [version] [author]')
.command('new [name]')
.alias('n')
.description('Generate a new Nest application.')
.description('Generate Nest application')
.option('-d, --dry-run', 'Allow to test changes before execute command.')

@@ -23,3 +23,3 @@ .option('-s, --skip-install', 'Allow to skip package installation.')

.option('-l, --language [language]', 'Specify ts or js language to use')
.action((name, description, version, author, command) => __awaiter(this, void 0, void 0, function* () {
.action((name, command) => __awaiter(this, void 0, void 0, function* () {
const options = [];

@@ -38,5 +38,2 @@ options.push({ name: 'dry-run', value: !!command.dryRun });

inputs.push({ name: 'name', value: name });
inputs.push({ name: 'description', value: description });
inputs.push({ name: 'version', value: version });
inputs.push({ name: 'author', value: author });
yield this.action.handle(inputs, options);

@@ -43,0 +40,0 @@ }));

@@ -17,3 +17,3 @@ "use strict";

.alias('u')
.description('Update Nest dependencies.')
.description('Update Nest dependencies')
.option('-f, --force', 'Call for upgrading instead of updating.')

@@ -20,0 +20,0 @@ .option('-t, --tag <tag>', 'Call for upgrading to latest | beta | rc | next tag.')

@@ -1,2 +0,2 @@

export declare const generateInput: (name: string) => (value: any) => (defaultAnwser: string) => any;
export declare const generateInput: (name: string, message: string) => (defaultAnswer: string) => any;
export declare const generateSelect: (name: string) => (message: string) => (choices: string[]) => any;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.generateInput = (name) => {
return (value) => {
if (value === undefined) {
return (defaultAnswer) => ({
type: 'input',
name,
message: `${name}:`,
default: defaultAnswer,
});
}
return (defaultAnswer) => undefined;
};
exports.generateInput = (name, message) => {
return (defaultAnswer) => ({
type: 'input',
name,
message,
default: defaultAnswer,
});
};

@@ -16,0 +11,0 @@ exports.generateSelect = (name) => {

export declare const messages: {
DRY_RUN_MODE: string;
PROJECT_INFORMATION_START: string;
ADDITIONAL_INFORMATION: string;
PROJECT_INFORMATION_COLLECTED: string;
DRY_RUN_MODE: string;
RUNNER_EXECUTION_ERROR: (command: string) => string;

@@ -7,0 +5,0 @@ PACKAGE_MANAGER_QUESTION: string;

@@ -6,6 +6,4 @@ "use strict";

exports.messages = {
PROJECT_INFORMATION_START: `${emojis_1.emojis.ZAP} Creating your Nest project...`,
ADDITIONAL_INFORMATION: `${emojis_1.emojis.RAISED_HANDS} We have to collect additional information:`,
PROJECT_INFORMATION_COLLECTED: `${emojis_1.emojis.BOOM} Thank you for your time!`,
DRY_RUN_MODE: 'Command has been executed in the dry mode, nothing changed!',
PROJECT_INFORMATION_START: `${emojis_1.emojis.ZAP} We will scaffold your app in a few seconds..`,
RUNNER_EXECUTION_ERROR: (command) => `Failed to execute command: ${command}`,

@@ -12,0 +10,0 @@ PACKAGE_MANAGER_QUESTION: `Which package manager would you ${emojis_1.emojis.HEART} to use?`,

{
"name": "@nestjs/cli",
"version": "5.8.0",
"version": "6.0.0",
"description": "Nest - modern, fast, powerful node.js web framework (@cli)",

@@ -37,29 +37,29 @@ "publishConfig": {

"dependencies": {
"@angular-devkit/core": "7.2.2",
"@angular-devkit/schematics": "7.2.2",
"@angular-devkit/schematics-cli": "^0.12.2",
"@nestjs/schematics": "^5.12.0",
"chalk": "^2.4.1",
"cli-table2": "^0.2.0",
"commander": "^2.19.0",
"inquirer": "^5.2.0",
"node-emoji": "^1.8.1",
"ora": "^2.1.0",
"os-name": "^2.0.1",
"typescript": "^3.2.2"
"@angular-devkit/core": "7.3.6",
"@angular-devkit/schematics": "7.3.6",
"@angular-devkit/schematics-cli": "0.13.6",
"@nestjs/schematics": "6.0.1",
"chalk": "2.4.2",
"cli-table2": "0.2.0",
"commander": "2.19.0",
"inquirer": "6.2.2",
"node-emoji": "1.10.0",
"ora": "2.1.0",
"os-name": "3.0.0",
"typescript": "3.3.3333"
},
"devDependencies": {
"@types/cli-table2": "^0.2.2",
"@types/inquirer": "0.0.41",
"@types/jest": "^22.2.3",
"@types/node": "^9.6.19",
"@types/node-emoji": "^1.8.0",
"@types/ora": "^1.3.4",
"@types/os-name": "^2.0.0",
"jest": "^22.4.4",
"prettier": "^1.15.3",
"ts-jest": "^22.4.6",
"ts-node": "^6.0.5",
"tslint": "^5.11.0"
"@types/cli-table2": "0.2.2",
"@types/inquirer": "0.0.44",
"@types/jest": "24.0.11",
"@types/node": "11.11.3",
"@types/node-emoji": "1.8.1",
"@types/ora": "1.3.4",
"@types/os-name": "2.0.0",
"jest": "24.5.0",
"prettier": "1.16.4",
"ts-jest": "24.0.0",
"ts-node": "8.0.3",
"tslint": "5.14.0"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc