Skip to content
This repository was archived by the owner on Aug 22, 2023. It is now read-only.

Commit 84a397e

Browse files
committed
fix: move ExitError to config
1 parent 48357db commit 84a397e

File tree

5 files changed

+49
-118
lines changed

5 files changed

+49
-118
lines changed

package.json

+3-4
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
"@anycli/parser": "^3.2.4"
1717
},
1818
"devDependencies": {
19-
"@anycli/config": "^1.1.6",
20-
"@anycli/plugin-help": "^0.6.1",
21-
"@anycli/plugin-not-found": "^0.1.15",
19+
"@anycli/config": "^1.2.3",
20+
"@anycli/plugin-help": "^0.6.3",
21+
"@anycli/plugin-not-found": "^0.1.16",
2222
"@anycli/plugin-plugins": "^0.2.11",
2323
"@anycli/tslint": "^0.2.5",
2424
"@types/chai": "^4.1.2",
@@ -28,7 +28,6 @@
2828
"chai": "^4.1.2",
2929
"concurrently": "^3.5.1",
3030
"fancy-test": "^1.0.1",
31-
"http-call": "^5.0.2",
3231
"mocha": "^5.0.0",
3332
"nock": "^9.1.6",
3433
"ts-node": "^4.1.0",

src/command.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import * as Config from '@anycli/config'
44
import * as Parser from '@anycli/parser'
55
import Help from '@anycli/plugin-help'
66

7-
import {ExitError} from './exit'
87
import * as flags from './flags'
98
import {compact} from './util'
109

@@ -74,7 +73,7 @@ export default abstract class Command {
7473
}
7574
}
7675

77-
exit(code?: number) { throw new ExitError(code || 0) }
76+
exit(code?: number) { throw new Config.ExitError(code || 0) }
7877

7978
log(s?: string | undefined) {
8079
process.stdout.write((s || '') + '\n')
@@ -95,7 +94,6 @@ export default abstract class Command {
9594
}
9695
global['http-call'] = global['http-call'] || {}
9796
global['http-call']!.userAgent = this.config.userAgent
98-
await this.config.runHook('init', {argv: this.argv})
9997
if (this._helpOverride()) return this._help()
10098
}
10199

src/exit.ts

-15
This file was deleted.

