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

feat: show channel in --available table #840

Merged
merged 3 commits into from
Jun 12, 2024
Merged

Conversation

mdonnalley
Copy link
Contributor

@mdonnalley mdonnalley commented Jun 10, 2024

  • Show Channel in the update --available table.
  • Show channel in update --interactive prompt

In both cases, we assume that dist-tags in npm correlate to what's in S3. Can be disabled with setting oclif.update.disableNpmLookup to true in CLI package.json

Fixes #674

@W-15974839@

WillieRuemmele
WillieRuemmele previously approved these changes Jun 12, 2024
@WillieRuemmele
Copy link
Contributor

QA Notes


✅ : channels in output

 ➜  sf update --available
 ›   Warning: @oclif/plugin-update is a linked ESM module and cannot be auto-transpiled. Existing compiled source will be used instead.
Looking up versions... Found 140 versions

  ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬─────────────┬─────────┐
  │                                                             Location                                                              │   Version   │ Channel │
  ├───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼─────────────┼─────────┤
  │ https://developer.salesforce.com/media/salesforce-cli/sf/versions/2.46.6/191291b/sf-v2.46.6-191291b-darwin-arm64.tar.gz           │ 2.46.6      │ nightly │
  │ https://developer.salesforce.com/media/salesforce-cli/sf/versions/2.46.5/a4ab13a/sf-v2.46.5-a4ab13a-darwin-arm64.tar.gz           │ 2.46.5      │         │
  │ https://developer.salesforce.com/media/salesforce-cli/sf/versions/2.46.5-qa.0/b6df280/sf-v2.46.5-qa.0-b6df280-darwin-arm64.tar.gz │ 2.46.5-qa.0 │ qa  

❌ : --interactive --available only prints table, probably need flag validation to coerce our desired behavior there
❌ : --force --available only prints the table, same as above
💡 / 🤷‍♂️ : but it's not a breaking change, or changing behavior... so it's ok - it would also just throw an error, and then the user would have to run the --available again to get the table regardless

@WillieRuemmele
Copy link
Contributor

✅ : flag validation

 ➜  sf update --available --force
 ›   Warning: @oclif/plugin-update is a linked ESM module and cannot be auto-transpiled. Existing compiled source will be used instead.
 ›   Error: The following error occurred:
 ›     --available=true cannot also be provided when using --force
 ›   See more help with --help
➜  dreamhouse-lwc git:(main) ✗  hub:(GLOBAL - DevHub) scratch:([email protected])
 ➜  sf update --available --interactive 
 ›   Warning: @oclif/plugin-update is a linked ESM module and cannot be auto-transpiled. Existing compiled source will be used instead.
 ›   Error: The following error occurred:
 ›     --interactive=true cannot also be provided when using --available
 ›   See more help with --help

@WillieRuemmele WillieRuemmele merged commit 26946dd into main Jun 12, 2024
13 checks passed
@WillieRuemmele WillieRuemmele deleted the mdonnalley/show-channel branch June 12, 2024 20:59
sort(Object.keys(index))
.reverse()
.map((version) => {
const location = localVersions.find((l) => basename(l).startsWith(version)) || index[version]
if (distTags) {
return [location, version, distTags[version] ?? '']
Copy link

Choose a reason for hiding this comment

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

distTags[version]

So in order for this to work, then one must create an NPM tag together with publish to S3?

A bit curious, if the requirement to keep two sources of truth as opposed to just S3. Or S3 doesn't have this kind of information?

Sorry if the question is trivial 🙏 Thank you!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it assumes that you're publishing to both npm and S3. But this assumption has been true for a long time here and can be turned off by setting disableNpmLookup to true in oclif.update in your package.json

Really the only way to get the information from S3 is to know ahead of time which channels you want (e.g. I want to show stable, stable-rc, and nightly). But that's hard to do in a plugin like this which is meant to be used by a wide variety of CLIs. For instance one CLI might make heavy use of nightly channel whereas another CLI might use a beta channel. Of course, this could be configured at the CLI level but I figured that since we were already assuming elsewhere that the CLI is published both to npm and S3 we could continue making that assumption.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Would be nice for --available to include Channel as well in the last column
3 participants