Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: don't truncate at PDR level #654

Merged
merged 4 commits into from
Jun 12, 2023
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
760 changes: 187 additions & 573 deletions CHANGELOG.md

Large diffs are not rendered by default.

4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
"@salesforce/dev-config": "^4.0.1",
"@salesforce/dev-scripts": "^5.4.2",
"@salesforce/plugin-command-reference": "^3.0.2",
"@salesforce/plugin-functions": "^1.21.10",
"@salesforce/plugin-settings": "^1.4.10",
"@salesforce/plugin-source": "^2.10.10",
"@salesforce/plugin-templates": "^55.4.18",
Expand Down Expand Up @@ -94,7 +93,6 @@
"@oclif/plugin-help",
"@salesforce/plugin-command-reference",
"@salesforce/plugin-settings",
"@salesforce/plugin-functions",
"@salesforce/plugin-source",
"@salesforce/plugin-user",
"@salesforce/plugin-templates"
Expand Down Expand Up @@ -270,4 +268,4 @@
"output": []
}
}
}
}
2 changes: 1 addition & 1 deletion src/commands/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ export default class Deploy extends SfCommand<void> {
errorMessage: failure.error.message,
}));
this.styledHeader(messages.getMessage('error.initialization.title'));
this.table(failureData, columns);
this.table(failureData, columns, { 'no-truncate': true });
const err = messages.createError('error.initialization');
err.data = hookResults.failures;
throw err;
Expand Down
16 changes: 10 additions & 6 deletions src/commands/project/delete/source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -484,12 +484,16 @@ export class Source extends SfCommand<DeleteSourceJson> {
return;
}

this.table(conflicts, {
state: { header: 'STATE' },
fullName: { header: 'FULL NAME' },
type: { header: 'TYPE' },
filePath: { header: 'FILE PATH' },
});
this.table(
conflicts,
{
state: { header: 'STATE' },
fullName: { header: 'FULL NAME' },
type: { header: 'TYPE' },
filePath: { header: 'FILE PATH' },
},
{ 'no-truncate': true }
);

// map do dedupe by name-type-filename
const conflictMap = new Map<string, ConflictResponse>();
Expand Down
8 changes: 6 additions & 2 deletions src/formatters/deleteResultFormatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ export class DeleteResultFormatter implements Formatter<DeleteSourceJson> {
fullName: { header: 'FULL NAME' },
type: { header: 'TYPE' },
filePath: { header: 'PROJECT PATH' },
}
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I'd rather have the commands instantiate a new sf-plugins/core Ux and pass that to the formatters' constructor. Then future style/ui changes become one-place-to-change.

There's some other UI inconsistencies between Ux and the SfCommand (colored warnings, for example) that we'd get consistency on.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked into that, but it kept expanding what was required when implementing it for the now deprecated project deploy command.

This approach will be the smallest change in the plugin, and if we wanted a one-place-to-change it, we would change this at the oclif level 🤷‍♂️

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or maybe if there was another level of inheritance involved that provided common options for all source commands and formatters it could be changed in that one place. Maybe call it, SourceCommand or ResultFormatter.

