File tree Expand file tree Collapse file tree 1 file changed +33
-7
lines changed
Expand file tree Collapse file tree 1 file changed +33
-7
lines changed Original file line number Diff line number Diff line change @@ -35,15 +35,41 @@ export const bumpVersion = async () => {
3535 }
3636 } )
3737
38- // 让用户选择要升级的包
39- const selectedPackage = await select ( {
40- message : '请选择要升级版本的包:' ,
41- options,
42- } ) as string
38+ // 选择需要升级的包 - loop
39+ let availableOptions = [ ...options ]
40+ const selectedPackages : string [ ] = [ ]
4341
44- isCancelProcess ( selectedPackage )
42+ while ( availableOptions . length > 0 ) {
43+ const selectedPackage = await select ( {
44+ message : '请选择要升级版本的包:' ,
45+ options : availableOptions ,
46+ } ) as string
47+
48+ isCancelProcess ( selectedPackage )
49+
50+ selectedPackages . push ( selectedPackage )
51+ const selectedInfo = options . find ( opt => opt . value === selectedPackage )
52+
53+ outro ( pc . cyan ( `已选择: ${ selectedInfo ?. label || selectedPackage } ` ) )
54+
55+ // 从可用选项中移除已选择的包
56+ availableOptions = availableOptions . filter ( opt => opt . value !== selectedPackage )
57+
58+ if ( availableOptions . length > 0 ) {
59+ const continueSelection = await confirm ( {
60+ message : '是否继续选择其他包?' ,
61+ initialValue : true ,
62+ } )
63+ isCancelProcess ( continueSelection )
64+
65+ if ( ! continueSelection ) {
66+ break
67+ }
68+ }
69+ }
70+
71+ outro ( `总共选择了 ${ selectedPackages . length } 个包` )
4572
46- outro ( pc . cyan ( `已选择: ${ selectedPackage } ` ) )
4773 return process . exit ( 0 )
4874 }
4975
You can’t perform that action at this time.
0 commit comments