File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -129,7 +129,10 @@ export class Retrieve extends SourceCommand {
129
129
this . ux . setSpinnerStatus ( spinnerMessages . getMessage ( 'retrieve.componentSetBuild' ) ) ;
130
130
131
131
this . componentSet = await ComponentSetBuilder . build ( {
132
- apiversion : this . getFlag < string > ( 'apiversion' ) ?? ( await this . org . retrieveMaxApiVersion ( ) ) ,
132
+ // use the apiVersion if provided.
133
+ // Manifests default to their specified apiVersion(ComponentSetBuilder handles this)
134
+ // and not specifying the apiVersion will use the max for the org/Connection
135
+ apiversion : this . getFlag < string > ( 'apiversion' ) ,
133
136
packagenames,
134
137
sourcepath : this . sourceDir ? [ this . sourceDir ] : undefined ,
135
138
manifest : manifest && {
Original file line number Diff line number Diff line change @@ -332,6 +332,22 @@ describe('mdapi NUTs', () => {
332
332
expect ( result . zipFilePath ) . to . equal ( zipFileLocation ) ;
333
333
} ) ;
334
334
335
+ it ( 'retrieves content from manifest using manifest api version' , async ( ) => {
336
+ // modify the manifest to use a different api version
337
+ const targetApiVersion = '54.0' ;
338
+ const manifestRelativePath = path . join ( session . project . dir , manifestPath ) ;
339
+
340
+ const original = await fs . promises . readFile ( manifestRelativePath , 'utf8' ) ;
341
+ await fs . promises . writeFile (
342
+ manifestRelativePath ,
343
+ original . replace ( / < v e r s i o n > .* < \/ v e r s i o n > / g, `<version>${ targetApiVersion } </version>` )
344
+ ) ;
345
+ const retrieveTargetDir = 'mdRetrieveFromManifest' ;
346
+ const cmd = `force:mdapi:retrieve -w 10 -r ${ retrieveTargetDir } -k ${ manifestPath } ` ;
347
+ const rv = execCmd < RetrieveCommandResult > ( cmd , { ensureExitCode : 0 } ) . shellOutput ;
348
+ expect ( rv . stderr ) . to . include ( targetApiVersion ) ;
349
+ } ) ;
350
+
335
351
it ( 'retrieves single package' , ( ) => {
336
352
const retrieveTargetDir = 'mdRetrieveSinglePackage' ;
337
353
const retrieveTargetDirPath = path . join ( session . project . dir , retrieveTargetDir ) ;
You can’t perform that action at this time.
0 commit comments