diff --git a/.changes/use-clack-over-inquirer.md b/.changes/use-clack-over-inquirer.md new file mode 100644 index 00000000..f9b2b52a --- /dev/null +++ b/.changes/use-clack-over-inquirer.md @@ -0,0 +1,5 @@ +--- +"covector": minor:enhance +--- + +Use clack instead of inquirer for handling user input. The user experience is improved and the dependencies are more slim. Additionally, switch `getPublishedVersion` to `fetch:check` which provides a cleaner version check for the npm and crates registries. diff --git a/helpers/test-scope.ts b/helpers/test-scope.ts index ac611df3..2f2899bd 100644 --- a/helpers/test-scope.ts +++ b/helpers/test-scope.ts @@ -43,7 +43,8 @@ function describeWithScope( } describeWithScope.only = vitest.describe.only; -describeWithScope.ignore = vitest.describe.skip; +describeWithScope.skip = vitest.describe.skip; +describeWithScope.skipIf = vitest.describe.skipIf; export const describe = (describeWithScope); diff --git a/package-lock.json b/package-lock.json index 61ef8cb5..f2af10f3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -428,6 +428,43 @@ "node": ">=6.5" } }, + "node_modules/@clack/core": { + "version": "0.3.4", + "resolved": "https://registry.npmjs.org/@clack/core/-/core-0.3.4.tgz", + "integrity": "sha512-H4hxZDXgHtWTwV3RAVenqcC4VbJZNegbBjlPvzOzCouXtS2y3sDvlO3IsbrPNWuLWPPlYVYPghQdSF64683Ldw==", + "license": "MIT", + "dependencies": { + "picocolors": "^1.0.0", + "sisteransi": "^1.0.5" + } + }, + "node_modules/@clack/prompts": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/@clack/prompts/-/prompts-0.7.0.tgz", + "integrity": "sha512-0MhX9/B4iL6Re04jPrttDm+BsP8y6mS7byuv0BvXgdXhbV5PdlsHt55dvNsuBCPZ7xq1oTAOOuotR9NFbQyMSA==", + "bundleDependencies": [ + "is-unicode-supported" + ], + "license": "MIT", + "dependencies": { + "@clack/core": "^0.3.3", + "is-unicode-supported": "*", + "picocolors": "^1.0.0", + "sisteransi": "^1.0.5" + } + }, + "node_modules/@clack/prompts/node_modules/is-unicode-supported": { + "version": "1.3.0", + "extraneous": true, + "inBundle": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/@covector/apply": { "resolved": "packages/apply", "link": true @@ -1874,20 +1911,6 @@ "node": ">=6" } }, - "node_modules/ansi-escapes": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", - "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", - "dependencies": { - "type-fest": "^0.21.3" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/ansi-regex": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", @@ -2292,16 +2315,6 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/bl": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", - "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", - "dependencies": { - "buffer": "^5.5.0", - "inherits": "^2.0.4", - "readable-stream": "^3.4.0" - } - }, "node_modules/bottleneck": { "version": "2.19.5", "resolved": "https://registry.npmjs.org/bottleneck/-/bottleneck-2.19.5.tgz", @@ -2345,29 +2358,6 @@ "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", "peer": true }, - "node_modules/buffer": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", - "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "dependencies": { - "base64-js": "^1.3.1", - "ieee754": "^1.1.13" - } - }, "node_modules/buffer-crc32": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-1.0.0.tgz", @@ -2482,11 +2472,6 @@ "url": "https://github.com/sponsors/wooorm" } }, - "node_modules/chardet": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz", - "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==" - }, "node_modules/check-error": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.3.tgz", @@ -2536,36 +2521,6 @@ "node": ">=10" } }, - "node_modules/cli-cursor": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", - "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==", - "dependencies": { - "restore-cursor": "^3.1.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/cli-spinners": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.6.1.tgz", - "integrity": "sha512-x/5fWmGMnbKQAaNwN+UZlV79qBLM9JFnJuJ03gIi5whrob0xV0ofNVHy9DhwGdsMJQc2OKv0oGmLzvaqvAVv+g==", - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/cli-width": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-3.0.0.tgz", - "integrity": "sha512-FxqpkPPwu1HjuN93Omfm4h8uIanXofW0RxVEW3k5RKx+mJJYSthzNhp32Kzxxy3YAEZ/Dc/EWN1vZRY0+kOhbw==", - "engines": { - "node": ">= 10" - } - }, "node_modules/cliui": { "version": "7.0.4", "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", @@ -2577,14 +2532,6 @@ "wrap-ansi": "^7.0.0" } }, - "node_modules/clone": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz", - "integrity": "sha1-2jCcwmPfFZlMaIypAheco8fNfH4=", - "engines": { - "node": ">=0.8" - } - }, "node_modules/color-convert": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", @@ -2933,14 +2880,6 @@ "node": ">=6" } }, - "node_modules/defaults": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.3.tgz", - "integrity": "sha1-xlYFHpgX2f8I7YgUd/P+QBnz730=", - "dependencies": { - "clone": "^1.0.2" - } - }, "node_modules/delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", @@ -3104,14 +3043,6 @@ "node": ">=6" } }, - "node_modules/escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", - "engines": { - "node": ">=0.8.0" - } - }, "node_modules/escodegen": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-2.1.0.tgz", @@ -3274,19 +3205,6 @@ "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" }, - "node_modules/external-editor": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.1.0.tgz", - "integrity": "sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==", - "dependencies": { - "chardet": "^0.7.0", - "iconv-lite": "^0.4.24", - "tmp": "^0.0.33" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/fast-fifo": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/fast-fifo/-/fast-fifo-1.3.2.tgz", @@ -3369,20 +3287,6 @@ "dev": true, "license": "MIT" }, - "node_modules/figures": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz", - "integrity": "sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==", - "dependencies": { - "escape-string-regexp": "^1.0.5" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/fill-range": { "version": "7.1.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", @@ -3798,6 +3702,9 @@ "version": "0.4.24", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dev": true, + "optional": true, + "peer": true, "dependencies": { "safer-buffer": ">= 2.1.2 < 3" }, @@ -3846,31 +3753,6 @@ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, - "node_modules/inquirer": { - "version": "8.2.5", - "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-8.2.5.tgz", - "integrity": "sha512-QAgPDQMEgrDssk1XiwwHoOGYF9BAbUcc1+j+FhEvaOt8/cKRqyLn0U5qA6F74fGhTMGxf92pOvPBeh29jQJDTQ==", - "dependencies": { - "ansi-escapes": "^4.2.1", - "chalk": "^4.1.1", - "cli-cursor": "^3.1.0", - "cli-width": "^3.0.0", - "external-editor": "^3.0.3", - "figures": "^3.0.0", - "lodash": "^4.17.21", - "mute-stream": "0.0.8", - "ora": "^5.4.1", - "run-async": "^2.4.0", - "rxjs": "^7.5.5", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0", - "through": "^2.3.6", - "wrap-ansi": "^7.0.0" - }, - "engines": { - "node": ">=12.0.0" - } - }, "node_modules/is-alphabetical": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/is-alphabetical/-/is-alphabetical-1.0.4.tgz", @@ -3972,14 +3854,6 @@ "url": "https://github.com/sponsors/wooorm" } }, - "node_modules/is-interactive": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-interactive/-/is-interactive-1.0.0.tgz", - "integrity": "sha512-2HvIEKRoqS62guEC+qBjpvRubdX910WCMuJTZ+I9yvqKU2/12eSL549HMwtabb4oupdj2sMP50k+XJfB/8JE6w==", - "engines": { - "node": ">=8" - } - }, "node_modules/is-number": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", @@ -4031,6 +3905,7 @@ "version": "0.1.0", "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", + "peer": true, "engines": { "node": ">=10" }, @@ -4218,6 +4093,7 @@ "version": "4.1.0", "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", + "peer": true, "dependencies": { "chalk": "^4.1.0", "is-unicode-supported": "^0.1.0" @@ -4418,14 +4294,6 @@ "node": ">= 0.6" } }, - "node_modules/mimic-fn": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", - "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", - "engines": { - "node": ">=6" - } - }, "node_modules/minimatch": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", @@ -4685,11 +4553,6 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" }, - "node_modules/mute-stream": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", - "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==" - }, "node_modules/nanoid": { "version": "3.3.3", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.3.tgz", @@ -4814,50 +4677,6 @@ "wrappy": "1" } }, - "node_modules/onetime": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", - "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", - "dependencies": { - "mimic-fn": "^2.1.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/ora": { - "version": "5.4.1", - "resolved": "https://registry.npmjs.org/ora/-/ora-5.4.1.tgz", - "integrity": "sha512-5b6Y85tPxZZ7QytO+BQzysW31HJku27cRIlkbAXaNx+BdcVi+LlRFmVXzeF6a7JCwJpyw5c4b+YSVImQIrBpuQ==", - "dependencies": { - "bl": "^4.1.0", - "chalk": "^4.1.0", - "cli-cursor": "^3.1.0", - "cli-spinners": "^2.5.0", - "is-interactive": "^1.0.0", - "is-unicode-supported": "^0.1.0", - "log-symbols": "^4.1.0", - "strip-ansi": "^6.0.0", - "wcwidth": "^1.0.1" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/os-tmpdir": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", - "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/p-limit": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-5.0.0.tgz", @@ -5019,7 +4838,6 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.1.tgz", "integrity": "sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew==", - "dev": true, "license": "ISC" }, "node_modules/picomatch": { @@ -5334,19 +5152,6 @@ "dev": true, "license": "MIT" }, - "node_modules/readable-stream": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", - "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", - "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - }, - "engines": { - "node": ">= 6" - } - }, "node_modules/readdir-glob": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/readdir-glob/-/readdir-glob-1.1.3.tgz", @@ -5473,18 +5278,6 @@ "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" } }, - "node_modules/restore-cursor": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", - "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==", - "dependencies": { - "onetime": "^5.1.0", - "signal-exit": "^3.0.2" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/reusify": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", @@ -5608,14 +5401,6 @@ "fsevents": "~2.3.2" } }, - "node_modules/run-async": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.4.1.tgz", - "integrity": "sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ==", - "engines": { - "node": ">=0.12.0" - } - }, "node_modules/run-parallel": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", @@ -5642,6 +5427,7 @@ "version": "7.8.0", "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.0.tgz", "integrity": "sha512-F2+gxDshqmIub1KdvZkaEfGDwLNpPvk9Fs6LD/MyQxNgMds/WH9OdDDXOmxUZpME+iSK3rQCctkL0DYyytUqMg==", + "dev": true, "dependencies": { "tslib": "^2.1.0" } @@ -5663,7 +5449,10 @@ "node_modules/safer-buffer": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "dev": true, + "optional": true, + "peer": true }, "node_modules/saxes": { "version": "5.0.1", @@ -5723,7 +5512,8 @@ "node_modules/signal-exit": { "version": "3.0.7", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", - "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==" + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true }, "node_modules/sirv": { "version": "2.0.4", @@ -5740,6 +5530,12 @@ "node": ">= 10" } }, + "node_modules/sisteransi": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz", + "integrity": "sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==", + "license": "MIT" + }, "node_modules/slash": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", @@ -6052,11 +5848,6 @@ "real-require": "^0.2.0" } }, - "node_modules/through": { - "version": "2.3.8", - "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", - "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=" - }, "node_modules/tinybench": { "version": "2.8.0", "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.8.0.tgz", @@ -6084,17 +5875,6 @@ "node": ">=14.0.0" } }, - "node_modules/tmp": { - "version": "0.0.33", - "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", - "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", - "dependencies": { - "os-tmpdir": "~1.0.2" - }, - "engines": { - "node": ">=0.6.0" - } - }, "node_modules/to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", @@ -6212,6 +5992,7 @@ "version": "2.6.3", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.3.tgz", "integrity": "sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ==", + "dev": true, "license": "0BSD" }, "node_modules/tsx": { @@ -6282,17 +6063,6 @@ "node": ">=4" } }, - "node_modules/type-fest": { - "version": "0.21.3", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", - "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/typescript": { "version": "5.4.5", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.5.tgz", @@ -6428,7 +6198,8 @@ "node_modules/util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", + "dev": true }, "node_modules/uuid": { "version": "8.3.2", @@ -6652,14 +6423,6 @@ "wasm-pack": "run.js" } }, - "node_modules/wcwidth": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz", - "integrity": "sha1-8LDc+RW8X/FSivrbLA4XtTLaL+g=", - "dependencies": { - "defaults": "^1.0.3" - } - }, "node_modules/webidl-conversions": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-6.1.0.tgz", @@ -7134,6 +6897,7 @@ "version": "0.11.0", "license": "Apache-2.0", "dependencies": { + "@clack/prompts": "^0.7.0", "@covector/apply": "0.9.3", "@covector/assemble": "0.11.0", "@covector/changelog": "0.11.0", @@ -7141,7 +6905,6 @@ "@covector/files": "0.7.2", "effection": "^2.0.6", "globby": "^11.1.0", - "inquirer": "^8.2.5", "js-yaml": "^4.1.0", "lodash": "^4.17.21", "pino": "^9.1.0", @@ -7159,6 +6922,9 @@ "fixturez": "^1.1.0", "tslib": "^2.5.0", "typescript": "^4.9.5" + }, + "engines": { + "node": ">=18" } }, "packages/covector/node_modules/cliui": { @@ -7601,6 +7367,33 @@ "event-target-shim": "^5.0.0" } }, + "@clack/core": { + "version": "0.3.4", + "resolved": "https://registry.npmjs.org/@clack/core/-/core-0.3.4.tgz", + "integrity": "sha512-H4hxZDXgHtWTwV3RAVenqcC4VbJZNegbBjlPvzOzCouXtS2y3sDvlO3IsbrPNWuLWPPlYVYPghQdSF64683Ldw==", + "requires": { + "picocolors": "^1.0.0", + "sisteransi": "^1.0.5" + } + }, + "@clack/prompts": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/@clack/prompts/-/prompts-0.7.0.tgz", + "integrity": "sha512-0MhX9/B4iL6Re04jPrttDm+BsP8y6mS7byuv0BvXgdXhbV5PdlsHt55dvNsuBCPZ7xq1oTAOOuotR9NFbQyMSA==", + "requires": { + "@clack/core": "^0.3.3", + "is-unicode-supported": "*", + "picocolors": "^1.0.0", + "sisteransi": "^1.0.5" + }, + "dependencies": { + "is-unicode-supported": { + "version": "1.3.0", + "bundled": true, + "extraneous": true + } + } + }, "@covector/apply": { "version": "file:packages/apply", "requires": { @@ -8634,14 +8427,6 @@ "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", "peer": true }, - "ansi-escapes": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", - "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", - "requires": { - "type-fest": "^0.21.3" - } - }, "ansi-regex": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", @@ -8910,16 +8695,6 @@ } } }, - "bl": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", - "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", - "requires": { - "buffer": "^5.5.0", - "inherits": "^2.0.4", - "readable-stream": "^3.4.0" - } - }, "bottleneck": { "version": "2.19.5", "resolved": "https://registry.npmjs.org/bottleneck/-/bottleneck-2.19.5.tgz", @@ -8957,15 +8732,6 @@ "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", "peer": true }, - "buffer": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", - "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", - "requires": { - "base64-js": "^1.3.1", - "ieee754": "^1.1.13" - } - }, "buffer-crc32": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-1.0.0.tgz", @@ -9042,11 +8808,6 @@ "resolved": "https://registry.npmjs.org/character-reference-invalid/-/character-reference-invalid-1.1.4.tgz", "integrity": "sha512-mKKUkUbhPpQlCOfIuZkvSEgktjPFIsZKRRbC6KWVEMvlzblj3i3asQv5ODsrwt0N3pHAEvjP8KTQPHkp0+6jOg==" }, - "chardet": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz", - "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==" - }, "check-error": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.3.tgz", @@ -9078,24 +8839,6 @@ "integrity": "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==", "dev": true }, - "cli-cursor": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", - "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==", - "requires": { - "restore-cursor": "^3.1.0" - } - }, - "cli-spinners": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.6.1.tgz", - "integrity": "sha512-x/5fWmGMnbKQAaNwN+UZlV79qBLM9JFnJuJ03gIi5whrob0xV0ofNVHy9DhwGdsMJQc2OKv0oGmLzvaqvAVv+g==" - }, - "cli-width": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-3.0.0.tgz", - "integrity": "sha512-FxqpkPPwu1HjuN93Omfm4h8uIanXofW0RxVEW3k5RKx+mJJYSthzNhp32Kzxxy3YAEZ/Dc/EWN1vZRY0+kOhbw==" - }, "cliui": { "version": "7.0.4", "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", @@ -9107,11 +8850,6 @@ "wrap-ansi": "^7.0.0" } }, - "clone": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz", - "integrity": "sha1-2jCcwmPfFZlMaIypAheco8fNfH4=" - }, "color-convert": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", @@ -9206,6 +8944,7 @@ "covector": { "version": "file:packages/covector", "requires": { + "@clack/prompts": "^0.7.0", "@covector/apply": "0.9.3", "@covector/assemble": "0.11.0", "@covector/changelog": "0.11.0", @@ -9217,7 +8956,6 @@ "effection": "^2.0.6", "fixturez": "^1.1.0", "globby": "^11.1.0", - "inquirer": "^8.2.5", "js-yaml": "^4.1.0", "lodash": "^4.17.21", "pino": "^9.1.0", @@ -9414,14 +9152,6 @@ "type-detect": "^4.0.0" } }, - "defaults": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.3.tgz", - "integrity": "sha1-xlYFHpgX2f8I7YgUd/P+QBnz730=", - "requires": { - "clone": "^1.0.2" - } - }, "delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", @@ -9547,11 +9277,6 @@ "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.2.tgz", "integrity": "sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA==" }, - "escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" - }, "escodegen": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-2.1.0.tgz", @@ -9654,16 +9379,6 @@ "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" }, - "external-editor": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.1.0.tgz", - "integrity": "sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==", - "requires": { - "chardet": "^0.7.0", - "iconv-lite": "^0.4.24", - "tmp": "^0.0.33" - } - }, "fast-fifo": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/fast-fifo/-/fast-fifo-1.3.2.tgz", @@ -9718,14 +9433,6 @@ "integrity": "sha512-cPJU47OaAoCbg0pBvzsgpTPhmhqI5eJjh/JIu8tPj5q+T7iLvW/JAYUqmE7KOB4R1ZyEhzBaIQpQpardBF5z8A==", "dev": true }, - "figures": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz", - "integrity": "sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==", - "requires": { - "escape-string-regexp": "^1.0.5" - } - }, "fill-range": { "version": "7.1.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", @@ -10020,6 +9727,9 @@ "version": "0.4.24", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dev": true, + "optional": true, + "peer": true, "requires": { "safer-buffer": ">= 2.1.2 < 3" } @@ -10048,28 +9758,6 @@ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, - "inquirer": { - "version": "8.2.5", - "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-8.2.5.tgz", - "integrity": "sha512-QAgPDQMEgrDssk1XiwwHoOGYF9BAbUcc1+j+FhEvaOt8/cKRqyLn0U5qA6F74fGhTMGxf92pOvPBeh29jQJDTQ==", - "requires": { - "ansi-escapes": "^4.2.1", - "chalk": "^4.1.1", - "cli-cursor": "^3.1.0", - "cli-width": "^3.0.0", - "external-editor": "^3.0.3", - "figures": "^3.0.0", - "lodash": "^4.17.21", - "mute-stream": "0.0.8", - "ora": "^5.4.1", - "run-async": "^2.4.0", - "rxjs": "^7.5.5", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0", - "through": "^2.3.6", - "wrap-ansi": "^7.0.0" - } - }, "is-alphabetical": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/is-alphabetical/-/is-alphabetical-1.0.4.tgz", @@ -10126,11 +9814,6 @@ "resolved": "https://registry.npmjs.org/is-hexadecimal/-/is-hexadecimal-1.0.4.tgz", "integrity": "sha512-gyPJuv83bHMpocVYoqof5VDiZveEoGoFL8m3BXNb2VW8Xs+rz9kqO8LOQ5DH6EsuvilT1ApazU0pyl+ytbPtlw==" }, - "is-interactive": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-interactive/-/is-interactive-1.0.0.tgz", - "integrity": "sha512-2HvIEKRoqS62guEC+qBjpvRubdX910WCMuJTZ+I9yvqKU2/12eSL549HMwtabb4oupdj2sMP50k+XJfB/8JE6w==" - }, "is-number": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", @@ -10163,7 +9846,8 @@ "is-unicode-supported": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", - "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==" + "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", + "peer": true }, "isarray": { "version": "1.0.0", @@ -10306,6 +9990,7 @@ "version": "4.1.0", "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", + "peer": true, "requires": { "chalk": "^4.1.0", "is-unicode-supported": "^0.1.0" @@ -10445,11 +10130,6 @@ "mime-db": "1.52.0" } }, - "mimic-fn": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", - "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==" - }, "minimatch": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", @@ -10633,11 +10313,6 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" }, - "mute-stream": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", - "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==" - }, "nanoid": { "version": "3.3.3", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.3.tgz", @@ -10726,35 +10401,6 @@ "wrappy": "1" } }, - "onetime": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", - "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", - "requires": { - "mimic-fn": "^2.1.0" - } - }, - "ora": { - "version": "5.4.1", - "resolved": "https://registry.npmjs.org/ora/-/ora-5.4.1.tgz", - "integrity": "sha512-5b6Y85tPxZZ7QytO+BQzysW31HJku27cRIlkbAXaNx+BdcVi+LlRFmVXzeF6a7JCwJpyw5c4b+YSVImQIrBpuQ==", - "requires": { - "bl": "^4.1.0", - "chalk": "^4.1.0", - "cli-cursor": "^3.1.0", - "cli-spinners": "^2.5.0", - "is-interactive": "^1.0.0", - "is-unicode-supported": "^0.1.0", - "log-symbols": "^4.1.0", - "strip-ansi": "^6.0.0", - "wcwidth": "^1.0.1" - } - }, - "os-tmpdir": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", - "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=" - }, "p-limit": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-5.0.0.tgz", @@ -10869,8 +10515,7 @@ "picocolors": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.1.tgz", - "integrity": "sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew==", - "dev": true + "integrity": "sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew==" }, "picomatch": { "version": "2.3.1", @@ -11073,16 +10718,6 @@ "integrity": "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==", "dev": true }, - "readable-stream": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", - "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", - "requires": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - } - }, "readdir-glob": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/readdir-glob/-/readdir-glob-1.1.3.tgz", @@ -11175,15 +10810,6 @@ "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==", "dev": true }, - "restore-cursor": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", - "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==", - "requires": { - "onetime": "^5.1.0", - "signal-exit": "^3.0.2" - } - }, "reusify": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", @@ -11263,11 +10889,6 @@ "fsevents": "~2.3.2" } }, - "run-async": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.4.1.tgz", - "integrity": "sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ==" - }, "run-parallel": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", @@ -11280,6 +10901,7 @@ "version": "7.8.0", "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.0.tgz", "integrity": "sha512-F2+gxDshqmIub1KdvZkaEfGDwLNpPvk9Fs6LD/MyQxNgMds/WH9OdDDXOmxUZpME+iSK3rQCctkL0DYyytUqMg==", + "dev": true, "requires": { "tslib": "^2.1.0" } @@ -11297,7 +10919,10 @@ "safer-buffer": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "dev": true, + "optional": true, + "peer": true }, "saxes": { "version": "5.0.1", @@ -11346,7 +10971,8 @@ "signal-exit": { "version": "3.0.7", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", - "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==" + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true }, "sirv": { "version": "2.0.4", @@ -11359,6 +10985,11 @@ "totalist": "^3.0.0" } }, + "sisteransi": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz", + "integrity": "sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==" + }, "slash": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", @@ -11584,11 +11215,6 @@ "real-require": "^0.2.0" } }, - "through": { - "version": "2.3.8", - "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", - "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=" - }, "tinybench": { "version": "2.8.0", "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.8.0.tgz", @@ -11607,14 +11233,6 @@ "integrity": "sha512-KYad6Vy5VDWV4GH3fjpseMQ/XU2BhIYP7Vzd0LG44qRWm/Yt2WCOTicFdvmgo6gWaqooMQCawTtILVQJupKu7A==", "dev": true }, - "tmp": { - "version": "0.0.33", - "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", - "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", - "requires": { - "os-tmpdir": "~1.0.2" - } - }, "to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", @@ -11696,7 +11314,8 @@ "tslib": { "version": "2.6.3", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.3.tgz", - "integrity": "sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ==" + "integrity": "sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ==", + "dev": true }, "tsx": { "version": "4.11.0", @@ -11734,11 +11353,6 @@ "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", "dev": true }, - "type-fest": { - "version": "0.21.3", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", - "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==" - }, "typescript": { "version": "5.4.5", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.5.tgz", @@ -11842,7 +11456,8 @@ "util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", + "dev": true }, "uuid": { "version": "8.3.2", @@ -11953,14 +11568,6 @@ "binary-install": "^1.0.1" } }, - "wcwidth": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz", - "integrity": "sha1-8LDc+RW8X/FSivrbLA4XtTLaL+g=", - "requires": { - "defaults": "^1.0.3" - } - }, "webidl-conversions": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-6.1.0.tgz", diff --git a/packages/action/tsconfig.json b/packages/action/tsconfig.json index f914c5b2..f4898cdb 100644 --- a/packages/action/tsconfig.json +++ b/packages/action/tsconfig.json @@ -2,7 +2,8 @@ "compilerOptions": { "esModuleInterop": true, "target": "es2015", - "moduleResolution": "node" + "moduleResolution": "node", + "resolveJsonModule": true }, "include": ["./src"] } diff --git a/packages/covector/package.json b/packages/covector/package.json index 1808a521..16ae8130 100644 --- a/packages/covector/package.json +++ b/packages/covector/package.json @@ -8,6 +8,9 @@ "type": "git", "url": "https://github.com/jbolda/covector.git" }, + "engines": { + "node": ">=18" + }, "main": "dist/index.js", "types": "dist/index.d.ts", "exports": { @@ -28,6 +31,7 @@ "test": "vitest" }, "dependencies": { + "@clack/prompts": "^0.7.0", "@covector/apply": "0.9.3", "@covector/assemble": "0.11.0", "@covector/changelog": "0.11.0", @@ -35,7 +39,6 @@ "@covector/files": "0.7.2", "effection": "^2.0.6", "globby": "^11.1.0", - "inquirer": "^8.2.5", "js-yaml": "^4.1.0", "lodash": "^4.17.21", "pino": "^9.1.0", diff --git a/packages/covector/src/add.ts b/packages/covector/src/add.ts index bfeae557..1638e9be 100644 --- a/packages/covector/src/add.ts +++ b/packages/covector/src/add.ts @@ -1,12 +1,27 @@ +import { + cancel, + intro, + isCancel, + multiselect, + outro, + select, + text, +} from "@clack/prompts"; import { type Logger } from "@covector/types"; -import inquirer from "inquirer"; -import { default as fsDefault } from "fs"; -// this is compatible with node@12+ -const fs = fsDefault.promises; +import { writeFile } from "fs/promises"; +import { existsSync } from "fs"; import { join } from "path"; import { configFile } from "@covector/files"; - import type { ConfigFile } from "@covector/types"; +import { sh } from "@covector/command"; + +const exit = (value: any) => { + if (isCancel(value)) { + cancel(`Skipping creating change file.`); + return true; + } + return false; +}; export const add = function* ({ logger, @@ -22,87 +37,97 @@ export const add = function* ({ const config: ConfigFile = yield configFile({ cwd }); let packageBumps: { [k: string]: { bump: string; changeTag?: string } } = {}; - const answers: { packages: string[] } = yield inquirer.prompt([ - { - type: "checkbox", - message: "Select packages which need a version bump.", - name: "packages", - choices: Object.keys(config.packages).map((pkg) => ({ name: pkg })), - validate(answer) { - if (answer.length < 1) { - return "You must choose at least one package."; - } - return true; - }, - }, - ]); + intro(`What have we changed?`); + + const packagesWithBump: string[] = yield multiselect({ + message: "Select packages which need a version bump.", + options: Object.keys(config.packages).map((pkg) => ({ + value: pkg, + label: pkg, + })), + }); - for (let pkg of answers.packages) { - const { bump } = yield inquirer.prompt({ - type: "list", + if (exit(packagesWithBump)) return "skipped"; + + for (let pkg of packagesWithBump) { + const additionalBumpTypes = config.additionalBumpTypes + ? config.additionalBumpTypes + : []; + const bump = yield select({ message: `bump ${pkg} with?`, - name: "bump", - choices: ["patch", "minor", "major"].concat( - config.additionalBumpTypes ? config.additionalBumpTypes : [] - ), + options: ["patch", "minor", "major"] + .concat(additionalBumpTypes) + .map((bumpKind) => ({ + value: bumpKind, + label: bumpKind, + hint: additionalBumpTypes.includes(bumpKind) + ? "won't affect the version number" + : undefined, + })), }); + + if (exit(bump)) return "skipped"; + let changeTag; if (config?.changeTags) { const tags = Object.keys(config.changeTags); - const addTag = yield inquirer.prompt({ - type: "list", - name: "changeTag", - message: `bump ${pkg} with?`, - choices: ["none"].concat(tags), + const addTag = yield select({ + message: `tag ${pkg} ${bump} bump with?`, + options: ["none"].concat(tags).map((t) => ({ value: t, label: t })), }); - if (addTag.changeTag !== "none") changeTag = addTag.changeTag; + if (addTag !== "none") changeTag = addTag; + + if (exit(addTag)) return "skipped"; } packageBumps[pkg] = { bump, changeTag }; } - const summary = yield inquirer.prompt({ - type: "input", - name: "input", + const summary: string = yield text({ message: `Please summarize the changes that occurred.`, - validate(answer) { - if (answer.length < 1) { - return "You must enter a summary."; - } - return true; + validate(value: string) { + if (value.length === 0) return "You must enter a summary."; }, }); + if (exit(summary)) return "skipped"; - const file = yield inquirer.prompt({ - type: "input", - name: "name", + let branchName = "change-file.md"; + try { + const currentBranch = yield sh( + "git branch --show-current", + {}, + false, + logger + ); + branchName = `${currentBranch?.out ?? branchName}.md`; + } catch (error) { + // ignore, filled for convenience + } + const filename: string = yield text({ message: `Please name the change file.`, + initialValue: branchName, validate(answer) { - if (answer.length < 1) { - return "You must enter a file name."; - } - return true; - }, - filter: (input) => { - if (input.endsWith(".md")) { - return input; - } else { - return `${input}.md`; - } + if (answer.length === 0) return "You must enter a file name."; + if (!answer.endsWith(".md")) + return "File name must end with the .md file extension."; + if (existsSync(join(cwd, changeFolder, `${answer}`))) + return `Change file ${join(changeFolder, `${answer}`)} already exists. Use a different filename.`; }, }); + if (exit(filename)) return "skipped"; const frontmatter = `--- -${answers.packages +${packagesWithBump .map( - (pkg) => + (pkg: string) => `"${pkg}": ${packageBumps[pkg].bump}${packageBumps[pkg].changeTag ? `:${packageBumps[pkg].changeTag}` : ``}` ) .join("\n")} ---\n\n`; - const content = `${frontmatter}${summary.input}\n`; + const content = `${frontmatter}${summary}\n`; - yield fs.writeFile(join(cwd, changeFolder, `${file.name}`), content); + yield writeFile(join(cwd, changeFolder, `${filename}`), content); + outro(`Change file written to ${join(changeFolder, `${filename}`)}`); return "complete"; }; diff --git a/packages/covector/src/init.ts b/packages/covector/src/init.ts index 8b2991a8..2fa345f0 100644 --- a/packages/covector/src/init.ts +++ b/packages/covector/src/init.ts @@ -1,14 +1,12 @@ -import { type Logger } from "@covector/types"; -import inquirer from "inquirer"; import globby from "globby"; -import { default as fsDefault, Dir } from "fs"; -// this is compatible with node@12+ -const fs = fsDefault.promises; +import { intro, outro, group, cancel, text, confirm } from "@clack/prompts"; +import * as fs from "fs/promises"; +import type { Dir } from "fs"; import path from "path"; import { all } from "effection"; import { readPkgFile } from "@covector/files"; import type { PackageFile } from "@covector/types"; -const covectorPackageFile = require("../package.json"); +import { type Logger } from "@covector/types"; export const init = function* init({ logger, @@ -26,12 +24,22 @@ export const init = function* init({ [k: string]: { path: string; manager: string; dependencies?: string[] }; } = {}; let pkgManagers: { [k: string]: boolean } = {}; - let gitURL: boolean | string = false; + let gitURL: string | undefined; const pkgFiles: PackageFile[] = yield all( - pkgs.map((pkg: string) => readPkgFile({ file: pkg, nickname: pkg, cwd })) + pkgs.map( + (pkg: string) => + function* () { + try { + return yield readPkgFile({ file: pkg, nickname: pkg, cwd }); + } catch (error) { + return undefined; + } + } + ) ); for (let pkgFile of pkgFiles) { + if (!pkgFile) continue; if (!pkgFile?.pkg?.workspaces) { const manager: string = yield derivePkgManager({ path: path.dirname(`./${pkgFile.name}`), @@ -72,43 +80,52 @@ export const init = function* init({ } } - const answers: { [k: string]: string } = yield inquirer - .prompt([ - { - type: "input", - name: "git url", - message: "What is the url to your github repo?", - when: !yes, - ...(!gitURL ? {} : { default: gitURL }), - filter: (userInput, answers) => { - if (userInput.endsWith("/")) { - return userInput; - } else { - return userInput.length > 0 ? `${userInput}/` : userInput; - } + intro(`Initializing Covector${yes ? " with defaults" : ""}`); + const defaults = async () => ({ + gitSiteUrl: gitURL, + gh: true, + defaultBranch: "main", + }); + + const questions = yes + ? defaults() + : group( + { + gitSiteUrl: async () => { + const userInput = await text({ + message: "What is the url to your GitHub repo?", + defaultValue: gitURL, + placeholder: gitURL, + }); + if (typeof userInput !== "string") return userInput; + return userInput.endsWith("/") ? userInput : `${userInput}/`; + }, + gh: () => + confirm({ + message: "should we include GitHub Action workflows?", + }), + defaultBranch: () => + text({ + message: "What is the name of your default branch?", + defaultValue: "main", + placeholder: "main", + }), }, - }, - { - type: "confirm", - name: "github actions", - message: "should we include github action workflows?", - default: true, - when: !yes, - }, - { - type: "input", - name: "branch name", - message: "What is the name of your default branch?", - default: "main", - when: (answers) => !yes && answers["github actions"], - }, - ]) - .then((answers) => { - return { "github actions": true, ...answers }; - }) - .catch((error) => { - throw new Error(error); - }); + { + onCancel: ({ results }) => { + cancel("Cancelled Covector intialization."); + process.exit(0); + }, + } + ); + const answers: Awaited = yield questions; + outro("Generating files..."); + + // https://github.com/bombshell-dev/clack/issues/134 + // stdin seems to get "stuck", this shakes it up and allows the process to complete + // this is currently only noted to occur in tests + // However adding this line then means that Windows never finishes the process. + // process.stdin.resume(); try { const testOpen: Dir = yield fs.opendir(path.posix.join(cwd, changeFolder)); @@ -121,15 +138,24 @@ export const init = function* init({ const javascript = { version: true, - getPublishedVersion: "npm view ${ pkgFile.pkg.name } version", + getPublishedVersion: { + use: "fetch:check", + options: { + url: "https://registry.npmjs.com/${ pkg.pkg }/${ pkg.pkgFile.version }", + }, + }, publish: ["npm publish --access public"], }; const rust = { version: true, - getPublishedVersion: - 'cargo search ${ pkg.pkg } --limit 1 | sed -nE \'s/^[^"]*"//; s/".*//1p\' -', - publish: ["cargo publish"], + getPublishedVersion: { + use: "fetch:check", + options: { + url: "https://crates.io/api/v1/crates/${ pkg.pkg }/${ pkg.pkgFile.version }", + }, + }, + publish: ["cargo publish --no-verify --allow-dirty"], }; const githubAction = { @@ -144,7 +170,7 @@ export const init = function* init({ }; const config = { - ...(answers["git url"] ? { gitSiteUrl: answers["git url"] } : {}), + ...(answers?.gitSiteUrl ? { gitSiteUrl: answers.gitSiteUrl } : {}), pkgManagers: { ...(pkgManagers.javascript ? { javascript } : {}), ...(pkgManagers.rust ? { rust } : {}), @@ -186,9 +212,11 @@ export const init = function* init({ yield fs.writeFile(path.posix.join(cwd, changeFolder, "readme.md"), readme); } - if (answers["github actions"]) { - const covectorVersionSplit = covectorPackageFile.version.split("."); - let covectorVersion: string = `${covectorVersionSplit[0]}.${covectorVersionSplit[1]}`; + if (answers.gh) { + const covectorPackageFile = yield import("../package.json"); + const covectorVersionSplit: string[] = + covectorPackageFile.version.split("."); + let covectorVersion = `${covectorVersionSplit[0]}.${covectorVersionSplit[1]}`; try { const testOpen: Dir = yield fs.opendir( @@ -251,13 +279,15 @@ export const init = function* init({ ), githubPublishWorkflow({ pkgManagers, - branchName: answers["branch name"], + branchName: answers.defaultBranch, version: covectorVersion, }) ); } } + // It seems to get stuck on Windows and not close with the resume // + process.exit(); return "complete"; }; diff --git a/packages/covector/src/run.ts b/packages/covector/src/run.ts index 49724c58..e4e50438 100644 --- a/packages/covector/src/run.ts +++ b/packages/covector/src/run.ts @@ -8,7 +8,6 @@ import { preview } from "./preview"; import { publish } from "./publish"; import { arbitrary } from "./arbitrary"; import { ChangeContext } from "../../types/src"; -import { ensure, sleep } from "effection"; export function* covector({ // shared diff --git a/packages/covector/test/cli/__snapshots__/command-init.test.ts.snap b/packages/covector/test/cli/__snapshots__/command-init.test.ts.snap index 371bd5c3..bcfffdbb 100644 --- a/packages/covector/test/cli/__snapshots__/command-init.test.ts.snap +++ b/packages/covector/test/cli/__snapshots__/command-init.test.ts.snap @@ -1,15 +1,33 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`integration test for init command > runs on a workspace 1`] = ` -"? What is the url to your github repo? -? should we include github action workflows? (Y/n) -? What is the name of your default branch? (main) +"│ +◆ What is the url to your GitHub repo? +│ _ +└ +│ +◆ should we include GitHub Action workflows? +│ ● Yes / ○ No +└ +│ +◆ What is the name of your default branch? +│ main +└ " `; exports[`integration test for init command > sets gitSiteUrl default to repo url 1`] = ` -"? What is the url to your github repo? (https://www.github.com/jbolda/covector) -? should we include github action workflows? (Y/n) -? What is the name of your default branch? (main) +"│ +◆ What is the url to your GitHub repo? +│ https://www.github.com/jbolda/covector +└ +│ +◆ should we include GitHub Action workflows? +│ ● Yes / ○ No +└ +│ +◆ What is the name of your default branch? +│ main +└ " `; diff --git a/packages/covector/test/cli/command-init.test.ts b/packages/covector/test/cli/command-init.test.ts index e2944806..7504e3fa 100644 --- a/packages/covector/test/cli/command-init.test.ts +++ b/packages/covector/test/cli/command-init.test.ts @@ -5,7 +5,10 @@ import { command, runCommand } from "../helpers"; import fixtures from "fixturez"; const f = fixtures(__dirname); -describe("integration test for init command", () => { +import os from 'node:os'; +const isWindows = os.platform() === 'win32'; + +describe.skipIf(isWindows)("integration test for init command", () => { it("runs on a workspace", function* () { const fullIntegration = f.copy("pkg.js-yarn-workspace"); const gitSiteUrl = "https://example.com"; @@ -13,13 +16,11 @@ describe("integration test for init command", () => { command("init", fullIntegration), fullIntegration, [ - [/^\? What is the url to your github repo\?$/, gitSiteUrl], - [/^\? should we include github action workflows\? \(Y\/n\)$/, "Y"], - [ - /^\? What is the name of your default branch\? \(main\)$/, - "pressEnter", - ], - ] + [/What is the url to your GitHub repo/, gitSiteUrl], + [/should we include GitHub Action workflows/, "pressEnter"], + [/What is the name of your default branch/, "pressEnter"], + ], + 14900 ); expect(stderr).toBe(""); @@ -30,7 +31,7 @@ describe("integration test for init command", () => { const config = yield loadFile("./.changes/config.json", fullIntegration); expect(config.path).toEqual(".changes/config.json"); expect(JSON.parse(config.content).gitSiteUrl).toBe(`${gitSiteUrl}/`); - }); + }, 15000); it("sets gitSiteUrl default to repo url", function* () { const fullIntegration = f.copy("pkg.js-single-json"); @@ -38,12 +39,9 @@ describe("integration test for init command", () => { command("init", fullIntegration), fullIntegration, [ - [/\? What is the url to your github repo\? \(.+\)$/, "pressEnter"], - [/\? should we include github action workflows\? \(Y\/n\)$/, "Y"], - [ - /\? What is the name of your default branch\? \(main\)$/, - "pressEnter", - ], + [/What is the url to your GitHub repo/, "pressEnter"], + [/should we include GitHub Action workflows/, "pressEnter"], + [/What is the name of your default branch/, "pressEnter"], ] ); diff --git a/packages/covector/test/helpers.ts b/packages/covector/test/helpers.ts index 165368a4..edcac2da 100644 --- a/packages/covector/test/helpers.ts +++ b/packages/covector/test/helpers.ts @@ -64,7 +64,8 @@ type Responses = [q: string | RegExp, a: string][]; export function* runCommand( command: string, cwd: string, - responses: Responses = [] + responses: Responses = [], + timeout: number = 5000 ): Operation<{ stdout: string; stderr: string; @@ -78,35 +79,40 @@ export function* runCommand( let responded = ""; try { const debug = false; - const runCommand: Process = yield exec(command, { cwd }); + const commandExec: Process = yield exec(command, { cwd }); const elegantlyRespond = responses.length > 0; + let responseCount = 0; yield spawn( - runCommand.stdout.forEach(function* (chunk) { + commandExec.stdout.forEach(function* (chunk) { stdoutBuffer = Buffer.concat([stdoutBuffer, chunk]); if (elegantlyRespond) { - const lastMessage = chunk - .toString("utf-8") - .split("\n") - .map((ansied) => stripAnsi(ansied).trim()) - .filter((message) => message.length > 0) - .pop(); + const lastMessage = stripAnsi(chunk.toString("utf-8")).trim(); - if (debug) console.log(lastMessage); - responded += tryResponse({ responses, runCommand, lastMessage }); + if (debug) + console.dir({ /* stdout: stdoutBuffer.toString(), */ lastMessage }); + const response = tryResponse({ + responseCount, + responses, + commandExec, + lastMessage, + }); + if (response.length > 0) responseCount = responseCount + 1; + + responded += response; } else { - runCommand.stdin.send(pressEnter); + commandExec.stdin.send(pressEnter); } }) ); yield spawn( - runCommand.stderr.forEach((chunk) => { + commandExec.stderr.forEach((chunk) => { stderrBuffer = Buffer.concat([stderrBuffer, chunk]); }) ); - let status = yield withTimeout(24900, runCommand.join()); + let status = yield withTimeout(timeout, commandExec.join()); stdout = stripAnsi(stdoutBuffer.toString("utf-8").trim()); stderr = stripAnsi(stderrBuffer.toString("utf-8").trim()); @@ -126,25 +132,29 @@ export function* runCommand( const pressEnter = String.fromCharCode(13); const tryResponse = ({ + responseCount, responses, - runCommand, + commandExec, lastMessage, }: { + responseCount: number; responses: Responses; - runCommand: Process; + commandExec: Process; lastMessage?: string; }) => { - for (let [question, answer] of responses) { - if (lastMessage && lastMessage.match(question)) { - if (answer === "pressEnter") { - // console.log(`sending Enter to ${lastMessage}`); - runCommand.stdin.send(pressEnter); - } else { - // console.log(`sending ${answer} to ${lastMessage}`); - runCommand.stdin.send(answer + pressEnter); - } - return lastMessage.trim() + "\n"; + if (responseCount >= responses.length) { + return ""; + } + const [question, answer] = responses[responseCount]; + if (lastMessage && lastMessage.match(question)) { + if (answer === "pressEnter") { + // console.log(`sending Enter to ${lastMessage}`); + commandExec.stdin.send(pressEnter); + } else { + // console.log(`sending ${answer} to ${lastMessage}`); + commandExec.stdin.send(answer + pressEnter); } + return lastMessage.trim() + "\n"; } return ""; };