-
Notifications
You must be signed in to change notification settings - Fork 0
@W-21194676 - refactor: use oclif libraries for outputs #16
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
@W-21194676 - refactor: use oclif libraries for outputs #16
Conversation
|
|
||
| Currently, this command supports enriching only Lightning Web Components, represented by the LightningComponentBundle metadata type. | ||
|
|
||
| Your org must be eligible for metadata enrichment. Your Salesforce admin can help with that. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Your org must be eligible for metadata enrichment. Your Salesforce admin can help with that. | |
| Your org must be enabled with the MetadataAiEnrichmentPilot org perm to use the metadata enrichment feature. Contact your Salesforce admin. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's useful to explicitly say what's needed to use the feature.
If, however, there's more that has to happen beyond just enabling an org perm, then reject my suggestion and just keep the more vague original message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Valid point. I think for future proofing and to not expose the pilot perm (it's something we need to enable from our end - access requirements will likely change in the near future), we will keep it for now and revisit later!
| Executing metadata enrichment for %s eligible components | ||
| Executing metadata enrichment | ||
|
|
||
| # spinner.updating.files |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what do spinner and stage mean here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are both from oclif libraries as part CLI output formatting. Both do basically the same thing but just in slightly different ways (Spinner, Stage).
CLI team recommended us to use multi stage output for consistency with other plugins and make it clear what stage the execution is that, which is what this change is.
| import { MultiStageOutput } from '@oclif/multi-stage-output'; | ||
| import { Messages, SfProject } from '@salesforce/core'; | ||
| import { SfCommand, Flags } from '@salesforce/sf-plugins-core'; | ||
| import { Flags, SfCommand, Ux } from '@salesforce/sf-plugins-core'; | ||
| import { ComponentSetBuilder } from '@salesforce/source-deploy-retrieve'; | ||
| import { EnrichmentHandler, EnrichmentMetrics, EnrichmentStatus, FileProcessor } from '@salesforce/metadata-enrichment'; | ||
| import { ComponentProcessor } from '../../component/index.js'; | ||
| import { MetricsFormatter, EnrichmentRecords } from '../../utils/index.js'; | ||
| import { EnrichmentRecords } from '../../utils/index.js'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Organizing imports or something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes the only two actual changes were:
- Removing MetricsFormatter (this was removed in favor of using oclif library)
- Adding Ux from sf-plugins-core
| commandMessages.getMessage('stage.executing'), | ||
| commandMessages.getMessage('stage.updating.files'), | ||
| ]; | ||
| const mso = new MultiStageOutput({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit - can we rename the const to MULTI_STAGE_OUTPUT as this is a constant and provides better readability
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's actually not a constant but an initialized object that we call in order to move stages and change the output to the console. (see mso.goto() and mso.next() calls) It's inline with other plugins in salesforcecli org
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Though the const stages above could be moved to constants. Will update.
| const metrics = EnrichmentMetrics.createEnrichmentMetrics(Array.from(enrichmentRecords.recordSet)); | ||
| MetricsFormatter.logMetrics(this.log.bind(this), metrics, metricsMessages); | ||
| const ux = new Ux(); | ||
| ux.log(''); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this?
ux.log('');
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea this is basically to print a newline
| overflow: 'wrap', | ||
| }); | ||
| } | ||
| ux.log(''); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need this?
ux.log('');
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
README.md
Outdated
| -o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org` | ||
| configuration variable is already set. | ||
| -m, --metadata=<value>... (required) Metadata type and optional component name to enrich. | ||
| -o, --target-org=<value> (required) [default: epic.out.18fed7c5294a@orgfarm.salesforce.com] Username or alias of the target |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[default: epic.out.18fed7c5294a@orgfarm.salesforce.com]
It might be default in one's system and not in others
Can we specify this as an example isntead if need be to avoid confusion
--target-org=epic.out.18fed7c5294a@orgfarm.salesforce.com
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch - this needs to be removed. This was printed out from my local context which won't apply in the README.md. Will update.
What does this PR do?
previewstateWhat issues does this PR fix or reference?
GUS: @W-21194676@