Skip to content

feat(lightning-out): add template generate lightning-out command - #1045

Closed
akashdhake wants to merge 7 commits into
salesforcecli:mainfrom
akashdhake:lo2/lightning-out-warn-poc
Closed

feat(lightning-out): add template generate lightning-out command#1045
akashdhake wants to merge 7 commits into
salesforcecli:mainfrom
akashdhake:lo2/lightning-out-warn-poc

Conversation

@akashdhake

@akashdhake akashdhake commented Sep 5, 2026

Copy link
Copy Markdown

What

Adds the sf template generate lightning-out command (beta, hidden) — a generate-only scaffolder for Lightning Out 2.0 setup. Writes the 7 LO2 metadata artifacts (via the companion @salesforce/templates generator, PR forcedotcom/salesforcedx-templates#880); deploys nothing itself and never contacts an org.

Command layer

  • Flags: --app-name, --eca-name, --runtime (LWR_CORE|CLWR), --host-domains (multiple), --components (multiple), --eca-contact-email, --eca-callback-url, --definition-file, --output-dir, --api-version.
  • Input resolution: merges --definition-file + flags into one options object with per-key precedence; list keys (host-domains, components) replace wholesale.
  • Advisories: emits a CLI-side sourceApiVersion < 68 deploy-floor warning and flags unknown --definition-file keys; prints post-generate deploy guidance.
  • No iframe / force / prompt / distribution-state / oauth-scopes machinery (invariants are hardcoded in the generator).

Testing

  • Unit tests: merge precedence, list-replace semantics, definition-file fallback, unknown-key reporting, beta/hidden.
  • NUT: drives the command end-to-end, asserts exactly the 7 artifact types land (correct folders/filenames/contents) and that iframeWhiteListUrlSettings is absent; validation failure exits non-zero cleanly.
  • Verified against a live local-Core org (generate → deploy 10/10 succeeded).

Work item: W-24035498

Reads a JSON definition file and scaffolds the LO 2.0 metadata via
@salesforce/templates. Always warns that the generated
IframeWhiteListUrlSettings REPLACES the org's Trusted Domains list
on deploy. Generate-only.
… success output

- Rewrite src/commands/template/generate/lightning-out/index.ts to match the
  shipped @salesforce/templates LightningOutOptions shape (appName/eca.name,
  no distributionState/oauthScopes/force). Drops the interactive
  iframe-confirm/cancel path, --force, --no-prompt, --eca-distribution-state,
  --eca-oauth-scopes, and the old flat --name flag; adds --app-name,
  --eca-name. Extracts a pure, exported mergeLightningOutInputs() for
  per-key flag/definition-file precedence with wholesale list-replace for
  hostDomains/components, and a getSourceApiVersion() helper (SfProject,
  best-effort) for a CLI-side sourceApiVersion<68 advisory. Surfaces the
  generator's result.warnings and prints success guidance via this.info.
- Rewrite messages/lightningOut.md to the exact key set run() references
  (verified by grep): drops iframe/force/no-prompt/eca-distribution-state/
  eca-oauth-scopes/flags.name/error.missing-inputs keys, adds
  app-name/eca-name/definition-file summaries, error.definition-file-not-object,
  warning.unknown-definition-key, warning.source-api-version, and the
  success.* guidance keys.
- Add unit test test/commands/template/generate/lightning-out/index.test.ts
  covering mergeLightningOutInputs precedence, list-replace semantics, and
  unknown-key reporting, plus the beta/hidden command metadata.
- Regenerate command-snapshot.json and schemas/*.json (oclif `snapshot
  generate` / `schema generate`) so test:deprecation-policy and
  test:json-schema stay green against the new flag set; the schema diff for
  commands other than lightning-out is solely the pre-existing
  CreateOutput.warnings field already shipped by the linked generator.
@akashdhake

Copy link
Copy Markdown
Author

Reopened as #1048 after renaming the branch lo2/lightning-out-warn-poclo2/lightning-out (the old name predated the warnings-channel removal). Same commits (a27248b), corrected description. Superseded by #1048.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant