Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"@salesforce/core": "^8.6.1",
"@salesforce/kit": "^3.2.3",
"@salesforce/plugin-info": "^3.4.9",
"@salesforce/sf-plugins-core": "^11.3.12",
"@salesforce/sf-plugins-core": "^12.0.4",
"@salesforce/source-deploy-retrieve": "^12.7.4",
"@salesforce/source-tracking": "^7.1.16",
"@salesforce/ts-types": "^2.0.12",
Expand Down
24 changes: 16 additions & 8 deletions src/commands/project/convert/source-behavior.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,23 @@ export default class ConvertSourceBehavior extends SfCommand<SourceBehaviorResul
await rm(TMP_DIR, { recursive: true });
}

this.table(
filesToDelete.map((f) => ({ value: f })),
{ value: { header: flags['dry-run'] ? 'Files that would have been deleted if not --dry-run' : 'Deleted Files' } }
);
this.table({
data: filesToDelete.map((f) => ({ value: f })),
columns: [
{
key: 'value',
name: flags['dry-run'] ? 'Files that would have been deleted if not --dry-run' : 'Deleted Files',
},
],
});

this.log();
this.table(
createdFiles.map((f) => ({ value: f })),
{ value: { header: 'Created Files' } }
);

this.table({
data: createdFiles.map((f) => ({ value: f })),
columns: [{ key: 'value', name: 'Created Files' }],
});

if (flags['dry-run']) {
// put it back how it was
await writeFile(projectJson.getPath(), backupPjsonContents);
Expand Down
42 changes: 20 additions & 22 deletions src/formatters/deleteResultFormatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,17 +82,17 @@ export class DeleteResultFormatter extends TestResultsFormatter implements Forma
});
}

ux.log('');
ux.log();
ux.styledHeader(tableHeader('Deleted Source'));
ux.table(
successes.map(getFileResponseSuccessProps),
{
fullName: { header: 'FULL NAME' },
type: { header: 'TYPE' },
filePath: { header: 'PROJECT PATH' },
},
{ 'no-truncate': true }
);
ux.table({
data: successes.map(getFileResponseSuccessProps),
columns: [
{ key: 'fullName', name: 'FULL NAME' },
{ key: 'type', name: 'TYPE' },
{ key: 'filePath', name: 'PROJECT PATH' },
],
overflow: 'wrap',
});
} else {
this.displayFailures();
}
Expand All @@ -105,17 +105,15 @@ export class DeleteResultFormatter extends TestResultsFormatter implements Forma
if (!failures.length) return;

ux.log();
ux.table(
failures.map((f) => ({ problemType: f.problemType, fullName: f.fullName, error: f.problem })),
{
problemType: { header: 'Type' },
fullName: { header: 'Name' },
error: { header: 'Problem' },
},
{
title: StandardColors.error(`Component Failures [${failures.length}]`),
'no-truncate': true,
}
);
ux.table({
data: failures.map((f) => ({ problemType: f.problemType, fullName: f.fullName, error: f.problem })),
columns: [
{ key: 'problemType', name: 'Type' },
{ key: 'fullName', name: 'Name' },
{ key: 'error', name: 'Problem' },
],
title: StandardColors.error(`Component Failures [${failures.length}]`),
overflow: 'wrap',
});
}
}
12 changes: 10 additions & 2 deletions src/formatters/deployReportResultFormatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ export class DeployReportResultFormatter extends DeployResultFormatter {
);

ux.log();
ux.table(response, { key: {}, value: {} }, { title: tableHeader('Deploy Info'), 'no-truncate': true });
ux.table({
data: response,
title: tableHeader('Deploy Info'),
overflow: 'wrap',
});

const opts = Object.entries(this.flags).reduce<Array<{ key: string; value: unknown }>>((result, [key, value]) => {
if (key === 'timestamp') {
Expand All @@ -48,7 +52,11 @@ export class DeployReportResultFormatter extends DeployResultFormatter {
return result.concat({ key, value });
}, []);
ux.log();
ux.table(opts, { key: {}, value: {} }, { title: tableHeader('Deploy Options'), 'no-truncate': true });
ux.table({
data: opts,
title: tableHeader('Deploy Options'),
overflow: 'wrap',
});
super.display();
}
}
Expand Down
72 changes: 32 additions & 40 deletions src/formatters/deployResultFormatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,17 +274,15 @@ export class DeployResultFormatter extends TestResultsFormatter implements Forma
replaced,
}))
);
ux.table(
replacements,
{
filePath: { header: 'PROJECT PATH' },
replaced: { header: 'TEXT REPLACED' },
},
{
title: tableHeader('Metadata Replacements'),
'no-truncate': true,
}
);
ux.table({
data: replacements,
columns: [
{ key: 'filePath', name: 'PROJECT PATH' },
{ key: 'replaced', name: 'TEXT REPLACED' },
],
title: tableHeader('Metadata Replacements'),
overflow: 'wrap',
});
}
}

Expand All @@ -293,17 +291,14 @@ export class DeployResultFormatter extends TestResultsFormatter implements Forma

if (!successes.length || this.result.response.status === RequestStatus.Failed) return;

const columns = {
state: { header: 'State' },
fullName: { header: 'Name' },
type: { header: 'Type' },
filePath: { header: 'Path' },
};
const title = this.result.response.checkOnly ? 'Validated Source' : 'Deployed Source';
const options = { title: tableHeader(title), 'no-truncate': true };
ux.log();

ux.table(successes.map(getFileResponseSuccessProps), columns, options);
ux.table({
data: successes.map(getFileResponseSuccessProps),
columns: ['state', { key: 'fullName', name: 'Name' }, 'type', { key: 'filePath', name: 'Path' }],
title: tableHeader(title),
overflow: 'wrap',
});
}

private displayFailures(): void {
Expand All @@ -312,24 +307,23 @@ export class DeployResultFormatter extends TestResultsFormatter implements Forma
const failures = this.getFileResponseFailures();
if (!failures?.length) return;

const columns = {
problemType: { header: 'Type' },
fullName: { header: 'Name' },
error: { header: 'Problem' },
loc: { header: 'Line:Column' },
};
const options = { title: error(`Component Failures [${failures.length}]`), 'no-truncate': true };
ux.log();
ux.table(
sortBy(failures, ['problemType', 'fullName', 'lineNumber', 'columnNumber', 'error']).map((f) => ({
ux.table({
data: sortBy(failures, ['problemType', 'fullName', 'lineNumber', 'columnNumber', 'error']).map((f) => ({
problemType: f.problemType,
fullName: f.fullName,
error: f.error,
loc: f.lineNumber ? `${f.lineNumber}:${f.columnNumber ?? ''}` : '',
})),
columns,
options
);
columns: [
{ key: 'problemType', name: 'Type' },
{ key: 'fullName', name: 'Name' },
{ key: 'error', name: 'Problem' },
{ key: 'loc', name: 'Line:Column' },
],
title: error(`Component Failures [${failures.length}]`),
overflow: 'wrap',
});
}
}

Expand All @@ -344,14 +338,12 @@ const displayDeletes = (relativeFiles: FileResponse[], extraDeletes: FileRespons

if (!deletions.length) return;

const columns = {
fullName: { header: 'Name' },
type: { header: 'Type' },
filePath: { header: 'Path' },
};

const options = { title: tableHeader('Deleted Source'), 'no-truncate': true };
ux.log();

ux.table(deletions, columns, options);
ux.table({
data: deletions,
columns: [{ key: 'fullName', name: 'Name' }, 'type', { key: 'filePath', name: 'Path' }],
title: tableHeader('Deleted Source'),
overflow: 'wrap',
});
};
20 changes: 10 additions & 10 deletions src/formatters/metadataConvertResultFormatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,21 @@ export class MetadataConvertResultFormatter implements Formatter<ConvertMdapiJso
public async display(): Promise<void> {
const convertData = await this.getJson();
if (convertData?.length) {
ux.table(
convertData.map((entry) => ({
ux.table({
data: convertData.map((entry) => ({
state: entry.state,
fullName: entry.fullName,
type: entry.type,
filePath: entry.filePath,
})),
{
state: { header: 'STATE' },
fullName: { header: 'FULL NAME' },
type: { header: 'TYPE' },
filePath: { header: 'PROJECT PATH' },
},
{ 'no-truncate': true }
);
columns: [
{ key: 'state', name: 'STATE' },
{ key: 'fullName', name: 'FULL NAME' },
{ key: 'type', name: 'TYPE' },
{ key: 'filePath', name: 'PROJECT PATH' },
],
overflow: 'wrap',
});
} else {
ux.log('No metadata found to convert');
}
Expand Down
40 changes: 21 additions & 19 deletions src/formatters/retrieveResultFormatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,40 +50,42 @@ export class RetrieveResultFormatter implements Formatter<RetrieveResultJson> {
this.ux.log('Nothing retrieved');
}
} else {
const columns = {
state: { header: 'State' },
fullName: { header: 'Name' },
type: { header: 'Type' },
filePath: { header: 'Path' },
};
const options = { title: tableHeader('Retrieved Source'), 'no-truncate': true };
this.ux.log();

this.ux.table(successes, columns, options);
this.ux.table({
data: successes,
columns: ['state', { key: 'fullName', name: 'Name' }, 'type', { key: 'filePath', name: 'Path' }],
title: tableHeader('Retrieved Source'),
overflow: 'wrap',
});
}

const warnings = getWarnings(this.result);
if (warnings.length) {
this.ux.log();
this.ux.table(
warnings,
{ fileName: { header: 'File' }, problem: { header: 'Problem' } },
{ 'no-truncate': true, title: tableHeader('Warnings') }
);
this.ux.table({
data: warnings,
columns: [{ key: 'fileName', name: 'File' }, 'problem'],
title: tableHeader('Warnings'),
overflow: 'wrap',
});
}
}

private async displayPackages(): Promise<void> {
const packages = await this.getPackages();
if (packages?.length) {
const columns = {
name: { header: 'Package Name' },
fullPath: { header: 'Converted Location' },
};
const options = { title: tableHeader('Retrieved Packages'), 'no-truncate': true };
this.ux.log();
this.ux.warn('Metadata from retrieved packages is meant for your reference only, not development.');
this.ux.table(packages, columns, options);
this.ux.table({
data: packages,
columns: [
{ key: 'name', name: 'Package Name' },
{ key: 'fullPath', name: 'Converted Location' },
],
title: tableHeader('Retrieved Packages'),
overflow: 'wrap',
});
}
}

Expand Down
14 changes: 8 additions & 6 deletions src/formatters/testResultsFormatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,14 @@ const displayVerboseTestCoverage = (coverage?: CodeCoverage | CodeCoverage[]): v
const codeCoverage = ensureArray(coverage);
if (codeCoverage.length) {
ux.log();
ux.log(tableHeader('Apex Code Coverage'));

ux.table(codeCoverage.sort(coverageSort).map(coverageOutput), {
name: { header: 'Name' },
coveragePercent: { header: '% Covered' },
linesNotCovered: { header: 'Uncovered Lines' },
ux.table({
data: codeCoverage.sort(coverageSort).map(coverageOutput),
columns: [
'name',
{ key: 'coveragePercent', name: '% Covered' },
{ key: 'linesNotCovered', name: 'Uncovered Lines' },
],
title: tableHeader('Apex Code Coverage'),
});
}
};
Expand Down
22 changes: 10 additions & 12 deletions src/utils/conflicts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,14 @@ export const writeConflictTable = (conflicts?: ConflictResponse[]): void => {
if (!conflicts || conflicts.length === 0) {
return;
}
ux.table(
// Interfaces cannot be used as Record<string, unknown> so we have to make it a concrete type
// See https://github.com/microsoft/TypeScript/issues/15300
conflicts.map((c) => ({ state: c.state, fullName: c.fullName, type: c.type, filePath: c.filePath })),
{
state: { header: 'STATE' },
fullName: { header: 'FULL NAME' },
type: { header: 'TYPE' },
filePath: { header: 'FILE PATH' },
},
{ 'no-truncate': true }
);
ux.table({
data: conflicts,
columns: [
{ key: 'state', name: 'STATE' },
{ key: 'fullName', name: 'FULL NAME' },
{ key: 'type', name: 'TYPE' },
{ key: 'filePath', name: 'FILE PATH' },
],
overflow: 'wrap',
});
};
Loading
Loading