src/main.ts

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export class Main extends Command {
1414

1515
async run() {
1616
let [id, ...argv] = this.argv
17+
await this.config.runHook('init', {id, argv})
1718
this.parse({strict: false, '--': false, ...this.ctor as any})
1819
await this.config.runCommand(id, argv)
1920
}

yarn.lock

+44-96
Original file line numberDiff line numberDiff line change
@@ -2,65 +2,38 @@
22
# yarn lockfile v1
33

44

5-
"@anycli/command@^1.2.2", "@anycli/command@^1.2.3":
6-
version "1.2.3"
7-
resolved "https://registry.yarnpkg.com/@anycli/command/-/command-1.2.3.tgz#b239669674f98098b1af096f081958b270fab0b6"
8-
dependencies:
9-
"@anycli/parser" "^3.2.2"
10-
cli-ux "^3.3.13"
11-
debug "^3.1.0"
12-
fs-extra "^5.0.0"
13-
load-json-file "^4.0.0"
14-
lodash "^4.17.4"
15-
16-
"@anycli/command@^1.2.4":
17-
version "1.2.4"
18-
resolved "https://registry.yarnpkg.com/@anycli/command/-/command-1.2.4.tgz#9c42a8142a380193a949fab8f374b53ef805f4e9"
5+
"@anycli/command@^1.2.3", "@anycli/command@^1.2.5":
6+
version "1.2.5"
7+
resolved "https://registry.yarnpkg.com/@anycli/command/-/command-1.2.5.tgz#c7a6ee35344f1d854d5323e1f5a3f6b6da7e1b6d"
198
dependencies:
20-
"@anycli/parser" "^3.2.2"
21-
cli-ux "^3.3.13"
22-
debug "^3.1.0"
23-
fs-extra "^5.0.0"
24-
load-json-file "^4.0.0"
25-
lodash "^4.17.4"
9+
"@anycli/parser" "^3.2.4"
2610

27-
"@anycli/config@^1.1.6":
28-
version "1.1.6"
29-
resolved "https://registry.yarnpkg.com/@anycli/config/-/config-1.1.6.tgz#141f1e849c5dfd4d19169a0e8af267f4013b1042"
30-
31-
"@anycli/parser@^3.2.2":
32-
version "3.2.2"
33-
resolved "https://registry.yarnpkg.com/@anycli/parser/-/parser-3.2.2.tgz#ee2616e889e7dd78bc269638b7eee3f3096e2c91"
34-
dependencies:
35-
"@anycli/screen" "^0.0.3"
36-
chalk "^2.3.0"
37-
lodash "^4.17.4"
11+
"@anycli/config@^1.2.3":
12+
version "1.2.3"
13+
resolved "https://registry.yarnpkg.com/@anycli/config/-/config-1.2.3.tgz#6bedf5111146c5563f74fde4fc89d74da7920c5a"
3814

3915
"@anycli/parser@^3.2.4":
4016
version "3.2.4"
4117
resolved "https://registry.yarnpkg.com/@anycli/parser/-/parser-3.2.4.tgz#30297ac2fa225b37efaab5c0062bf189988b3ce8"
4218

43-
"@anycli/plugin-help@^0.6.1":
44-
version "0.6.1"
45-
resolved "https://registry.yarnpkg.com/@anycli/plugin-help/-/plugin-help-0.6.1.tgz#07ad02818ec0a8982488e8c90beb3540dcecec43"
19+
"@anycli/plugin-help@^0.6.3":
20+
version "0.6.3"
21+
resolved "https://registry.yarnpkg.com/@anycli/plugin-help/-/plugin-help-0.6.3.tgz#e365947b69ce232cbd49fcda934dd53852d2503f"
4622
dependencies:
47-
"@anycli/command" "^1.2.4"
48-
"@anycli/screen" "^0.0.3"
23+
"@anycli/command" "^1.2.5"
4924
chalk "^2.3.0"
50-
cli-ux "^3.3.15"
5125
indent-string "^3.2.0"
52-
lodash "^4.17.5"
26+
lodash.template "^4.4.0"
5327
string-width "^2.1.1"
5428
widest-line "^2.0.0"
5529
wrap-ansi "^3.0.1"
5630

57-
"@anycli/plugin-not-found@^0.1.15":
58-
version "0.1.15"
59-
resolved "https://registry.yarnpkg.com/@anycli/plugin-not-found/-/plugin-not-found-0.1.15.tgz#738bdabd485081ee9172e0e4e4a3ee29d32178da"
31+
"@anycli/plugin-not-found@^0.1.16":
32+
version "0.1.16"
33+
resolved "https://registry.yarnpkg.com/@anycli/plugin-not-found/-/plugin-not-found-0.1.16.tgz#9dce1a1cabe3c5905b97638dd79325de6f62694f"
6034
dependencies:
61-
"@anycli/command" "^1.2.2"
35+
"@anycli/command" "^1.2.5"
6236
"@heroku-cli/color" "^1.1.3"
63-
cli-ux "^3.3.13"
6437
string-similarity "^1.2.0"
6538

6639
"@anycli/plugin-plugins@^0.2.11":
@@ -269,28 +242,8 @@ clean-stack@^1.3.0:
269242
resolved "https://registry.yarnpkg.com/clean-stack/-/clean-stack-1.3.0.tgz#9e821501ae979986c46b1d66d2d432db2fd4ae31"
270243

271244
cli-ux@^3.3.13:
272-
version "3.3.13"
273-
resolved "https://registry.yarnpkg.com/cli-ux/-/cli-ux-3.3.13.tgz#123e0c7a29d1f743447b919500a9055486992df6"
274-
dependencies:
275-
"@anycli/screen" "^0.0.3"
276-
"@heroku/linewrap" "^1.0.0"
277-
ansi-styles "^3.2.0"
278-
cardinal "^1.0.0"
279-
chalk "^2.3.0"
280-
clean-stack "^1.3.0"
281-
extract-stack "^1.0.0"
282-
fs-extra "^5.0.0"
283-
indent-string "^3.2.0"
284-
lodash "^4.17.4"
285-
node-notifier "^5.2.1"
286-
password-prompt "^1.0.4"
287-
semver "^5.5.0"
288-
strip-ansi "^4.0.0"
289-
supports-color "^5.1.0"
290-
291-
cli-ux@^3.3.15:
292-
version "3.3.15"
293-
resolved "https://registry.yarnpkg.com/cli-ux/-/cli-ux-3.3.15.tgz#8aaae7431e72779f80c115b3af14913a3a18bdf1"
245+
version "3.3.16"
246+
resolved "https://registry.yarnpkg.com/cli-ux/-/cli-ux-3.3.16.tgz#b542f781c89b03467d5417b7510bbce96559c325"
294247
dependencies:
295248
"@anycli/screen" "^0.0.3"
296249
"@heroku/linewrap" "^1.0.0"
@@ -362,7 +315,7 @@ date-fns@^1.23.0:
362315
version "1.29.0"
363316
resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-1.29.0.tgz#12e609cdcb935127311d04d33334e2960a2a54e6"
364317

365-
debug@*, debug@3.1.0, debug@^3.1.0:
318+
[email protected], debug@^3.1.0:
366319
version "3.1.0"
367320
resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261"
368321
dependencies:
@@ -477,10 +430,6 @@ [email protected]:
477430
version "1.10.3"
478431
resolved "https://registry.yarnpkg.com/growl/-/growl-1.10.3.tgz#1926ba90cf3edfe2adb4927f5880bc22c66c790f"
479432

480-
growly@^1.3.0:
481-
version "1.3.0"
482-
resolved "https://registry.yarnpkg.com/growly/-/growly-1.3.0.tgz#f10748cbe76af964b7c96c93c6bcc28af120c081"
483-
484433
has-ansi@^0.1.0:
485434
version "0.1.0"
486435
resolved "https://registry.yarnpkg.com/has-ansi/-/has-ansi-0.1.0.tgz#84f265aae8c0e6a88a12d7022894b7568894c62e"
@@ -595,11 +544,24 @@ load-json-file@^4.0.0:
595544
pify "^3.0.0"
596545
strip-bom "^3.0.0"
597546

598-
lodash@^4.13.1, lodash@^4.17.4, lodash@^4.5.1, lodash@~4.17.2:
599-
version "4.17.4"
600-
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae"
547+
lodash._reinterpolate@~3.0.0:
548+
version "3.0.0"
549+
resolved "https://registry.yarnpkg.com/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz#0ccf2d89166af03b3663c796538b75ac6e114d9d"
601550

602-
lodash@^4.17.5:
551+
lodash.template@^4.4.0:
552+
version "4.4.0"
553+
resolved "https://registry.yarnpkg.com/lodash.template/-/lodash.template-4.4.0.tgz#e73a0385c8355591746e020b99679c690e68fba0"
554+
dependencies:
555+
lodash._reinterpolate "~3.0.0"
556+
lodash.templatesettings "^4.0.0"
557+
558+
lodash.templatesettings@^4.0.0:
559+
version "4.1.0"
560+
resolved "https://registry.yarnpkg.com/lodash.templatesettings/-/lodash.templatesettings-4.1.0.tgz#2b4d4e95ba440d915ff08bc899e4553666713316"
561+
dependencies:
562+
lodash._reinterpolate "~3.0.0"
563+
564+
lodash@^4.13.1, lodash@^4.17.4, lodash@^4.5.1, lodash@~4.17.2:
603565
version "4.17.5"
604566
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.5.tgz#99a92d65c0272debe8c96b6057bc8fbfa3bed511"
605567

@@ -667,15 +629,6 @@ nock@^9.1.6:
667629
qs "^6.5.1"
668630
semver "^5.3.0"
669631

670-
node-notifier@^5.2.1:
671-
version "5.2.1"
672-
resolved "https://registry.yarnpkg.com/node-notifier/-/node-notifier-5.2.1.tgz#fa313dd08f5517db0e2502e5758d664ac69f9dea"
673-
dependencies:
674-
growly "^1.3.0"
675-
semver "^5.4.1"
676-
shellwords "^0.1.1"
677-
which "^1.3.0"
678-
679632
npm-run-path@^2.0.2:
680633
version "2.0.2"
681634
resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-2.0.2.tgz#35a9232dfa35d7067b4cb2ddf2357b1871536c5f"
@@ -758,7 +711,7 @@ safe-buffer@^5.0.1:
758711
version "5.1.1"
759712
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853"
760713

761-
semver@^5.3.0, semver@^5.4.1, semver@^5.5.0:
714+
semver@^5.3.0, semver@^5.5.0:
762715
version "5.5.0"
763716
resolved "https://registry.yarnpkg.com/semver/-/semver-5.5.0.tgz#dc4bbc7a6ca9d916dee5d43516f0092b58f7b8ab"
764717

@@ -772,10 +725,6 @@ shebang-regex@^1.0.0:
772725
version "1.0.0"
773726
resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3"
774727

775-
shellwords@^0.1.1:
776-
version "0.1.1"
777-
resolved "https://registry.yarnpkg.com/shellwords/-/shellwords-0.1.1.tgz#d6b9181c1a48d397324c84871efbcfc73fc0654b"
778-
779728
source-map-support@^0.5.0:
780729
version "0.5.3"
781730
resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.3.tgz#2b3d5fff298cfa4d1afd7d4352d569e9a0158e76"
@@ -795,10 +744,9 @@ sprintf-js@~1.0.2:
795744
resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c"
796745

797746
stdout-stderr@^0.1.6:
798-
version "0.1.6"
799-
resolved "https://registry.yarnpkg.com/stdout-stderr/-/stdout-stderr-0.1.6.tgz#82616602f639bf029c87ab1049b02640a39a18ba"
747+
version "0.1.7"
748+
resolved "https://registry.yarnpkg.com/stdout-stderr/-/stdout-stderr-0.1.7.tgz#f3f69391f3e721c2c52aa92fbfa18b8a6e9ce3df"
800749
dependencies:
801-
debug "*"
802750
strip-ansi "^4.0.0"
803751

804752
string-similarity@^1.2.0:
@@ -955,8 +903,8 @@ tsutils@^1.4.0:
955903
resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-1.9.1.tgz#b9f9ab44e55af9681831d5f28d0aeeaf5c750cb0"
956904

957905
tsutils@^2.12.1, tsutils@^2.12.2:
958-
version "2.19.1"
959-
resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-2.19.1.tgz#76d7ebdea9d7a7bf4a05f50ead3701b0168708d7"
906+
version "2.21.0"
907+
resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-2.21.0.tgz#43466a2283a0abce64e2209bc732ad72f8a04fab"
960908
dependencies:
961909
tslib "^1.8.1"
962910

@@ -975,8 +923,8 @@ type-detect@^1.0.0:
975923
resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-1.0.0.tgz#762217cc06db258ec48908a1298e8b95121e8ea2"
976924

977925
type-detect@^4.0.0:
978-
version "4.0.7"
979-
resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.7.tgz#862bd2cf6058ad92799ff5a5b8cf7b6cec726198"
926+
version "4.0.8"
927+
resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.8.tgz#7646fb5f18871cfbb7749e69bd39a6388eb7450c"
980928

981929
typescript@^2.7.1:
982930
version "2.7.1"
@@ -992,7 +940,7 @@ v8flags@^3.0.0:
992940
dependencies:
993941
homedir-polyfill "^1.0.1"
994942

995-
which@^1.2.9, which@^1.3.0:
943+
which@^1.2.9:
996944
version "1.3.0"
997945
resolved "https://registry.yarnpkg.com/which/-/which-1.3.0.tgz#ff04bdfc010ee547d780bec38e1ac1c2777d253a"
998946
dependencies:

0 commit comments

Comments
 (0)