From 411b741188fd2fa2ae46eb346656e7e4a6658657 Mon Sep 17 00:00:00 2001 From: Nicolas Kruk Date: Tue, 13 May 2025 05:59:29 -0400 Subject: [PATCH 1/3] feat: add guest flag --- messages/lightning.dev.site.md | 4 ++++ src/commands/lightning/dev/site.ts | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/messages/lightning.dev.site.md b/messages/lightning.dev.site.md index 325433e3..b2cb1df7 100644 --- a/messages/lightning.dev.site.md +++ b/messages/lightning.dev.site.md @@ -25,6 +25,10 @@ Name of the Experience Builder site to preview. It has to match a site name from Download the latest version of the specified site from your org, instead of using any local cache. +# flags.guest.summary + +Preview the site as a guest user (rather than an authenticated user), + # examples - Select a site to preview from the org "myOrg": diff --git a/src/commands/lightning/dev/site.ts b/src/commands/lightning/dev/site.ts index bde40cc4..8977e98e 100644 --- a/src/commands/lightning/dev/site.ts +++ b/src/commands/lightning/dev/site.ts @@ -32,6 +32,10 @@ export default class LightningDevSite extends SfCommand { summary: messages.getMessage('flags.get-latest.summary'), char: 'l', }), + guest: Flags.boolean({ + summary: messages.getMessage('flags.guest.summary'), + default: false, + }), }; public async run(): Promise { @@ -40,6 +44,7 @@ export default class LightningDevSite extends SfCommand { try { const org = flags['target-org']; const getLatest = flags['get-latest']; + const guest = flags.guest; let siteName = flags.name; const connection = org.getConnection(undefined); @@ -82,7 +87,7 @@ export default class LightningDevSite extends SfCommand { this.log(`[local-dev] launching browser preview for: ${siteName}`); // Establish a valid access token for this site - const authToken = await selectedSite.setupAuth(); + const authToken = guest ? '' : await selectedSite.setupAuth(); // Start the dev server const port = parseInt(process.env.PORT ?? '3000', 10); From 1fba9493806e01a36ad716fea2f5f475d0af7bb8 Mon Sep 17 00:00:00 2001 From: Nicolas Kruk Date: Tue, 13 May 2025 06:03:33 -0400 Subject: [PATCH 2/3] chore: punctuation --- messages/lightning.dev.site.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/messages/lightning.dev.site.md b/messages/lightning.dev.site.md index b2cb1df7..d8b7baad 100644 --- a/messages/lightning.dev.site.md +++ b/messages/lightning.dev.site.md @@ -27,7 +27,7 @@ Download the latest version of the specified site from your org, instead of usin # flags.guest.summary -Preview the site as a guest user (rather than an authenticated user), +Preview the site as a guest user (rather than an authenticated user). # examples From f3bc8ed25e2530692f0ea6da8f91ec9c65ae9719 Mon Sep 17 00:00:00 2001 From: Nicolas Kruk Date: Tue, 13 May 2025 06:09:27 -0400 Subject: [PATCH 3/3] fix: snapshots --- command-snapshot.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/command-snapshot.json b/command-snapshot.json index 35f20091..9c5fe96b 100644 --- a/command-snapshot.json +++ b/command-snapshot.json @@ -20,7 +20,7 @@ "command": "lightning:dev:site", "flagAliases": [], "flagChars": ["l", "n", "o"], - "flags": ["flags-dir", "get-latest", "name", "target-org"], + "flags": ["flags-dir", "get-latest", "guest", "name", "target-org"], "plugin": "@salesforce/plugin-lightning-dev" } ]