Skip to content

Commit e1b9aee

Browse files
committed
Add pnpm workspace packages generator and -F alias for --filter
- Add workspace_packages_generator() that runs 'pnpm list -r --depth -1 --json' to dynamically suggest workspace package names for the --filter/-F flag - Add -F as a short alias for --filter across all pnpm subcommands - Wire up the workspace_packages_generator to all --filter/-F args in pnpm.json - Add unit tests for the workspace packages generator (normal, empty, invalid JSON)
1 parent 8fafc3f commit e1b9aee

2 files changed

Lines changed: 196 additions & 22 deletions

File tree

command-signatures/json/pnpm.json

Lines changed: 105 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,13 @@
9797
"description": "Only adds the new dependency if it is found in the workspace"
9898
},
9999
{
100-
"name": "--filter",
100+
"name": [
101+
"-F",
102+
"--filter"
103+
],
101104
"args": {
102105
"template": "filepaths",
106+
"generatorName": "workspace_packages_generator",
103107
"name": "Filepath / Package",
104108
"description": "To only select packages under the specified directory, you may specify any absolute path, typically in POSIX format"
105109
},
@@ -251,9 +255,13 @@
251255
"description": "Tries to link all packages from the workspace. Versions are updated to match the versions of packages inside the workspace.\nIf specific packages are updated, the command will fail if any of the updated dependencies are not found inside the workspace. For instance, the following command fails if express is not a workspace package: pnpm up -r --workspace express"
252256
},
253257
{
254-
"name": "--filter",
258+
"name": [
259+
"-F",
260+
"--filter"
261+
],
255262
"args": {
256263
"template": "filepaths",
264+
"generatorName": "workspace_packages_generator",
257265
"name": "Filepath / Package",
258266
"description": "To only select packages under the specified directory, you may specify any absolute path, typically in POSIX format"
259267
},
@@ -308,9 +316,13 @@
308316
"description": "Only remove the dependency from optionalDependencies"
309317
},
310318
{
311-
"name": "--filter",
319+
"name": [
320+
"-F",
321+
"--filter"
322+
],
312323
"args": {
313324
"template": "filepaths",
325+
"generatorName": "workspace_packages_generator",
314326
"name": "Filepath / Package",
315327
"description": "To only select packages under the specified directory, you may specify any absolute path, typically in POSIX format"
316328
},
@@ -370,9 +382,13 @@
370382
"description": "Unlink in every package found in subdirectories or in every workspace package, when executed inside a workspace"
371383
},
372384
{
373-
"name": "--filter",
385+
"name": [
386+
"-F",
387+
"--filter"
388+
],
374389
"args": {
375390
"template": "filepaths",
391+
"generatorName": "workspace_packages_generator",
376392
"name": "Filepath / Package",
377393
"description": "To only select packages under the specified directory, you may specify any absolute path, typically in POSIX format"
378394
},
@@ -409,9 +425,13 @@
409425
"description": "This command runs the pnpm rebuild command in every package of the monorepo"
410426
},
411427
{
412-
"name": "--filter",
428+
"name": [
429+
"-F",
430+
"--filter"
431+
],
413432
"args": {
414433
"template": "filepaths",
434+
"generatorName": "workspace_packages_generator",
415435
"name": "Filepath / Package",
416436
"description": "To only select packages under the specified directory, you may specify any absolute path, typically in POSIX format"
417437
},
@@ -548,9 +568,13 @@
548568
"description": "Don't list optionalDependencies"
549569
},
550570
{
551-
"name": "--filter",
571+
"name": [
572+
"-F",
573+
"--filter"
574+
],
552575
"args": {
553576
"template": "filepaths",
577+
"generatorName": "workspace_packages_generator",
554578
"name": "Filepath / Package",
555579
"description": "To only select packages under the specified directory, you may specify any absolute path, typically in POSIX format"
556580
},
@@ -652,9 +676,13 @@
652676
"description": "Only display the dependency tree for packages in dependencies"
653677
},
654678
{
655-
"name": "--filter",
679+
"name": [
680+
"-F",
681+
"--filter"
682+
],
656683
"args": {
657684
"template": "filepaths",
685+
"generatorName": "workspace_packages_generator",
658686
"name": "Filepath / Package",
659687
"description": "To only select packages under the specified directory, you may specify any absolute path, typically in POSIX format"
660688
},
@@ -694,9 +722,13 @@
694722
"description": "Stream output from child processes immediately, prefixed with the originating package directory. This allows output from different packages to be interleaved"
695723
},
696724
{
697-
"name": "--filter",
725+
"name": [
726+
"-F",
727+
"--filter"
728+
],
698729
"args": {
699730
"template": "filepaths",
731+
"generatorName": "workspace_packages_generator",
700732
"name": "Filepath / Package",
701733
"description": "To only select packages under the specified directory, you may specify any absolute path, typically in POSIX format"
702734
},
@@ -725,9 +757,13 @@
725757
"description": "Completely disregard concurrency and topological sorting, running a given script immediately in all matching packages with prefixed streaming output. This is the preferred flag for long-running processes over many packages, for instance, a lengthy build process"
726758
},
727759
{
728-
"name": "--filter",
760+
"name": [
761+
"-F",
762+
"--filter"
763+
],
729764
"args": {
730765
"template": "filepaths",
766+
"generatorName": "workspace_packages_generator",
731767
"name": "Filepath / Package",
732768
"description": "To only select packages under the specified directory, you may specify any absolute path, typically in POSIX format"
733769
},
@@ -794,9 +830,13 @@
794830
"description": "Save the list of published packages to pnpm-publish-summary.json. Useful when some other tooling is used to report the list of published packages"
795831
},
796832
{
797-
"name": "--filter",
833+
"name": [
834+
"-F",
835+
"--filter"
836+
],
798837
"args": {
799838
"template": "filepaths",
839+
"generatorName": "workspace_packages_generator",
800840
"name": "Filepath / Package",
801841
"description": "To only select packages under the specified directory, you may specify any absolute path, typically in POSIX format"
802842
},
@@ -851,9 +891,13 @@
851891
"description": "The order of packages is reversed"
852892
},
853893
{
854-
"name": "--filter",
894+
"name": [
895+
"-F",
896+
"--filter"
897+
],
855898
"args": {
856899
"template": "filepaths",
900+
"generatorName": "workspace_packages_generator",
857901
"name": "Filepath / Package",
858902
"description": "To only select packages under the specified directory, you may specify any absolute path, typically in POSIX format"
859903
},
@@ -958,9 +1002,13 @@
9581002
"description": "Only adds the new dependency if it is found in the workspace"
9591003
},
9601004
{
961-
"name": "--filter",
1005+
"name": [
1006+
"-F",
1007+
"--filter"
1008+
],
9621009
"args": {
9631010
"template": "filepaths",
1011+
"generatorName": "workspace_packages_generator",
9641012
"name": "Filepath / Package",
9651013
"description": "To only select packages under the specified directory, you may specify any absolute path, typically in POSIX format"
9661014
},
@@ -1055,9 +1103,13 @@
10551103
"description": "Tries to link all packages from the workspace. Versions are updated to match the versions of packages inside the workspace.\nIf specific packages are updated, the command will fail if any of the updated dependencies are not found inside the workspace. For instance, the following command fails if express is not a workspace package: pnpm up -r --workspace express"
10561104
},
10571105
{
1058-
"name": "--filter",
1106+
"name": [
1107+
"-F",
1108+
"--filter"
1109+
],
10591110
"args": {
10601111
"template": "filepaths",
1112+
"generatorName": "workspace_packages_generator",
10611113
"name": "Filepath / Package",
10621114
"description": "To only select packages under the specified directory, you may specify any absolute path, typically in POSIX format"
10631115
},
@@ -1115,9 +1167,13 @@
11151167
"description": "Only remove the dependency from optionalDependencies"
11161168
},
11171169
{
1118-
"name": "--filter",
1170+
"name": [
1171+
"-F",
1172+
"--filter"
1173+
],
11191174
"args": {
11201175
"template": "filepaths",
1176+
"generatorName": "workspace_packages_generator",
11211177
"name": "Filepath / Package",
11221178
"description": "To only select packages under the specified directory, you may specify any absolute path, typically in POSIX format"
11231179
},
@@ -1150,9 +1206,13 @@
11501206
"description": "Unlink in every package found in subdirectories or in every workspace package, when executed inside a workspace"
11511207
},
11521208
{
1153-
"name": "--filter",
1209+
"name": [
1210+
"-F",
1211+
"--filter"
1212+
],
11541213
"args": {
11551214
"template": "filepaths",
1215+
"generatorName": "workspace_packages_generator",
11561216
"name": "Filepath / Package",
11571217
"description": "To only select packages under the specified directory, you may specify any absolute path, typically in POSIX format"
11581218
},
@@ -1188,9 +1248,13 @@
11881248
"description": "This command runs the pnpm rebuild command in every package of the monorepo"
11891249
},
11901250
{
1191-
"name": "--filter",
1251+
"name": [
1252+
"-F",
1253+
"--filter"
1254+
],
11921255
"args": {
11931256
"template": "filepaths",
1257+
"generatorName": "workspace_packages_generator",
11941258
"name": "Filepath / Package",
11951259
"description": "To only select packages under the specified directory, you may specify any absolute path, typically in POSIX format"
11961260
},
@@ -1254,9 +1318,13 @@
12541318
"description": "Don't list optionalDependencies"
12551319
},
12561320
{
1257-
"name": "--filter",
1321+
"name": [
1322+
"-F",
1323+
"--filter"
1324+
],
12581325
"args": {
12591326
"template": "filepaths",
1327+
"generatorName": "workspace_packages_generator",
12601328
"name": "Filepath / Package",
12611329
"description": "To only select packages under the specified directory, you may specify any absolute path, typically in POSIX format"
12621330
},
@@ -1361,9 +1429,13 @@
13611429
"description": "Only display the dependency tree for packages in dependencies"
13621430
},
13631431
{
1364-
"name": "--filter",
1432+
"name": [
1433+
"-F",
1434+
"--filter"
1435+
],
13651436
"args": {
13661437
"template": "filepaths",
1438+
"generatorName": "workspace_packages_generator",
13671439
"name": "Filepath / Package",
13681440
"description": "To only select packages under the specified directory, you may specify any absolute path, typically in POSIX format"
13691441
},
@@ -1410,9 +1482,13 @@
14101482
"description": "Stream output from child processes immediately, prefixed with the originating package directory. This allows output from different packages to be interleaved"
14111483
},
14121484
{
1413-
"name": "--filter",
1485+
"name": [
1486+
"-F",
1487+
"--filter"
1488+
],
14141489
"args": {
14151490
"template": "filepaths",
1491+
"generatorName": "workspace_packages_generator",
14161492
"name": "Filepath / Package",
14171493
"description": "To only select packages under the specified directory, you may specify any absolute path, typically in POSIX format"
14181494
},
@@ -1444,9 +1520,13 @@
14441520
"description": "Completely disregard concurrency and topological sorting, running a given script immediately in all matching packages with prefixed streaming output. This is the preferred flag for long-running processes over many packages, for instance, a lengthy build process"
14451521
},
14461522
{
1447-
"name": "--filter",
1523+
"name": [
1524+
"-F",
1525+
"--filter"
1526+
],
14481527
"args": {
14491528
"template": "filepaths",
1529+
"generatorName": "workspace_packages_generator",
14501530
"name": "Filepath / Package",
14511531
"description": "To only select packages under the specified directory, you may specify any absolute path, typically in POSIX format"
14521532
},
@@ -1512,9 +1592,13 @@
15121592
"description": "Save the list of published packages to pnpm-publish-summary.json. Useful when some other tooling is used to report the list of published packages"
15131593
},
15141594
{
1515-
"name": "--filter",
1595+
"name": [
1596+
"-F",
1597+
"--filter"
1598+
],
15161599
"args": {
15171600
"template": "filepaths",
1601+
"generatorName": "workspace_packages_generator",
15181602
"name": "Filepath / Package",
15191603
"description": "To only select packages under the specified directory, you may specify any absolute path, typically in POSIX format"
15201604
},

0 commit comments

Comments
 (0)