Skip to content

chore: update dependency @types/yargs to v17 #2613

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion @commitlint/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"devDependencies": {
"@commitlint/test": "^12.1.4",
"@commitlint/utils": "^12.1.4",
"@types/yargs": "^16.0.0",
"@types/yargs": "^17.0.0",
"execa": "^5.0.0",
"fs-extra": "^10.0.0"
},
Expand Down
21 changes: 18 additions & 3 deletions @commitlint/cli/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import read from '@commitlint/read';
import isFunction from 'lodash/isFunction';
import resolveFrom from 'resolve-from';
import resolveGlobal from 'resolve-global';
import yargs from 'yargs';
import yargs, {Arguments} from 'yargs';
import util from 'util';

import {CliFlags, Seed} from './types';
Expand Down Expand Up @@ -116,7 +116,7 @@ const cli = yargs
)
.strict();

main({edit: false, ...cli.argv}).catch((err) => {
main(cli.argv).catch((err) => {
setTimeout(() => {
if (err.type === pkg.name) {
process.exit(1);
Expand All @@ -141,7 +141,22 @@ async function stdin() {
return result;
}

async function main(options: CliFlags) {
type MainArgsObject = {
[key in keyof Arguments<CliFlags>]: Arguments<CliFlags>[key];
};
type MainArgsPromise = Promise<MainArgsObject>;
type MainArgs = MainArgsObject | MainArgsPromise;

async function resolveArgs(args: MainArgs): Promise<MainArgsObject> {
return typeof args.then === 'function' ? await args : args;
}

async function main(args: MainArgs) {
const options = await resolveArgs(args);
if (typeof options.edit === 'undefined') {
options.edit = false;
}

const raw = options._;
const flags = normalizeFlags(options);

Expand Down
2 changes: 1 addition & 1 deletion @packages/utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
},
"license": "MIT",
"devDependencies": {
"@types/yargs": "^16.0.0"
"@types/yargs": "^17.0.0"
},
"dependencies": {
"execa": "^5.0.0",
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2400,10 +2400,10 @@
dependencies:
"@types/yargs-parser" "*"

"@types/yargs@^16.0.0":
version "16.0.0"
resolved "https://registry.npmjs.org/@types/yargs/-/yargs-16.0.0.tgz#0e033b23452da5d61b6c44747612cb80ac528751"
integrity sha512-2nN6AGeMwe8+O6nO9ytQfbMQOJy65oi1yK2y/9oReR08DaXSGtMsrLyCM1ooKqfICpCx4oITaR4LkOmdzz41Ww==
"@types/yargs@^17.0.0":
version "17.0.0"
resolved "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.0.tgz#32f740934eedf0a5cd19470249f317755c91f1ae"
integrity sha512-RS7u2X7vdXjVQs160PWY1pjLBw6GJj04utojn0KU8p2rRZR37FSzzK6XOT+KLzT/DVbDYRyezroc0LHIvM5Z2A==
dependencies:
"@types/yargs-parser" "*"

Expand Down