diff --git a/.github/workflows/onRelease.yml b/.github/workflows/onRelease.yml index 328d46bd..6ae58fb1 100644 --- a/.github/workflows/onRelease.yml +++ b/.github/workflows/onRelease.yml @@ -45,7 +45,7 @@ jobs: uses: salesforcecli/github-workflows/.github/workflows/npmPublish.yml@main needs: [getDistTag, getMajorVersion] with: - #ctc: true + ctc: true sign: true # At CLCO, the new patch branch's version will be released as 'prerelease'. After R2b, delete the logic below for 'latest' and update 'prerelease' candidate to 'latest' tag: ${{ needs.getDistTag.outputs.tag || (needs.getMajorVersion.outputs.major == '4' && 'latest') || (needs.getMajorVersion.outputs.major == '5' && 'prerelease') || 'next' }} diff --git a/CODEOWNERS b/CODEOWNERS index ef62a105..461ac519 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -2,3 +2,5 @@ #GUSINFO:Application Fabric Services, Application Fabric Services * @salesforcecli/local-dev @salesforcecli/lex @salesforcecli/mobile-platform-experience + +#ECCN:Open Source diff --git a/README.md b/README.md index f49c824b..1d3484d6 100644 --- a/README.md +++ b/README.md @@ -259,18 +259,14 @@ _See code: [src/commands/lightning/dev/component.ts](https://github.com/salesfor ``` USAGE - $ sf lightning dev site -o [--flags-dir ] [-n ] [-l] [--guest] [--ssr] [--api-version ] + $ sf lightning dev site -o [--flags-dir ] [-n ] [--api-version ] FLAGS - -l, --get-latest Download the latest version of the specified site from your org, instead of using any local - cache. -n, --name= Name of the Experience Builder site to preview. It has to match a site name from the current org. -o, --target-org= (required) Username or alias of the target org. Not required if the `target-org` configuration variable is already set. --api-version= Override the api version used for api requests made by this command - --guest Preview the site as a guest user (rather than an authenticated user). - --ssr Preview the SSR bundle GLOBAL FLAGS --flags-dir= Import flag values from a directory. @@ -302,10 +298,6 @@ EXAMPLES Preview the site "Partner Central" from the org "myOrg": $ sf lightning dev site --name "Partner Central" --target-org myOrg - - Get and preview the latest version of the "Partner Central" site from the org "myOrg" - - $ sf lightning dev site --name "Partner Central" --target-org myOrg --get-latest ``` _See code: [src/commands/lightning/dev/site.ts](https://github.com/salesforcecli/plugin-lightning-dev/blob/6.2.12/src/commands/lightning/dev/site.ts)_ diff --git a/command-snapshot.json b/command-snapshot.json index eddcedff..fd20b8cb 100644 --- a/command-snapshot.json +++ b/command-snapshot.json @@ -19,8 +19,8 @@ "alias": [], "command": "lightning:dev:site", "flagAliases": [], - "flagChars": ["l", "n", "o"], - "flags": ["api-version", "flags-dir", "get-latest", "guest", "name", "ssr", "target-org"], + "flagChars": ["n", "o"], + "flags": ["api-version", "flags-dir", "name", "target-org"], "plugin": "@salesforce/plugin-lightning-dev" } ] diff --git a/messages/lightning.dev.site.md b/messages/lightning.dev.site.md index 20fd1011..b2608472 100644 --- a/messages/lightning.dev.site.md +++ b/messages/lightning.dev.site.md @@ -21,23 +21,9 @@ For more considerations and limitations, see the Lightning Web Components Develo Name of the Experience Builder site to preview. It has to match a site name from the current org. -# flags.get-latest.summary - -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). - -# flags.ssr.summary - -Preview the SSR bundle - # examples - Select a site to preview from the org "myOrg": <%= config.bin %> <%= command.id %> --target-org myOrg - Preview the site "Partner Central" from the org "myOrg": <%= config.bin %> <%= command.id %> --name "Partner Central" --target-org myOrg -- Get and preview the latest version of the "Partner Central" site from the org "myOrg" - <%= config.bin %> <%= command.id %> --name "Partner Central" --target-org myOrg --get-latest diff --git a/src/commands/lightning/dev/app.ts b/src/commands/lightning/dev/app.ts index 3b5b02de..9175f8ad 100644 --- a/src/commands/lightning/dev/app.ts +++ b/src/commands/lightning/dev/app.ts @@ -88,7 +88,7 @@ export default class LightningDevApp extends SfCommand { throw new Error(sharedMessages.getMessage('error.no-project', [(error as Error)?.message ?? ''])); } - logger.debug('Initalizing preview connection and configuring local web server identity'); + logger.debug('Initializing preview connection and configuring local web server identity'); const connection = targetOrg.getConnection(apiVersion); diff --git a/src/commands/lightning/dev/site.ts b/src/commands/lightning/dev/site.ts index 54e9a42a..ae348817 100644 --- a/src/commands/lightning/dev/site.ts +++ b/src/commands/lightning/dev/site.ts @@ -13,11 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import fs from 'node:fs'; import { SfCommand, Flags } from '@salesforce/sf-plugins-core'; import { Connection, Logger, Messages, SfProject } from '@salesforce/core'; import { Platform } from '@salesforce/lwc-dev-mobile-core'; -import { expDev, SitesLocalDevOptions, setupDev } from '@lwrjs/api'; import open from 'open'; import { PromptUtils } from '../../../shared/promptUtils.js'; import { ExperienceSite } from '../../../shared/experience/expSite.js'; @@ -41,18 +39,6 @@ export default class LightningDevSite extends SfCommand { char: 'n', }), 'target-org': Flags.requiredOrg(), - 'get-latest': Flags.boolean({ - summary: messages.getMessage('flags.get-latest.summary'), - char: 'l', - }), - guest: Flags.boolean({ - summary: messages.getMessage('flags.guest.summary'), - default: false, - }), - ssr: Flags.boolean({ - summary: messages.getMessage('flags.ssr.summary'), - default: false, - }), 'api-version': Flags.orgApiVersion(), }; @@ -61,10 +47,7 @@ export default class LightningDevSite extends SfCommand { try { const org = flags['target-org']; - const getLatest = flags['get-latest']; const apiVersion = flags['api-version']; - const guest = flags.guest; - const ssr = flags.ssr; let siteName = flags.name; const connection = org.getConnection(apiVersion); @@ -81,76 +64,13 @@ export default class LightningDevSite extends SfCommand { const selectedSite = new ExperienceSite(org, siteName); - if (!ssr) { - return await this.openPreviewUrl(selectedSite, connection); - } - await this.serveSSRSite(selectedSite, getLatest, siteName, guest); + return await this.openPreviewUrl(selectedSite, connection); } catch (e) { this.spinner.stop('failed.'); this.log('Local Development setup failed', e); } } - private async serveSSRSite( - selectedSite: ExperienceSite, - getLatest: boolean, - siteName: string, - guest: boolean, - ): Promise { - let siteZip: string | undefined; - - // If the site is not setup / is not based on the current release / or get-latest is requested -> - // generate and download a new site bundle from the org based on latest builder metadata - if (!selectedSite.isSiteSetup() || getLatest) { - const startTime = Date.now(); - this.log(`[local-dev] Initializing: ${siteName}`); - this.spinner.start('[local-dev] Downloading site (this may take a few minutes)'); - siteZip = await selectedSite.downloadSite(); - - // delete oldSitePath recursive - const oldSitePath = selectedSite.getExtractDirectory(); - if (fs.existsSync(oldSitePath)) { - fs.rmSync(oldSitePath, { recursive: true }); - } - const endTime = Date.now(); - const duration = (endTime - startTime) / 1000; // Convert to seconds - this.spinner.stop('done.'); - this.log(`[local-dev] Site setup completed in ${duration.toFixed(2)} seconds.`); - } - - this.log(`[local-dev] launching browser preview for: ${siteName}`); - - // Establish a valid access token for this site - const authToken = guest ? '' : await selectedSite.setupAuth(); - - // Start the dev server - const port = parseInt(process.env.PORT ?? '3000', 10); - - // Internal vs external mode - const internalProject = !fs.existsSync('sfdx-project.json') && fs.existsSync('lwr.config.json'); - const logLevel = process.env.LOG_LEVEL ?? 'error'; - - const startupParams: SitesLocalDevOptions = { - sfCLI: !internalProject, - authToken, - open: process.env.OPEN_BROWSER === 'false' ? false : true, - port, - logLevel, - mode: 'dev', - siteZip, - siteDir: selectedSite.getSiteDirectory(), - }; - - // Environment variable used to setup the site rather than setup & start server - if (process.env.SETUP_ONLY === 'true') { - await setupDev(startupParams); - this.log('[local-dev] setup complete!'); - } else { - await expDev(startupParams); - this.log('[local-dev] watching for file changes... (CTRL-C to stop)'); - } - } - private async openPreviewUrl(selectedSite: ExperienceSite, connection: Connection): Promise { let sfdxProjectRootPath = ''; try {