
Security News
Crates.io Implements Trusted Publishing Support
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
inquirer_config_builder
Advanced tools
#Inquirer Config Question and Answer Builder
Create a scehma of your question later which will changed to Inquirer compatible question
also if you pass the answers of inquirer to create
function then it will provide you config
file ready object which can directly saved to file as a config file.
#Setup
npm i inquirer_config_builder
question
function will return question from schemacreate
with the answers
provided by inquirer will make config ready object#Example
const inquirer = require('inquirer');
const InquirerConfigBuilder = require('inquirer_config_builder');
var schema = {
server: {
port: {
required: true,
default: 9393
}
},
default: {
database: {
type: 'list',
required: true,
choices: ['mysql'],
default: 'mysql'
}
}
,
database: {
mysql: {
hostname: {
required: true
},
username: {
required: true
},
database: {
required: true
},
password: {
required: true
}
}
}
}
let questionReadyObject = InquirerConfigBuilder.questions(schema);
//will output
//
// [ { required: true,
// default: 9393,
// message: 'Enter port',
// name: 'server.port',
// validate: [Function: required] },
// { type: 'list',
// required: true,
// choices: [ 'mysql' ],
// default: 'mysql',
// message: 'Enter database',
// name: 'default.database',
// validate: [Function: required] },
// { required: true,
// message: 'Enter hostname',
// name: 'database.mysql.hostname',
// validate: [Function: required] },
// { required: true,
// message: 'Enter username',
// name: 'database.mysql.username',
// validate: [Function: required] },
// { required: true,
// message: 'Enter database',
// name: 'database.mysql.database',
// validate: [Function: required] },
// { required: true,
// message: 'Enter password',
// name: 'database.mysql.password',
// validate: [Function: required] } ]
//
inquirer
.prompt(questionReadyObject).then(answers => {
"use strict";
let configReadyObject = InquirerConfigBuilder.create(answers);
console.log(configReadyObject);
//Will output
// { server: { port: 9393 },
// default: { database: 'mysql' },
// database:
// { mysql:
// { hostname: '127.0.0.1',
// username: 'root',
// database: 'databasename',
// password: 'password' } } }
});
FAQs
Question builder and Config builder for Inquirer
We found that inquirer_config_builder demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
Research
/Security News
Undocumented protestware found in 28 npm packages disrupts UI for Russian-language users visiting Russian and Belarusian domains.
Research
/Security News
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.