{ 'no-truncate': true }
);
} else {
this.displayFailures();
Expand All @@ -92,7 +93,10 @@ export class DeleteResultFormatter implements Formatter<DeleteSourceJson> {
fullName: { header: 'Name' },
error: { header: 'Problem' },
};
const options = { title: StandardColors.error(bold(`Component Failures [${failures.length}]`)) };
const options: ux.Table.table.Options = {
title: StandardColors.error(bold(`Component Failures [${failures.length}]`)),
'no-truncate': true,
};
ux.log();
ux.table(
failures.map((f) => ({ problemType: f.problemType, fullName: f.fullName, error: f.problem })),
Expand Down
4 changes: 2 additions & 2 deletions src/formatters/deployReportResultFormatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class DeployReportResultFormatter extends DeployResultFormatter {
);

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

const opts = Object.entries(this.flags).reduce<Array<{ key: string; value: unknown }>>((result, [key, value]) => {
if (key === 'timestamp') return result;
Expand All @@ -38,7 +38,7 @@ export class DeployReportResultFormatter extends DeployResultFormatter {
return result.concat({ key, value });
}, []);
ux.log();
ux.table(opts, { key: {}, value: {} }, { title: tableHeader('Deploy Options') });
ux.table(opts, { key: {}, value: {} }, { title: tableHeader('Deploy Options'), 'no-truncate': true });
super.display();
}
}
Expand Down
21 changes: 13 additions & 8 deletions src/formatters/deployResultFormatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ export class DeployResultFormatter implements Formatter<DeployResultJson> {
},
{
title: tableHeader('Metadata Replacements'),
'no-truncate': true,
}
);
}
Expand All @@ -237,7 +238,7 @@ export class DeployResultFormatter implements Formatter<DeployResultJson> {
filePath: { header: 'Path' },
};
const title = this.result.response.checkOnly ? 'Validated Source' : 'Deployed Source';
const options = { title: tableHeader(title) };
const options = { title: tableHeader(title), 'no-truncate': true };
ux.log();

ux.table(
Expand Down Expand Up @@ -269,7 +270,7 @@ export class DeployResultFormatter implements Formatter<DeployResultJson> {
fullName: { header: 'Name' },
error: { header: 'Problem' },
};
const options = { title: error(`Component Failures [${failures.length}]`) };
const options = { title: error(`Component Failures [${failures.length}]`), 'no-truncate': true };
ux.log();
ux.table(
failures.map((f) => ({ problemType: f.problemType, fullName: f.fullName, error: f.error })),
Expand All @@ -289,7 +290,7 @@ export class DeployResultFormatter implements Formatter<DeployResultJson> {
filePath: { header: 'Path' },
};

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

ux.table(getFileResponseSuccessProps(deletions), columns, options);
Expand Down Expand Up @@ -361,11 +362,15 @@ export class DeployResultFormatter implements Formatter<DeployResultJson> {
ux.log();
ux.log(tableHeader('Apex Code Coverage'));

ux.table(coverage.map(coverageOutput), {
name: { header: 'Name' },
numLocations: { header: '% Covered' },
lineNotCovered: { header: 'Uncovered Lines' },
});
ux.table(
coverage.map(coverageOutput),
{
name: { header: 'Name' },
numLocations: { header: '% Covered' },
lineNotCovered: { header: 'Uncovered Lines' },
},
{ 'no-truncate': true }
);
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/formatters/metadataConvertResultFormatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ export class MetadataConvertResultFormatter implements Formatter<ConvertMdapiJso
fullName: { header: 'FULL NAME' },
type: { header: 'TYPE' },
filePath: { header: 'PROJECT PATH' },
}
},
{ 'no-truncate': true }
);
} else {
ux.log('No metadata found to convert');
Expand Down
4 changes: 2 additions & 2 deletions src/formatters/retrieveResultFormatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export class RetrieveResultFormatter implements Formatter<RetrieveResultJson> {
filePath: { header: 'Path' },
};
const title = 'Retrieved Source';
const options = { title: tableHeader(title) };
const options = { title: tableHeader(title), 'no-truncate': true };
this.ux.log();

this.ux.table(getFileResponseSuccessProps(successes), columns, options);
Expand All @@ -67,7 +67,7 @@ export class RetrieveResultFormatter implements Formatter<RetrieveResultJson> {
fullPath: { header: 'Converted Location' },
};
const title = 'Retrieved Packages';
const options = { title: tableHeader(title) };
const options = { title: tableHeader(title), 'no-truncate': true };
this.ux.log();
this.ux.table(packages, columns, options);
}
Expand Down
3 changes: 2 additions & 1 deletion src/utils/conflicts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const writeConflictTable = (conflicts: ConflictResponse[]): void => {
fullName: { header: 'FULL NAME' },
type: { header: 'TYPE' },
filePath: { header: 'FILE PATH' },
}
},
{ 'no-truncate': true }
);
};
Loading