@@ -41,7 +41,7 @@ export const commandsObject: yargs.Argv<Arguments> = yargs
41
41
'strip-dashed' : true ,
42
42
'dot-notation' : true ,
43
43
} )
44
- . command (
44
+ . command < Arguments > (
45
45
// this is the default and only command
46
46
'$0 [name] [options]' ,
47
47
'Create a new Nx workspace' ,
@@ -152,7 +152,7 @@ export const commandsObject: yargs.Argv<Arguments> = yargs
152
152
throw error ;
153
153
} ) ;
154
154
} ,
155
- [ normalizeArgsMiddleware ]
155
+ [ normalizeArgsMiddleware as yargs . MiddlewareFunction < { } > ]
156
156
)
157
157
. help ( 'help' , chalk . dim `Show help` )
158
158
. updateLocale ( yargsDecorator )
@@ -195,7 +195,7 @@ async function normalizeArgsMiddleware(
195
195
"Let's create a new workspace [https://nx.dev/getting-started/intro]" ,
196
196
} ) ;
197
197
198
- let thirdPartyPreset : string ;
198
+ let thirdPartyPreset : string | null ;
199
199
try {
200
200
thirdPartyPreset = await getThirdPartyPreset ( argv . preset ) ;
201
201
} catch ( e ) {
@@ -262,7 +262,7 @@ async function normalizeArgsMiddleware(
262
262
}
263
263
} else {
264
264
name = await determineRepoName ( argv ) ;
265
- appName = await determineAppName ( preset , argv ) ;
265
+ appName = await determineAppName ( preset as Preset , argv ) ;
266
266
if ( preset === Preset . ReactMonorepo ) {
267
267
bundler = await determineBundler ( argv ) ;
268
268
}
@@ -276,7 +276,7 @@ async function normalizeArgsMiddleware(
276
276
( argv . interactive ? await determineRouting ( argv ) : true ) ;
277
277
}
278
278
}
279
- style = await determineStyle ( preset , argv ) ;
279
+ style = await determineStyle ( preset as Preset , argv ) ;
280
280
}
281
281
282
282
const packageManager = await determinePackageManager ( argv ) ;
@@ -439,7 +439,7 @@ async function determinePackageManager(
439
439
] ,
440
440
} ,
441
441
] )
442
- . then ( ( a : { packageManager } ) => a . packageManager ) ;
442
+ . then ( ( a ) => a . packageManager ) ;
443
443
}
444
444
445
445
return Promise . resolve ( detectInvokedPackageManager ( ) ) ;
@@ -453,15 +453,15 @@ async function determineDefaultBase(
453
453
}
454
454
if ( parsedArgs . allPrompts ) {
455
455
return enquirer
456
- . prompt ( [
456
+ . prompt < { DefaultBase : string } > ( [
457
457
{
458
458
name : 'DefaultBase' ,
459
459
message : `Main branch name ` ,
460
460
initial : `main` ,
461
461
type : 'input' ,
462
462
} ,
463
463
] )
464
- . then ( ( a : { DefaultBase : string } ) => {
464
+ . then ( ( a ) => {
465
465
if ( ! a . DefaultBase ) {
466
466
output . error ( {
467
467
title : 'Invalid branch name' ,
@@ -524,14 +524,14 @@ async function determineAppName(
524
524
}
525
525
526
526
return enquirer
527
- . prompt ( [
527
+ . prompt < { AppName : string } > ( [
528
528
{
529
529
name : 'AppName' ,
530
530
message : `Application name ` ,
531
531
type : 'input' ,
532
532
} ,
533
533
] )
534
- . then ( ( a : { AppName : string } ) => {
534
+ . then ( ( a ) => {
535
535
if ( ! a . AppName ) {
536
536
output . error ( {
537
537
title : 'Invalid name' ,
@@ -571,15 +571,15 @@ async function determineFramework(
571
571
572
572
if ( ! parsedArgs . framework ) {
573
573
return enquirer
574
- . prompt ( [
574
+ . prompt < { framework : Framework } > ( [
575
575
{
576
576
message : 'What framework should be used?' ,
577
577
type : 'autocomplete' ,
578
578
name : 'framework' ,
579
579
choices : frameworkChoices ,
580
580
} ,
581
581
] )
582
- . then ( ( a : { framework : string } ) => a . framework ) ;
582
+ . then ( ( a ) => a . framework ) ;
583
583
}
584
584
585
585
const foundFramework = frameworkChoices
@@ -607,7 +607,7 @@ async function determineStandaloneApi(
607
607
) : Promise < boolean > {
608
608
if ( parsedArgs . standaloneApi === undefined ) {
609
609
return enquirer
610
- . prompt ( [
610
+ . prompt < { standaloneApi : 'Yes' | 'No' } > ( [
611
611
{
612
612
name : 'standaloneApi' ,
613
613
message :
@@ -625,7 +625,7 @@ async function determineStandaloneApi(
625
625
initial : 'No' as any ,
626
626
} ,
627
627
] )
628
- . then ( ( a : { standaloneApi : 'Yes' | 'No' } ) => a . standaloneApi === 'Yes' ) ;
628
+ . then ( ( a ) => a . standaloneApi === 'Yes' ) ;
629
629
}
630
630
631
631
return parsedArgs . standaloneApi ;
@@ -636,7 +636,7 @@ async function determineDockerfile(
636
636
) : Promise < boolean > {
637
637
if ( parsedArgs . docker === undefined ) {
638
638
return enquirer
639
- . prompt ( [
639
+ . prompt < { docker : 'Yes' | 'No' } > ( [
640
640
{
641
641
name : 'docker' ,
642
642
message :
@@ -654,7 +654,7 @@ async function determineDockerfile(
654
654
initial : 'No' as any ,
655
655
} ,
656
656
] )
657
- . then ( ( a : { docker : 'Yes' | 'No' } ) => a . docker === 'Yes' ) ;
657
+ . then ( ( a ) => a . docker === 'Yes' ) ;
658
658
} else {
659
659
return Promise . resolve ( parsedArgs . docker ) ;
660
660
}
@@ -663,7 +663,7 @@ async function determineDockerfile(
663
663
async function determineStyle (
664
664
preset : Preset ,
665
665
parsedArgs : yargs . Arguments < Arguments >
666
- ) : Promise < string > {
666
+ ) : Promise < string | null > {
667
667
if (
668
668
preset === Preset . Apps ||
669
669
preset === Preset . Core ||
@@ -727,7 +727,7 @@ async function determineStyle(
727
727
728
728
if ( ! parsedArgs . style ) {
729
729
return enquirer
730
- . prompt ( [
730
+ . prompt < { style : string } > ( [
731
731
{
732
732
name : 'style' ,
733
733
message : `Default stylesheet format ` ,
@@ -762,7 +762,7 @@ async function determineRouting(
762
762
) : Promise < boolean > {
763
763
if ( ! parsedArgs . routing ) {
764
764
return enquirer
765
- . prompt ( [
765
+ . prompt < { routing : 'Yes' | 'No' } > ( [
766
766
{
767
767
name : 'routing' ,
768
768
message : 'Would you like to add routing?' ,
@@ -779,7 +779,7 @@ async function determineRouting(
779
779
initial : 'Yes' as any ,
780
780
} ,
781
781
] )
782
- . then ( ( a : { routing : 'Yes' | 'No' } ) => a . routing === 'Yes' ) ;
782
+ . then ( ( a ) => a . routing === 'Yes' ) ;
783
783
}
784
784
785
785
return parsedArgs . routing ;
@@ -801,7 +801,7 @@ async function determineBundler(
801
801
802
802
if ( ! parsedArgs . bundler ) {
803
803
return enquirer
804
- . prompt ( [
804
+ . prompt < { bundler : Bundler } > ( [
805
805
{
806
806
name : 'bundler' ,
807
807
message : `Bundler to be used to build the application` ,
@@ -810,7 +810,7 @@ async function determineBundler(
810
810
choices : choices ,
811
811
} ,
812
812
] )
813
- . then ( ( a : { bundler : 'vite' | 'webpack' } ) => a . bundler ) ;
813
+ . then ( ( a ) => a . bundler ) ;
814
814
}
815
815
816
816
const foundBundler = choices . find (
@@ -838,7 +838,7 @@ async function determineNxCloud(
838
838
) : Promise < boolean > {
839
839
if ( parsedArgs . nxCloud === undefined ) {
840
840
return enquirer
841
- . prompt ( [
841
+ . prompt < { NxCloud : 'Yes' | 'No' } > ( [
842
842
{
843
843
name : 'NxCloud' ,
844
844
message : messages . getPromptMessage ( 'nxCloudCreation' ) ,
@@ -856,7 +856,7 @@ async function determineNxCloud(
856
856
initial : 'Yes' as any ,
857
857
} ,
858
858
] )
859
- . then ( ( a : { NxCloud : 'Yes' | 'No' } ) => a . NxCloud === 'Yes' ) ;
859
+ . then ( ( a ) => a . NxCloud === 'Yes' ) ;
860
860
} else {
861
861
return parsedArgs . nxCloud ;
862
862
}
@@ -886,7 +886,7 @@ async function determineCI(
886
886
if ( parsedArgs . allPrompts ) {
887
887
return (
888
888
enquirer
889
- . prompt ( [
889
+ . prompt < { CI : string } > ( [
890
890
{
891
891
name : 'CI' ,
892
892
message : `CI workflow file to generate? ` ,
0 commit comments