@spark-ui/cli-utils
Advanced tools
Comparing version 1.1.1 to 1.2.0
@@ -6,2 +6,8 @@ # Change Log | ||
# [1.2.0](https://github.com/adevinta/spark/compare/@spark-ui/cli-utils@1.1.1...@spark-ui/cli-utils@1.2.0) (2023-02-15) | ||
### Features | ||
- **cli-utils:** prompt system for spark generate command ([12aec9b](https://github.com/adevinta/spark/commit/12aec9bb2af9aacdf2337e0de92e97ea608db962)), closes [#237](https://github.com/adevinta/spark/issues/237) [#237](https://github.com/adevinta/spark/issues/237) | ||
## [1.1.1](https://github.com/adevinta/spark/compare/@spark-ui/cli-utils@1.1.0...@spark-ui/cli-utils@1.1.1) (2023-02-15) | ||
@@ -8,0 +14,0 @@ |
{ | ||
"name": "@spark-ui/cli-utils", | ||
"version": "1.1.1", | ||
"version": "1.2.0", | ||
"description": "Spark CLI utils", | ||
@@ -14,2 +14,3 @@ "publishConfig": { | ||
"devDependencies": { | ||
"@clack/prompts": "^0.2.2", | ||
"chalk": "5.2.0", | ||
@@ -21,3 +22,3 @@ "commander": "10.0.0", | ||
}, | ||
"gitHead": "1857690fc7d399de062fcdee6b7b03feacbc791f" | ||
"gitHead": "3df014946de14807674052ae9a6624a11b9c725b" | ||
} |
11
utils.js
@@ -6,6 +6,11 @@ import fs from 'node:fs' | ||
export const log = msg => console.log(chalk.gray(msg)) // eslint-disable-line no-console | ||
export const log = { | ||
success: msg => console.log(chalk.green(msg)), // eslint-disable-line no-console | ||
error: msg => console.log(chalk.red(msg)), // eslint-disable-line no-console | ||
info: msg => console.log(chalk.yellow(msg)), // eslint-disable-line no-console | ||
warning: msg => console.log(chalk.orange(msg)), // eslint-disable-line no-console | ||
} | ||
export const showError = (msg, foreignProgram) => { | ||
console.error(chalk.red(`✖ Error: ${msg}\n`)) | ||
log.error(`✖ Error: ${msg}\n`) | ||
process.exit(1) | ||
@@ -17,3 +22,3 @@ } | ||
.outputFile(path, content) | ||
.then(() => log(`Created ${path}`)) | ||
.then(() => log.info(`Created ${path}`)) | ||
.catch(() => showError(`Failed creating ${path}`)) |
Sorry, the diff of this file is not supported yet
12494
257
6
4