Skip to content

Commit

Permalink
Merge pull request #528 from salesforcecli/Slac/table
Browse files Browse the repository at this point in the history
feat: update new table
  • Loading branch information
WillieRuemmele authored Oct 28, 2024
2 parents 01a7916 + d1a08d2 commit 3dfe160
Show file tree
Hide file tree
Showing 3 changed files with 475 additions and 48 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
"@inquirer/confirm": "^2.0.15",
"@inquirer/input": "^1.2.14",
"@inquirer/select": "^1.3.1",
"@oclif/core": "^4",
"@oclif/core": "^4.0.29",
"@octokit/rest": "^19.0.13",
"@salesforce/core": "^8.2.7",
"@salesforce/kit": "^3.1.6",
"@salesforce/sf-plugins-core": "^11.2.4",
"@salesforce/sf-plugins-core": "^12.0.7",
"@salesforce/ts-types": "^2.0.11",
"change-case": "^5.4.2",
"ejs": "^3.1.10",
Expand Down
63 changes: 22 additions & 41 deletions src/commands/dev/audit/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,71 +163,52 @@ export default class AuditMessages extends SfCommand<AuditResults> {
}
const data = this.auditResults.missingMessages.map(({ File, SourceVar, Name, IsLiteral, Bundle }) => ({
File,
SourceVar,
'Message Bundle Var': SourceVar,
Name,
IsLiteral: IsLiteral ? '' : '*',
Bundle,
'Referenced Bundle': Bundle,
}));
this.table(
data,
hasNonLiteralReferences
? {
File: { header: 'File' },
SourceVar: { header: 'Message Bundle Var' },
Name: { header: 'Name' },
IsLiteral: { header: '*' },
Bundle: { header: 'Referenced Bundle' },
}
: {
File: { header: 'File' },
SourceVar: { header: 'Message Bundle Var' },
Name: { header: 'Name' },
Bundle: { header: 'Referenced Bundle' },
},
{ 'no-truncate': true }
);
this.table({ data, overflow: 'wrap' });
}

this.log();
if (this.auditResults.unusedMessages.length === 0) {
this.styledHeader(messages.getMessage('noUnusedMessagesFound'));
} else {
this.styledHeader(messages.getMessage('unusedMessagesFound'));
const hasReferencedInNonLiteral = this.auditResults.unusedMessages.some((msg) => msg.ReferencedInNonLiteral);
this.table(
this.auditResults.unusedMessages,
hasReferencedInNonLiteral
this.table({
data: this.auditResults.unusedMessages,
...(hasReferencedInNonLiteral
? {
Bundle: { header: 'Bundle' },
Name: { header: 'Name' },
ReferencedInNonLiteral: { header: '*' },
Bundle: 'Bundle',
Name: 'Name',
ReferencedInNonLiteral: '*',
}
: {
Bundle: { header: 'Bundle' },
Name: { header: 'Name' },
}
);
Bundle: 'Bundle',
Name: 'Name',
}),
title: messages.getMessage('unusedMessagesFound'),
});
}

this.log();
if (this.auditResults.unusedBundles.length === 0) {
this.styledHeader(messages.getMessage('noUnusedBundlesFound'));
} else {
this.styledHeader(messages.getMessage('unusedBundlesFound'));
this.table(
this.auditResults.unusedBundles.map((Bundle) => ({ Bundle })),
{ Bundle: { header: 'Bundle' } }
);
this.table({
data: this.auditResults.unusedBundles.map((Bundle) => ({ Bundle })),
title: messages.getMessage('unusedBundlesFound'),
});
}
this.log();
if (this.auditResults.missingBundles.length === 0) {
this.styledHeader(messages.getMessage('noMissingBundlesFound'));
} else {
this.styledHeader(messages.getMessage('missingBundlesFound'));
this.table(this.auditResults.missingBundles, {
File: { header: 'File' },
SourceVar: { header: 'Message Bundle Var' },
Bundle: { header: 'Bundle' },
this.table({
data: this.auditResults.missingBundles,
columns: ['File', { key: 'SourceVar', name: 'Message Bundle Var' }, 'Bundle'],
title: messages.getMessage('missingBundlesFound'),
});
}
}
Expand Down
Loading

0 comments on commit 3dfe160

Please sign in to comment.