@log4brains/cli-common
Advanced tools
Comparing version 1.0.0-beta.4 to 1.0.0-beta.5
@@ -6,2 +6,18 @@ # Change Log | ||
# [1.0.0-beta.5](https://github.com/thomvaill/log4brains/compare/v1.0.0-beta.4...v1.0.0-beta.5) (2021-01-13) | ||
### Features | ||
* distribute as a global NPM package ([9551b68](https://github.com/thomvaill/log4brains/commit/9551b689ffbce82f5b6d2bb514f87bf3faa10e3e)) | ||
### BREAKING CHANGES | ||
* installation procedure is now completely modified | ||
# [1.0.0-beta.4](https://github.com/thomvaill/log4brains/compare/v1.0.0-beta.3...v1.0.0-beta.4) (2020-12-10) | ||
@@ -8,0 +24,0 @@ |
@@ -31,4 +31,5 @@ import CliTable3, { Table } from "cli-table3"; | ||
askInputQuestion(question: string, defaultValue?: string): Promise<string>; | ||
askInputQuestionAndValidate(question: string, validationCb: (answer: string) => boolean | string, defaultValue?: string): Promise<string>; | ||
askListQuestion<V extends string>(question: string, choices: ChoiceDefinition<V>[], defaultValue?: V): Promise<V>; | ||
} | ||
//# sourceMappingURL=AppConsole.d.ts.map |
export * from "./AppConsole"; | ||
export * from "./ConsoleCapturer"; | ||
export * from "./FailureExit"; | ||
export * from "./Log4brainsConfigNotFound"; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -230,2 +230,3 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } | ||
async askYesNoQuestion(question, defaultValue) { | ||
console.log(""); | ||
const answer = await inquirer.prompt([{ | ||
@@ -241,2 +242,3 @@ type: "confirm", | ||
async askInputQuestion(question, defaultValue) { | ||
console.log(""); | ||
const answer = await inquirer.prompt([{ | ||
@@ -251,3 +253,27 @@ type: "input", | ||
async askInputQuestionAndValidate(question, validationCb, defaultValue) { | ||
let answer; | ||
let valid = true; | ||
let i = 0; | ||
do { | ||
if (valid !== true) { | ||
console.log(chalk.red(`✗ Please enter a correct value${valid === false ? "" : `: ${valid}`}`)); | ||
} | ||
if (i >= 10) { | ||
throw new Error("Reached maximum number of retries (10)"); | ||
} // eslint-disable-next-line no-await-in-loop | ||
answer = await this.askInputQuestion(question, defaultValue); | ||
valid = validationCb(answer); | ||
i += 1; | ||
} while (valid !== true); | ||
return answer; | ||
} | ||
async askListQuestion(question, choices, defaultValue) { | ||
console.log(""); | ||
const answer = await inquirer.prompt([{ | ||
@@ -265,4 +291,20 @@ type: "list", | ||
class FailureExit extends Error { | ||
constructor() { | ||
super("The CLI exited with an error"); | ||
} | ||
} | ||
class Log4brainsConfigNotFound extends Error { | ||
constructor() { | ||
super("Cannot find .log4brains.yml"); | ||
} | ||
} | ||
exports.AppConsole = AppConsole; | ||
exports.ConsoleCapturer = ConsoleCapturer; | ||
exports.FailureExit = FailureExit; | ||
exports.Log4brainsConfigNotFound = Log4brainsConfigNotFound; | ||
//# sourceMappingURL=index.js.map |
@@ -228,2 +228,3 @@ import chalk from 'chalk'; | ||
async askYesNoQuestion(question, defaultValue) { | ||
console.log(""); | ||
const answer = await inquirer.prompt([{ | ||
@@ -239,2 +240,3 @@ type: "confirm", | ||
async askInputQuestion(question, defaultValue) { | ||
console.log(""); | ||
const answer = await inquirer.prompt([{ | ||
@@ -249,3 +251,27 @@ type: "input", | ||
async askInputQuestionAndValidate(question, validationCb, defaultValue) { | ||
let answer; | ||
let valid = true; | ||
let i = 0; | ||
do { | ||
if (valid !== true) { | ||
console.log(chalk.red(`✗ Please enter a correct value${valid === false ? "" : `: ${valid}`}`)); | ||
} | ||
if (i >= 10) { | ||
throw new Error("Reached maximum number of retries (10)"); | ||
} // eslint-disable-next-line no-await-in-loop | ||
answer = await this.askInputQuestion(question, defaultValue); | ||
valid = validationCb(answer); | ||
i += 1; | ||
} while (valid !== true); | ||
return answer; | ||
} | ||
async askListQuestion(question, choices, defaultValue) { | ||
console.log(""); | ||
const answer = await inquirer.prompt([{ | ||
@@ -263,3 +289,17 @@ type: "list", | ||
export { AppConsole, ConsoleCapturer }; | ||
class FailureExit extends Error { | ||
constructor() { | ||
super("The CLI exited with an error"); | ||
} | ||
} | ||
class Log4brainsConfigNotFound extends Error { | ||
constructor() { | ||
super("Cannot find .log4brains.yml"); | ||
} | ||
} | ||
export { AppConsole, ConsoleCapturer, FailureExit, Log4brainsConfigNotFound }; | ||
//# sourceMappingURL=index.module.js.map |
{ | ||
"name": "@log4brains/cli-common", | ||
"version": "1.0.0-beta.4", | ||
"version": "1.0.0-beta.5", | ||
"description": "Log4brains architecture knowledge base common CLI features", | ||
@@ -37,4 +37,3 @@ "keywords": [ | ||
"lint": "eslint . --max-warnings=0", | ||
"prepublishOnly": "yarn build", | ||
"link": "npm link && rm -f ./package-lock.json" | ||
"prepublishOnly": "yarn build" | ||
}, | ||
@@ -53,3 +52,3 @@ "devDependencies": { | ||
}, | ||
"gitHead": "4def59002bb95f76ce281ab81f3e65da3f129f5f" | ||
"gitHead": "3398775e82d17a2fdb83d8e8aa4ff7393e1b2040" | ||
} |
# @log4brains/cli-common | ||
This package provides common features for all [Log4brains](https://github.com/thomvaill/log4brains) CLI-based packages. | ||
It is not meant to be used directly in your project. | ||
It is not meant to be used directly. | ||
## Installation | ||
Install [the main log4brains package](https://www.npmjs.com/package/log4brains) instead: | ||
This package is not meant to be installed directly in your project. This is a common dependency of [@log4brains/cli](https://www.npmjs.com/package/@log4brains/cli), [@log4brains/init](https://www.npmjs.com/package/@log4brains/init) and [@log4brains/web](https://www.npmjs.com/package/@log4brains/web), which is installed automatically. | ||
```bash | ||
npm install -g log4brains | ||
``` | ||
## Documentation | ||
- [Log4brains README](https://github.com/thomvaill/log4brains/blob/master/README.md) | ||
## Development | ||
@@ -15,5 +21,1 @@ | ||
``` | ||
## Documentation | ||
- [Log4brains README](https://github.com/thomvaill/log4brains/blob/master/README.md) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
69992
18
547
21