Skip to content

Commit 8faa7d6

Browse files
authored
fix: Upgrade Commander to v13 (#6764)
1 parent 756ef43 commit 8faa7d6

File tree

10 files changed

+458
-177
lines changed

10 files changed

+458
-177
lines changed

integration-tests/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"@octokit/rest": "^21.0.2",
3333
"ansi-escapes": "^7.0.0",
3434
"chalk": "^5.4.1",
35-
"commander": "^12.1.0",
35+
"commander": "^13.0.0",
3636
"csv-parse": "^5.6.0",
3737
"csv-stringify": "^6.5.2",
3838
"jest-diff": "^29.7.0",

packages/cspell-tools/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
"homepage": "https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell-tools#readme",
5353
"dependencies": {
5454
"@cspell/cspell-pipe": "workspace:*",
55-
"commander": "^12.1.0",
55+
"commander": "^13.0.0",
5656
"cosmiconfig": "9.0.0",
5757
"cspell-trie-lib": "workspace:*",
5858
"glob": "^10.4.5",

packages/cspell-trie/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
},
4646
"homepage": "https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell-trie#readme",
4747
"dependencies": {
48-
"commander": "^12.1.0",
48+
"commander": "^13.0.0",
4949
"cspell-trie-lib": "workspace:*",
5050
"gensequence": "^7.0.0"
5151
},

packages/cspell/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
"@cspell/url": "workspace:*",
8989
"chalk": "^5.4.1",
9090
"chalk-template": "^1.1.0",
91-
"commander": "^12.1.0",
91+
"commander": "^13.0.0",
9292
"cspell-dictionary": "workspace:*",
9393
"cspell-gitignore": "workspace:*",
9494
"cspell-glob": "workspace:*",

packages/cspell/src/app/__snapshots__/app.test.ts.snap

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,7 @@ exports[`Validate cli > app 'check help' Expect Error: 'outputHelp' 1`] = `
183183
[
184184
"Usage: cspell check [options] <files...>",
185185
"",
186-
"Spell check file(s) and display the result. The full file is displayed in",
187-
"color.",
186+
"Spell check file(s) and display the result. The full file is displayed in color.",
188187
"",
189188
"Options:",
190189
" -c, --config <cspell.json> Configuration file to use. By default cspell",
@@ -628,8 +627,8 @@ exports[`Validate cli > app 'lint --help --issue-template' Expect Error: 'output
628627
" -u, --unique Only output the first instance of a word not",
629628
" found in the dictionaries.",
630629
" -e, --exclude <glob> Exclude files matching the glob pattern. This",
631-
" option can be used multiple times to add",
632-
" multiple globs.",
630+
" option can be used multiple times to add multiple",
631+
" globs.",
633632
" --file-list <path or stdin> Specify a list of files to be spell checked. The",
634633
" list is filtered against the glob file patterns.",
635634
" Note: the format is 1 file path per line.",
@@ -662,8 +661,7 @@ exports[`Validate cli > app 'lint --help --issue-template' Expect Error: 'output
662661
" --gitignore Ignore files matching glob patterns found in",
663662
" .gitignore files.",
664663
" --no-gitignore Do NOT use .gitignore files.",
665-
" --gitignore-root <path> Prevent searching for .gitignore files past",
666-
" root.",
664+
" --gitignore-root <path> Prevent searching for .gitignore files past root.",
667665
" --validate-directives Validate in-document CSpell directives.",
668666
" --color Force color.",
669667
" --no-color Turn off color.",
@@ -772,8 +770,8 @@ exports[`Validate cli > app 'lint --help --verbose' Expect Error: 'outputHelp' 1
772770
" -u, --unique Only output the first instance of a word not",
773771
" found in the dictionaries.",
774772
" -e, --exclude <glob> Exclude files matching the glob pattern. This",
775-
" option can be used multiple times to add",
776-
" multiple globs.",
773+
" option can be used multiple times to add multiple",
774+
" globs.",
777775
" --file-list <path or stdin> Specify a list of files to be spell checked. The",
778776
" list is filtered against the glob file patterns.",
779777
" Note: the format is 1 file path per line.",
@@ -806,8 +804,7 @@ exports[`Validate cli > app 'lint --help --verbose' Expect Error: 'outputHelp' 1
806804
" --gitignore Ignore files matching glob patterns found in",
807805
" .gitignore files.",
808806
" --no-gitignore Do NOT use .gitignore files.",
809-
" --gitignore-root <path> Prevent searching for .gitignore files past",
810-
" root.",
807+
" --gitignore-root <path> Prevent searching for .gitignore files past root.",
811808
" --validate-directives Validate in-document CSpell directives.",
812809
" --color Force color.",
813810
" --no-color Turn off color.",
@@ -909,8 +906,8 @@ exports[`Validate cli > app 'lint --help' Expect Error: 'outputHelp' 1`] = `
909906
" -u, --unique Only output the first instance of a word not",
910907
" found in the dictionaries.",
911908
" -e, --exclude <glob> Exclude files matching the glob pattern. This",
912-
" option can be used multiple times to add",
913-
" multiple globs.",
909+
" option can be used multiple times to add multiple",
910+
" globs.",
914911
" --file-list <path or stdin> Specify a list of files to be spell checked. The",
915912
" list is filtered against the glob file patterns.",
916913
" Note: the format is 1 file path per line.",
@@ -943,8 +940,7 @@ exports[`Validate cli > app 'lint --help' Expect Error: 'outputHelp' 1`] = `
943940
" --gitignore Ignore files matching glob patterns found in",
944941
" .gitignore files.",
945942
" --no-gitignore Do NOT use .gitignore files.",
946-
" --gitignore-root <path> Prevent searching for .gitignore files past",
947-
" root.",
943+
" --gitignore-root <path> Prevent searching for .gitignore files past root.",
948944
" --validate-directives Validate in-document CSpell directives.",
949945
" --color Force color.",
950946
" --no-color Turn off color.",
@@ -1044,8 +1040,8 @@ exports[`Validate cli > app 'no-args' Expect Error: 'outputHelp' 1`] = `
10441040
" -u, --unique Only output the first instance of a word not",
10451041
" found in the dictionaries.",
10461042
" -e, --exclude <glob> Exclude files matching the glob pattern. This",
1047-
" option can be used multiple times to add",
1048-
" multiple globs.",
1043+
" option can be used multiple times to add multiple",
1044+
" globs.",
10491045
" --file-list <path or stdin> Specify a list of files to be spell checked. The",
10501046
" list is filtered against the glob file patterns.",
10511047
" Note: the format is 1 file path per line.",
@@ -1078,8 +1074,7 @@ exports[`Validate cli > app 'no-args' Expect Error: 'outputHelp' 1`] = `
10781074
" --gitignore Ignore files matching glob patterns found in",
10791075
" .gitignore files.",
10801076
" --no-gitignore Do NOT use .gitignore files.",
1081-
" --gitignore-root <path> Prevent searching for .gitignore files past",
1082-
" root.",
1077+
" --gitignore-root <path> Prevent searching for .gitignore files past root.",
10831078
" --validate-directives Validate in-document CSpell directives.",
10841079
" --color Force color.",
10851080
" --no-color Turn off color.",
@@ -1660,8 +1655,8 @@ exports[`Validate cli > app 'trace help' Expect Error: 'outputHelp' 1`] = `
16601655
"Options:",
16611656
" -c, --config <cspell.json> Configuration file to use. By default cspell",
16621657
" looks for cspell.json in the current directory.",
1663-
" --locale <locale> Set language locales. i.e. "en,fr" for English",
1664-
" and French, or "en-GB" for British English.",
1658+
" --locale <locale> Set language locales. i.e. "en,fr" for English and",
1659+
" French, or "en-GB" for British English.",
16651660
" --language-id <language> Use programming language. i.e. "php" or "scala".",
16661661
" --allow-compound-words Turn on allowCompoundWords",
16671662
" --no-allow-compound-words Turn off allowCompoundWords",

packages/cspell/src/app/commandLint.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -244,20 +244,15 @@ function augmentCommandHelp(context: AddHelpTextContext) {
244244
const showHidden = !!opts.verbose;
245245
const hiddenHelp: string[] = [];
246246
const help = command.createHelp();
247+
help.helpWidth = process.stdout.columns || 80;
247248
const hiddenOptions = command.options.filter((opt) => opt.hidden && showHidden);
248249
const flagColWidth = Math.max(...command.options.map((opt) => opt.flags.length), 0);
249-
const indent = flagColWidth + 4;
250+
// const indent = flagColWidth + 4;
250251
for (const options of hiddenOptions) {
251252
if (!hiddenHelp.length) {
252253
hiddenHelp.push('\nHidden Options:');
253254
}
254-
hiddenHelp.push(
255-
help.wrap(
256-
` ${options.flags.padEnd(flagColWidth)} ${options.description}`,
257-
process.stdout.columns || 80,
258-
indent,
259-
),
260-
);
255+
hiddenHelp.push(help.formatItem(options.flags, flagColWidth, options.description, help));
261256
}
262257
output.push(...hiddenHelp, advanced);
263258
return helpIssueTemplate(opts) + output.join('\n');

packages/hunspell-reader/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
"dependencies": {
5151
"@cspell/cspell-pipe": "workspace:^",
5252
"@cspell/cspell-types": "workspace:^",
53-
"commander": "^12.1.0",
53+
"commander": "^13.0.0",
5454
"gensequence": "^7.0.0",
5555
"html-entities": "^2.5.2",
5656
"iconv-lite": "^0.6.3"

pnpm-lock.yaml

Lines changed: 19 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)