Skip to content

feat: initial revision for app preview on desktop #42

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

Merged
merged 3 commits into from
Jun 4, 2024

Conversation

maliroteh-sf
Copy link
Contributor

What does this PR do?

Adds support for sf lightning preview app command for desktop only.

To run the command, ensure that you have authorized at least one org:

  • sf lightning preview app => should launch the default org and navigate to the default app
  • sf lightning preview app -n Sales => should launch the default org and navigate to the Sales app
  • sf lightning preview app -o MyOrg => should launch the specified org and navigate to the default app
  • sf lightning preview app -o MyOrg -n Sales => should launch the specified org and navigate to the Sales app

What issues does this PR fix or reference?

@W-15429062@

@maliroteh-sf maliroteh-sf requested a review from a team as a code owner May 30, 2024 18:51
@maliroteh-sf maliroteh-sf requested a review from khawkins May 30, 2024 18:51
@@ -1,15 +1,15 @@
[
Copy link
Contributor Author

Choose a reason for hiding this comment

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

auto-generated after running yarn update-snapshots

@@ -6,22 +6,23 @@
"bugs": "https://github.com/forcedotcom/cli/issues",
"dependencies": {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since I was pulling in @salesforce/lwc-dev-mobile-core I also decided to update the rest of the dependencies to the latest version.

@@ -1,16 +0,0 @@
{
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 removed this file since for now LightningPreviewApp extends from SfCommand<void> and does not return anything. As we work on adding more functionalities to LightningPreviewApp, we can change the return type as needed and auto-generate the new schema

};

export default class LightningPreviewApp extends SfCommand<LightningPreviewAppResult> {
export default class LightningPreviewApp extends SfCommand<void> {
public static readonly summary = messages.getMessage('summary');
public static readonly description = messages.getMessage('description');
public static readonly examples = messages.getMessages('examples');

public static readonly flags = {
name: Flags.string({
summary: messages.getMessage('flags.name.summary'),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

As per latest discussion here, --name is now optional.

const platform = flags['device-type'];

logger.debug('Determining Local Dev Server url');
// todo: figure out how to make the port dynamic instead of hard-coded value here
Copy link
Contributor Author

Choose a reason for hiding this comment

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

As the work for automatically starting the dev server progresses, we should have a better idea on how to achieve this.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Cc: @nrkruk

Comment on lines +12 to +16
* Given an app name, it queries the org to find the matching app id. To do so,
* it will first attempt at finding the app with a matching DeveloperName. If
* no match is found, it will then attempt at finding the app with a matching
* Label. If multiple matches are found, then the first match is returned.
*
Copy link
Contributor Author

Choose a reason for hiding this comment

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

See this discussion which lead to the implementation here.

Copy link
Contributor

@sfdctaka sfdctaka left a comment

Choose a reason for hiding this comment

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

LGTM!

Co-authored-by: Kevin Hawkins <khawkins@salesforce.com>

logger.debug('Determining Local Dev Server url');
// todo: figure out how to make the port dynamic instead of hard-coded value here
const ldpServerUrl = PreviewUtils.generateWebSocketUrlForLocalDevServer(platform, '8081');
Copy link
Collaborator

Choose a reason for hiding this comment

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

@nrkruk et al: I just want to call out that with this line we are (in this moment anyway) officially putting LDP-related utility functionality into the lwc-dev-mobile-core project/package. I think such functionality could live in there, or we could create a new independent package, or we could re-brand the existing one. No action necessary here: I just wanted to call it out for discussion.

Copy link
Collaborator

@khawkins khawkins left a comment

Choose a reason for hiding this comment

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

This all looks pretty good to me. Just a couple of questions.

Copy link
Collaborator

@khawkins khawkins left a comment

Choose a reason for hiding this comment

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

Looks good!

@maliroteh-sf maliroteh-sf merged commit fe99de1 into salesforcecli:main Jun 4, 2024
1 check passed
@maliroteh-sf maliroteh-sf deleted the W-15429062 branch June 4, 2024 14:49
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.

3 participants