Skip to content

Commit abba216

Browse files
committed
fix: match library changes for deploy
1 parent e180b0d commit abba216

File tree

2 files changed

+54
-48
lines changed

2 files changed

+54
-48
lines changed

src/commands/force/source/deploy.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ export class deploy extends SourceCommand {
2626
checkonly: flags.boolean({
2727
char: 'c',
2828
description: messages.getMessage('flags.checkonly'),
29-
default: false,
3029
}),
3130
wait: flags.minutes({
3231
char: 'w',
@@ -48,12 +47,10 @@ export class deploy extends SourceCommand {
4847
ignoreerrors: flags.boolean({
4948
char: 'o',
5049
description: messages.getMessage('flags.ignoreErrors'),
51-
default: false,
5250
}),
5351
ignorewarnings: flags.boolean({
5452
char: 'g',
5553
description: messages.getMessage('flags.ignoreWarnings'),
56-
default: false,
5754
}),
5855
validateddeployrequestid: flags.id({
5956
char: 'q',
@@ -104,19 +101,22 @@ export class deploy extends SourceCommand {
104101

105102
await hookEmitter.emit('predeploy', { packageXmlPath: cs.getPackageXml() });
106103

107-
const results = await cs.deploy(this.org.getUsername(), {
108-
wait: (this.flags.wait as Duration).milliseconds,
109-
apiOptions: {
110-
// TODO: build out more api options
111-
checkOnly: this.flags.checkonly as boolean,
112-
ignoreWarnings: this.flags.ignorewarnings as boolean,
113-
runTests: this.flags.runtests as string[],
114-
},
115-
});
116-
104+
const results = await cs
105+
.deploy({
106+
usernameOrConnection: this.org.getUsername(),
107+
apiOptions: {
108+
checkOnly: this.flags.checkonly as boolean,
109+
ignoreWarnings: this.flags.ignorewarnings as boolean,
110+
runTests: this.flags.runtests as string[],
111+
},
112+
})
113+
.start();
117114
await hookEmitter.emit('postdeploy', results);
118115

119-
this.print(results);
116+
// skip a lot of steps that would do nothing
117+
if (!this.flags.json) {
118+
this.print(results);
119+
}
120120

121121
return results;
122122
}

src/commands/force/source/retrieve.ts

Lines changed: 40 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
66
*/
77
import * as os from 'os';
8-
import * as path from 'path';
8+
// import * as path from 'path';
99
import { flags, FlagsConfig } from '@salesforce/command';
1010
import { Lifecycle, Messages, SfdxError, SfdxProjectJson } from '@salesforce/core';
11-
import { SourceRetrieveResult } from '@salesforce/source-deploy-retrieve';
11+
// import { SourceRetrieveResult } from '@salesforce/source-deploy-retrieve';
1212
import { Duration } from '@salesforce/kit';
1313
import { asArray, asString } from '@salesforce/ts-types';
14-
import { blue, yellow } from 'chalk';
14+
// import { blue, yellow } from 'chalk';
1515
import { SourceCommand } from '../../../sourceCommand';
1616

1717
Messages.importMessagesDirectory(__dirname);
@@ -51,7 +51,8 @@ export class retrieve extends SourceCommand {
5151
};
5252
protected readonly lifecycleEventNames = ['preretrieve', 'postretrieve'];
5353

54-
public async run(): Promise<SourceRetrieveResult> {
54+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
55+
public async run(): Promise<any> {
5556
const hookEmitter = Lifecycle.getInstance();
5657

5758
const proj = await SfdxProjectJson.create({});
@@ -70,20 +71,25 @@ export class retrieve extends SourceCommand {
7071
// needs to be a path to the temp dir package.xml
7172
await hookEmitter.emit('preretrieve', { packageXmlPath: cs.getPackageXml() });
7273

73-
const results = await cs.retrieve(this.org.getUsername(), path.resolve(defaultPackage.path), {
74-
merge: true,
75-
// TODO: fix this once wait has been updated in library
76-
wait: (this.flags.wait as Duration).milliseconds,
77-
// TODO: implement retrieve via package name
78-
// package: options.packagenames
79-
});
74+
const mdapiResult = await cs
75+
.retrieve({
76+
usernameOrConnection: this.org.getUsername(),
77+
merge: true,
78+
output: (this.flags.sourcepath as string) ?? defaultPackage.path,
79+
// TODO: fix this once wait has been updated in library
80+
// wait: (this.flags.wait as Duration).milliseconds,
81+
// TODO: implement retrieve via package name
82+
// package: options.packagenames
83+
})
84+
.start();
8085

86+
const results = mdapiResult.response;
8187
await hookEmitter.emit('postretrieve', results);
8288

8389
if (results.status === 'InProgress') {
8490
throw new SfdxError(messages.getMessage('retrieveTimeout', [(this.flags.wait as Duration).minutes]));
8591
}
86-
this.printTable(results, true);
92+
// this.printTable(results, true);
8793

8894
return results;
8995
}
@@ -94,28 +100,28 @@ export class retrieve extends SourceCommand {
94100
* @param results what the .deploy or .retrieve method returns
95101
* @param withoutState a boolean to add state, default to true
96102
*/
97-
public printTable(results: SourceRetrieveResult, withoutState?: boolean): void {
98-
const stateCol = withoutState ? [] : [{ key: 'state', label: messages.getMessage('stateTableColumn') }];
103+
// public printTable(results: SourceRetrieveResult, withoutState?: boolean): void {
104+
// const stateCol = withoutState ? [] : [{ key: 'state', label: messages.getMessage('stateTableColumn') }];
99105

100-
this.ux.styledHeader(blue(messages.getMessage('retrievedSourceHeader')));
101-
if (results.success && results.successes.length) {
102-
const columns = [
103-
{ key: 'properties.fullName', label: messages.getMessage('fullNameTableColumn') },
104-
{ key: 'properties.type', label: messages.getMessage('typeTableColumn') },
105-
{
106-
key: 'properties.fileName',
107-
label: messages.getMessage('workspacePathTableColumn'),
108-
},
109-
];
110-
this.ux.table(results.successes, { columns: [...stateCol, ...columns] });
111-
} else {
112-
this.ux.log(messages.getMessage('NoResultsFound'));
113-
}
106+
// this.ux.styledHeader(blue(messages.getMessage('retrievedSourceHeader')));
107+
// if (results.success && results.successes.length) {
108+
// const columns = [
109+
// { key: 'properties.fullName', label: messages.getMessage('fullNameTableColumn') },
110+
// { key: 'properties.type', label: messages.getMessage('typeTableColumn') },
111+
// {
112+
// key: 'properties.fileName',
113+
// label: messages.getMessage('workspacePathTableColumn'),
114+
// },
115+
// ];
116+
// this.ux.table(results.successes, { columns: [...stateCol, ...columns] });
117+
// } else {
118+
// this.ux.log(messages.getMessage('NoResultsFound'));
119+
// }
114120

115-
if (results.status === 'PartialSuccess' && results.successes.length && results.failures.length) {
116-
this.ux.log('');
117-
this.ux.styledHeader(yellow(messages.getMessage('metadataNotFoundWarning')));
118-
results.failures.forEach((warning) => this.ux.log(warning.message));
119-
}
120-
}
121+
// if (results.status === 'PartialSuccess' && results.successes.length && results.failures.length) {
122+
// this.ux.log('');
123+
// this.ux.styledHeader(yellow(messages.getMessage('metadataNotFoundWarning')));
124+
// results.failures.forEach((warning) => this.ux.log(warning.message));
125+
// }
126+
// }
121127
}

0 commit comments

Comments
 (0)