Skip to content

Commit 77952f2

Browse files
committed
Make mdapi conversion the default mode
Retrieving a changeset downloads all the components along with it. Converting the metadata that we already have will save us having to kick off another retrieve from salesforce, and hopefully save a bit of time. The source mode will stay around until we need it, or prove that we don't need it.
1 parent 9ea5009 commit 77952f2

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/commands/changeset/retrieve.ts

+9-9
Original file line numberDiff line numberDiff line change
@@ -45,24 +45,24 @@ export default class Retrieve extends SfdxCommand {
4545
const pkgBuf = await this.retrieveChangeset(conn, changesetname);
4646
this.ux.stopSpinner('Done!');
4747

48-
if (mode == 'convert') {
49-
this.ux.startSpinner('Extracting Package');
48+
if (mode == 'source') {
49+
this.ux.startSpinner('Extracting package.xml');
5050
let zip = new AdmZip(pkgBuf);
51-
await zip.extractAllTo(`changesets/${changesetname}`, true);
51+
await zip.extractEntryTo(`${changesetname}/package.xml`, `changesets`, true, true);
5252
this.ux.stopSpinner('Done!');
5353

54-
this.ux.startSpinner('Converting to Source');
55-
await runCommand(`sfdx force:mdapi:convert -r changesets/${changesetname}`);
54+
this.ux.startSpinner('Retrieving Source');
55+
await runCommand(`sfdx force:source:retrieve -u ${username} -x changesets/${changesetname}/package.xml`);
5656
this.ux.stopSpinner('Done!');
5757
}
5858
else {
59-
this.ux.startSpinner('Extracting package.xml');
59+
this.ux.startSpinner('Extracting Package');
6060
let zip = new AdmZip(pkgBuf);
61-
await zip.extractEntryTo(`${changesetname}/package.xml`, `changesets`, true, true);
61+
await zip.extractAllTo(`changesets`, true);
6262
this.ux.stopSpinner('Done!');
6363

64-
this.ux.startSpinner('Retrieving Source');
65-
await runCommand(`sfdx force:source:retrieve -u ${username} -x changesets/${changesetname}/package.xml`);
64+
this.ux.startSpinner('Converting to Source');
65+
await runCommand(`sfdx force:mdapi:convert -r changesets/${changesetname}`);
6666
this.ux.stopSpinner('Done!');
6767
}
6868

0 commit comments

Comments
 (0)