Releases: Xunnamius/black-flag
@black-flag/core@2.0.1
@black-flag/checks@1.0.1
@black-flag/extensions@2.0.0
💥 BREAKING CHANGES 💥
-
$executionContextand$artificiallyInvokedsymbols are now drawn from the global symbol registry. They will not match symbols from previous versions! -
All instances in source where
commandModulePathappeared have been replaced bycommandModulesPath. This includes the call signatures of functions likemakeRunner.The fix is simple: find-and-replace all instances of
commandModulePathwithcommandModulesPath.
✨ Features
- packages/extensions: implement @black-flag/extensions (f0525c5)
🪄 Fixes
⚙️ Build System
- deps: bump type-fest from 4.35.0 to 4.36.0 (80350cc)
- deps: bump type-fest from 4.36.0 to 4.37.0 (7c8ff7a)
- husky: force lint-staged (via husky) to only use global config file (5d3f2cc)
- packages/extensions: use correct git repo metadata in package.json (0548f8f)
🧙🏿 Refactored
@black-flag/core@2.0.0
💥 BREAKING CHANGES 💥
-
Positionals are now available to builders alongside all other flags
This is how vanilla Yargs (and Black Flag) does it for handlers. The behavior is now consistent in builders taking advantage of dynamic options. In earlier versions, builders'
argvparam had all positionals dumped intoargv._due to a suboptimal parsing extension. -
Show any available child commands in ALL error text
This includes when trying to use a command that is not found.
-
Do not output entire help text when a command fails
Skip all but the first line of
usagetext in output by default. -
Upgrade
ExecutionContext::state.showHelpOnFailto allow configuration of help text output styleNew output style options include "short" (first line of
usageonly, this is now the default) and "full" (fullusagestring). Also allows configuration of which error kinds trigger help text output and which do not. See documentation for details. -
Surface new
CliError::showHelpparameter values-
"short"/true, which will print the command help text without all but the first line ofusagetext. -
"default", which will defer toExecutionContext::state.showHelpOnFail. -
"full", which will force the old functionality. -
false, which ensures help text is never printed with respect to the current error instance.
-
-
Better help text output for dynamic options
With this change, Black Flag lets Yargs fully parse
argvand run through the builder twice before bailing to print help text when--help(or the equivalent option) is given.This allows input that triggers dynamic options like
my-command --flag-1 --flag-2 --helpto show help text specific to the final resolved builder configurations of--flag-1 --flag-2rather than always showing the most generic help text, which was the behavior of older Black Flag versions. See documentation for details. -
$executionContextand$artificiallyInvokedsymbols are now drawn from the global symbol registry. They will not match symbols from previous versions! -
All instances in source where
commandModulePathappeared have been replaced bycommandModulesPath. This includes the call signatures of functions likemakeRunner.The fix is simple: find-and-replace all instances of
commandModulePathwithcommandModulesPath. -
Along with implementing the
errorHandlingBehaviorDX improvement inmakeRunner, this update also addresses several small discrepancies in the behavior ofconfigureProgram,runProgram, andmakeRunner. These functions should now behave identically where appropriate (i.e. as described in their documentation), including consistently triggering the same error handling behavior at the same points for the same reasons given the same inputs.Additionally, non-graceful errors that are not handled by
ConfigureErrorHandlingEpiloguewill be consistently presented to the user as framework errors (assertion failures). As such,runProgram(and the low-order function returned bymakeRunner) should no longer throw in some edge cases, such as when being passed a rejected promise or when a hook that is evaluated early throws. -
ErrorMessageexport was renamed toBfErrorMessage
✨ Features
- src: export
getDeepestErrorCauseunder/util(bf001c4) - src: implement
errorHandlingBehavioroption inmakeRunner(5e4eb3d) - src: make
expectedHelpTextRegExputility a public export (8f2cb13) - src: make positionals available to builders normally (no longer in
argv._) (42367ce) - src: output help text with greater fidelity (02a497f) see #172
- Support Windows-style paths (cd288c5)
🪄 Fixes
- Fix Windows interop issues (b3abf95) see #174
- package: add @types/yargs as production dependency (8d50a56)
- src: ensure ESM file bare exports are seen by black flag (389a2dc)
- src: fix node@18 interop issue (c1b5f61) see #173
- src: improve
isXtype assertion exports (b980544) - src: improve intellisense across various exports (d6b1e73)
- src: more consistently handle various errors; improve output fidelity (9412aa6)
- src: throw upon encountering a
commandexport with invalid yargs DSL (7312b8d) - src: throw upon encountering an async
builderexport (78eb0a2)
⚙️ Build System
- deps: bump type-fest from 4.35.0 to 4.36.0 (33b2099)
- deps: bump type-fest from 4.36.0 to 4.37.0 (cdd8f61)
- husky: force lint-staged (via husky) to only use global config file (5d3f2cc)
- package: add @-xun/symbiote dev dependency (074a930)
- package: prune unnecessary dependencies (1b5cdbf)
- Throw in
runProgramwhen an incompatible Node.js runtime version is detected (cb56f8d)
🧙🏿 Refactored
@black-flag/checks@1.0.0
💥 BREAKING CHANGES 💥
-
All instances in source where
commandModulePathappeared have been replaced bycommandModulesPath. This includes the call signatures of functions likemakeRunner.The fix is simple: find-and-replace all instances of
commandModulePathwithcommandModulesPath.
✨ Features
- packages/checks: implement @black-flag/checks (64029b9)
- packages/checks: implement
checkArrayNoConflictsandcheckArrayUnique(10cd0eb)
🪄 Fixes
⚙️ Build System
- husky: force lint-staged (via husky) to only use global config file (5d3f2cc)
- husky: update to latest hooks (75d5c66)
- tsconfig: fix internal path resolution (fbe3a69)
- tsconfig: upgrade to NodeNext (d3a499e)
🧙🏿 Refactored
- Rename and restructure exports for better docs generation (8303ba7)