File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -37,6 +37,7 @@ export class PackageConvert extends SfCommand<PackageVersionCreateRequestResult>
3737 public static readonly examples = messages . getMessages ( 'examples' ) ;
3838 public static readonly deprecateAliases = true ;
3939 public static readonly aliases = [ 'force:package:convert' ] ;
40+ public static readonly requiresProject = true ;
4041 public static readonly flags = {
4142 loglevel,
4243 'target-dev-hub' : requiredHubFlag ,
@@ -128,13 +129,7 @@ export class PackageConvert extends SfCommand<PackageVersionCreateRequestResult>
128129 } else {
129130 this . spinner . start ( 'Converting Package' , 'Initializing' ) ;
130131 }
131- // initialize the project instance if in a project
132- let project : SfProject | undefined ;
133- try {
134- project = await SfProject . resolve ( ) ;
135- } catch ( err ) {
136- // ignore project is optional
137- }
132+
138133 const result = await Package . convert (
139134 flags . package ,
140135 flags [ 'target-dev-hub' ] . getConnection ( flags [ 'api-version' ] ) ,
@@ -148,7 +143,7 @@ export class PackageConvert extends SfCommand<PackageVersionCreateRequestResult>
148143 patchversion : flags [ 'patch-version' ] as string ,
149144 codecoverage : flags [ 'code-coverage' ] as boolean ,
150145 } ,
151- project
146+ this . project as SfProject
152147 ) ;
153148
154149 switch ( result . Status ) {
Original file line number Diff line number Diff line change @@ -52,6 +52,10 @@ describe('package:convert', () => {
5252 $$ . restore ( ) ;
5353 } ) ;
5454
55+ it ( 'should require an sfdx project' , ( ) => {
56+ expect ( PackageConvert . requiresProject ) . to . be . true ;
57+ } ) ;
58+
5559 it ( 'returns error for missing installationkey or installationkeybypass flag' , async ( ) => {
5660 const expectedErrorMsg =
5761 'Exactly one of the following must be provided: --installation-key, --installation-key-bypass' ;
You can’t perform that action at this time.
0 commit comments