@untool/yargs
Advanced tools
Comparing version 1.3.1 to 1.4.0
@@ -6,2 +6,25 @@ # Change Log | ||
# [1.4.0](https://github.com/untool/untool/compare/v1.3.1...v1.4.0) (2019-03-18) | ||
### Bug Fixes | ||
* **yargs:** re-enable and tweak request logging ([d48119a](https://github.com/untool/untool/commit/d48119a)) | ||
* **yargs:** restore node v8 compatibility ([a95932b](https://github.com/untool/untool/commit/a95932b)) | ||
### Features | ||
* **yargs:** add `bootstrap` and `runChecks` hooks ([3adc3e6](https://github.com/untool/untool/commit/3adc3e6)) | ||
* **yargs:** add full webpack error handling ([ef43e26](https://github.com/untool/untool/commit/ef43e26)) | ||
* **yargs:** add request logging, verbose flag ([b16f3b6](https://github.com/untool/untool/commit/b16f3b6)) | ||
* **yargs:** add support for arbitrary message types ([a8591d0](https://github.com/untool/untool/commit/a8591d0)) | ||
* **yargs:** colorize log output ([575a6b5](https://github.com/untool/untool/commit/575a6b5)) | ||
* **yargs:** improve webpack logging ([d8532f8](https://github.com/untool/untool/commit/d8532f8)) | ||
* **yargs:** tweak express request log output ([de5f5dd](https://github.com/untool/untool/commit/de5f5dd)) | ||
## [1.3.1](https://github.com/untool/untool/compare/v1.3.0...v1.3.1) (2019-03-07) | ||
@@ -8,0 +31,0 @@ |
18
index.js
@@ -19,6 +19,10 @@ #!/usr/bin/env node | ||
} | ||
const core = initialize(config, options); | ||
const { registerCommands, handleArguments, handleError } = core; | ||
const { | ||
bootstrap, | ||
registerCommands, | ||
handleArguments, | ||
handleError, | ||
} = initialize(config, options); | ||
invariant( | ||
registerCommands && handleArguments && handleError, | ||
bootstrap && registerCommands && handleArguments && handleError, | ||
"Can't use @untool/yargs mixin" | ||
@@ -28,3 +32,3 @@ ); | ||
process.on('unhandledRejection', handleError); | ||
process.nextTick(() => { | ||
bootstrap().then(() => { | ||
registerCommands( | ||
@@ -52,8 +56,6 @@ yargs | ||
module.exports = configure(); | ||
if (require.main === module) { | ||
const { join } = require('path'); | ||
module.exports = configure({ mixins: [join(__dirname, 'mixins', 'log')] }); | ||
module.exports.run(); | ||
} else { | ||
module.exports = configure(); | ||
} |
{ | ||
"name": "@untool/yargs", | ||
"version": "1.3.1", | ||
"version": "1.4.0", | ||
"description": "untool yargs mixin", | ||
@@ -22,5 +22,4 @@ "bin": { | ||
"dependencies": { | ||
"@untool/core": "^1.3.1", | ||
"@untool/core": "^1.4.0", | ||
"mixinable": "^4.0.0", | ||
"pretty-ms": "^4.0.0", | ||
"yargs": "^13.0.0" | ||
@@ -31,3 +30,3 @@ }, | ||
}, | ||
"gitHead": "fba0e40a25a957ea0fb5341f4f633444003955c2" | ||
"gitHead": "9794dbba7cc661486c9ea1216afb580b3c5c7537" | ||
} |
@@ -6,3 +6,3 @@ 'use strict'; | ||
module.exports = { | ||
mixins: [join(__dirname, 'mixins', 'main')], | ||
mixins: [join(__dirname, 'mixins')], | ||
}; |
# `@untool/yargs` | ||
[![travis](https://img.shields.io/travis/untool/untool/master.svg)](https://travis-ci.org/untool/untool) [![npm](https://img.shields.io/npm/v/@untool%2Fyargs.svg)](https://www.npmjs.com/package/@untool%2Fyargs) | ||
[![travis](https://img.shields.io/travis/untool/untool/master.svg)](https://travis-ci.org/untool/untool) [![npm](https://img.shields.io/npm/v/@untool%2Fyargs.svg)](https://www.npmjs.com/package/@untool/yargs) | ||
@@ -37,2 +37,16 @@ `@untool/yargs` is a [core mixin](https://github.com/untool/untool/blob/master/packages/core/README.md#mixins) powering `untool`'s command line interface and allowing other mixins to define their own commands. These custom commands will work exactly as those defined by `untool`'s own modules and can be called using executables such as [Hops CLI](https://github.com/xing/hops/blob/master/packages/cli/README.md). | ||
### `bootstrap()` ([parallel](https://github.com/untool/mixinable/blob/master/README.md#defineparallel)) | ||
Within this method, you are expected to set up your application. If you need to do something asynchronous at this point, just return a [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise). | ||
```javascript | ||
const { Mixin } = require('@untool/core'); | ||
module.exports = class FooMixin extends Mixin { | ||
bootstrap(yargs) { | ||
return Promise.resolve(); | ||
} | ||
}; | ||
``` | ||
### `registerCommands(yargs)` ([sequence](https://github.com/untool/mixinable/blob/master/README.md#defineparallel)) | ||
@@ -95,5 +109,5 @@ | ||
### `handleError(error)` ([override](https://github.com/untool/mixinable/blob/master/README.md#defineoverride)) | ||
### `handleError(error, recoverable)` ([override](https://github.com/untool/mixinable/blob/master/README.md#defineoverride)) | ||
By implementing this method, you can intercept uncaught errors and unhandled promise rejections. **Make sure you terminate the process in which this method is being called.** | ||
By implementing this method, you can handle exceptions occuring in your application - even uncaught errors and unhandled promise rejections. **If `receoverable' is 'false`, `@untool/yargs` will automatically terminate the [running process](https://nodejs.org/api/process.html#process_warning_using_uncaughtexception_correctly).** | ||
@@ -105,6 +119,6 @@ ```javascript | ||
module.exports = class FooMixin extends Mixin { | ||
handleError(error) { | ||
logError(error).then(() => process.exit(1)); | ||
handleError(error, recoverable) { | ||
logError(error); | ||
} | ||
}; | ||
``` |
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
3
122
1
21416
7
107
- Removedpretty-ms@^4.0.0
- Removedparse-ms@2.1.0(transitive)
- Removedpretty-ms@4.0.0(transitive)
Updated@untool/core@^1.4.0