{"id":39066102,"url":"https://github.com/salesforcecli/plugin-lightning-dev","last_synced_at":"2026-02-28T08:38:02.733Z","repository":{"id":234535260,"uuid":"788646038","full_name":"salesforcecli/plugin-lightning-dev","owner":"salesforcecli","description":"Local development tools for LEX, Mobile, and Experience Sites","archived":false,"fork":false,"pushed_at":"2026-02-18T06:05:13.000Z","size":4559,"stargazers_count":18,"open_issues_count":38,"forks_count":18,"subscribers_count":9,"default_branch":"main","last_synced_at":"2026-02-18T07:39:38.534Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/salesforcecli.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-04-18T20:14:31.000Z","updated_at":"2026-02-18T06:05:17.000Z","dependencies_parsed_at":"2024-04-19T18:48:39.579Z","dependency_job_id":"7114e9a7-cc50-42d7-ade4-4d4afe5dfe34","html_url":"https://github.com/salesforcecli/plugin-lightning-dev","commit_stats":null,"previous_names":["salesforcecli/plugin-local-dev","salesforcecli/plugin-lightning-dev"],"tags_count":191,"template":false,"template_full_name":null,"purl":"pkg:github/salesforcecli/plugin-lightning-dev","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/salesforcecli%2Fplugin-lightning-dev","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/salesforcecli%2Fplugin-lightning-dev/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/salesforcecli%2Fplugin-lightning-dev/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/salesforcecli%2Fplugin-lightning-dev/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/salesforcecli","download_url":"https://codeload.github.com/salesforcecli/plugin-lightning-dev/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/salesforcecli%2Fplugin-lightning-dev/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29674446,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-21T03:11:15.450Z","status":"ssl_error","status_checked_at":"2026-02-21T03:10:34.920Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-17T18:15:49.328Z","updated_at":"2026-02-28T08:38:02.720Z","avatar_url":"https://github.com/salesforcecli.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# plugin-lightning-dev\n\n[![NPM](https://img.shields.io/npm/v/@salesforce/plugin-lightning-dev.svg?label=@salesforce/plugin-lightning-dev)](https://www.npmjs.com/package/@salesforce/plugin-lightning-dev) [![Downloads/week](https://img.shields.io/npm/dw/@salesforce/plugin-lightning-dev.svg)](https://npmjs.org/package/@salesforce/plugin-lightning-dev) [![License](https://img.shields.io/badge/License-Apache--2.0-blue.svg)](https://opensource.org/license/apache-2-0)\n\nThis plugin is bundled with the [Salesforce CLI](https://developer.salesforce.com/tools/sfdxcli). For more information on the CLI, read the [getting started guide](https://developer.salesforce.com/docs/atlas.en-us.sfdx_setup.meta/sfdx_setup/sfdx_setup_intro.htm).\n\nWe always recommend using the latest version of these commands bundled with the CLI, however, you can install a specific version or tag if needed.\n\n## Install\n\n```bash\nsf plugins install @salesforce/plugin-lightning-dev@x.y.z\n```\n\nor\n\n```bash\nsf plugins install @salesforce/plugin-lightning-dev\n```\n\n## Issues\n\nPlease report any issues at https://github.com/salesforcecli/plugin-lightning-dev/issues\n\n## Contributing\n\n1. Please read our [Code of Conduct](CODE_OF_CONDUCT.md)\n2. Create a new issue before starting your project so that we can keep track of\n   what you are trying to add/fix. That way, we can also offer suggestions or\n   let you know if there is already an effort in progress.\n3. Fork this repository.\n4. [Build the plugin locally](#build)\n5. Create a _topic_ branch in your fork. Note, this step is recommended but technically not required if contributing using a fork.\n6. Edit the code in your fork.\n7. Write appropriate tests for your changes. Try to achieve at least 95% code coverage on any new code. No pull request will be accepted without unit tests.\n8. Sign CLA (see [CLA](#cla) below).\n9. Send us a pull request when you are done. We'll review your code, suggest any needed changes, and merge it in.\n\n### CLA\n\nExternal contributors will be required to sign a Contributor's License\nAgreement. You can do so by going to https://cla.salesforce.com/sign-cla.\n\n### Build\n\nTo build the plugin locally, make sure to have yarn installed and run the following commands:\n\n```bash\n# Clone the repository\ngit clone git@github.com:salesforcecli/plugin-lightning-dev\n\n# Install the dependencies and compile\nyarn \u0026\u0026 yarn build\n```\n\nTo use your plugin, run using the local `./bin/dev` or `./bin/dev.cmd` file.\n\n```bash\n# Run using local run file.\n./bin/dev hello world\n```\n\nThere should be no differences when running via the Salesforce CLI or using the local run file. However, it can be useful to link the plugin to do some additional testing or run your commands from anywhere on your machine.\n\n```bash\n# Link your plugin to the sf cli\nsf plugins link .\n# To verify the plugin is properly linked\nsf plugins\n```\n\n## LWR Sites Development Environment\n\nFollow these instructions if you want to setup a dev environment for the `sf lightning dev site` command.\n\n## Setup\n\n1. [Enable Local Development](https://developer.salesforce.com/docs/platform/lwc/guide/get-started-test-components.html#enable-local-dev)\n\n2. Deploy some source files to your org from your SFDX project\n\n```bash\nsf org login web --alias dev --instance-url ${orgfarmUrl}\n\n```\n\n3. Add those source files to an LWR site in the Experience Builder and Publish the site (basePath: '/')\n\n4. Follow the [Build the plugin locally](#build) instructions\n\n5. [optional] Linking / Debugging LWR Source\n\n```bash\n# build and link lwr source\ncd lwr\nyarn \u0026\u0026 yarn link-lwr\n\n# build and link plugin-lightning-dev source\ncd plugin-lightning-dev\nyarn \u0026\u0026 yarn build\nyarn link-lwr\n\n# SFDX Project\ncd sfdx-project\n\n# Login to your org\nsf org login web --alias dev --instance-url https://login.test1.pc-rnd.salesforce.com/ (orgfarm needs instance url)\n\n# run/debug the sf cli command (attach to the CLI from the LWR repo in VS Code)\nNODE_OPTIONS=\"--inspect-brk\" sf lightning dev site --target-org dev\n```\n\nNow you can Remote Attach to the CLI from the vscode debugger:\n\n- Use the \"Attach\" launch configuration\n- Run launch config from LWR repo if you want to debug LWR source\n- Run launch config from plugin-lightning-dev source if you want to debug the SFDX plugin source specifically\n\nIf this doesn't work for whatever reason, you can always alias the build output directly like so:\n\n```bash\nalias sfdev=\"/{pathToGitDir}/plugin-lightning-dev/bin/run.js\"\n# SFDX Project\nNODE_OPTIONS=\"--inspect-brk\" sfdev lightning dev site --target-org dev\n```\n\n6. Make changes to your c-namespace components and you should see the browser refresh with those changes!\n\n## Fixing Snapshots\n\n```bash\nnode --loader ts-node/esm --no-warnings=ExperimentalWarning ./bin/dev.js snapshot:compare\nnode --loader ts-node/esm --no-warnings=ExperimentalWarning ./bin/dev.js schema:compare\nyarn \u0026\u0026 yarn build\nyarn update-snapshots\n```\n\n## e2e Org configuration (for NUTs)\n\nIf a new org is required for NUTs tests, these are the steps to create and configure one.\n\n1. Create a new STM org in [Org Farm](https://orgfarm.salesforce.com/farms)\n2. [Enable DevHub for Scratch Org Creation](https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_setup_enable_devhub.htm)\n3. Enable the following org perm: CreateConnectedApps\n4. Increase the following org limits to 99: ProvScratchActiveLimit, ProvScratchDailyLimit, ScratchRequestActiveCount, ScratchRequestActiveLimit, ScratchRequestDailyLimit\n5. [Create a Connected App](https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_auth_connected_app.htm)\n6. Enable JWT authentication and [test it](https://developer.salesforce.com/docs/atlas.en-us.260.0.sfdx_cli_reference.meta/sfdx_cli_reference/cli_reference_org_commands_unified.htm#cli_reference_org_login_jwt_unified)\n7. Use the credentials as values for the respective NUTS environment variables.\n\n## Running NUTs (integration tests) locally\n\nNUTs (e2e integration tests) run the plugin against a real org and, for component-preview tests, a real browser (Playwright). To run them locally:\n\n1. **Environment variables**  \n   Copy `.env.template` to `.env` and set the values for your Dev Hub org and test setup:\n   - `TESTKIT_JWT_KEY` - ./server.key from JWT configuration\n   - `TESTKIT_JWT_CLIENT_ID` – Client id from JWT configuration\n   - `TESTKIT_HUB_USERNAME` - Dev Hub username\n   - `TESTKIT_HUB_INSTANCE` – Dev Hub login URL\n\n2. **Run all NUTs** (loads variables from `.env` via `dotenv/config`):\n\n   ```bash\n   yarn test:nuts:local\n   ```\n\n3. **Run a single NUT file** (e.g. one test file):\n\n   ```bash\n   yarn test:nut:local path/to/file.nut.ts\n   ```\n\n4. **Run with a visible browser** (headed mode) for debugging:\n\n   ```bash\n   HEADED=true yarn test:nuts:local\n   ```\n\n   or, for a single file:\n\n   ```bash\n   HEADED=true yarn test:nut:local path/to/file.nut.ts\n   ```\n\n## Commands\n\n\u003c!-- commands --\u003e\n\n- [`sf lightning dev app`](#sf-lightning-dev-app)\n- [`sf lightning dev component`](#sf-lightning-dev-component)\n- [`sf lightning dev site`](#sf-lightning-dev-site)\n\n## `sf lightning dev app`\n\nPreview a Lightning Experience app locally and in real-time, without deploying it.\n\n```\nUSAGE\n  $ sf lightning dev app -o \u003cvalue\u003e [--flags-dir \u003cvalue\u003e] [-n \u003cvalue\u003e] [-t desktop|ios|android] [-i \u003cvalue\u003e]\n    [--api-version \u003cvalue\u003e]\n\nFLAGS\n  -i, --device-id=\u003cvalue\u003e     ID of the mobile device to display the preview if device type is set to `ios` or\n                              `android`. The default value is the ID of the first available mobile device.\n  -n, --name=\u003cvalue\u003e          Name of the Lightning Experience app to preview.\n  -o, --target-org=\u003cvalue\u003e    (required) Username or alias of the target org. Not required if the `target-org`\n                              configuration variable is already set.\n  -t, --device-type=\u003coption\u003e  Type of device to display the app preview.\n                              \u003coptions: desktop|ios|android\u003e\n      --api-version=\u003cvalue\u003e   Override the api version used for api requests made by this command\n\nGLOBAL FLAGS\n  --flags-dir=\u003cvalue\u003e  Import flag values from a directory.\n\nDESCRIPTION\n  Preview a Lightning Experience app locally and in real-time, without deploying it.\n\n  Use Local Dev (Beta) to see local changes to your app in a real-time preview that you don't have to deploy or manually\n  refresh. To let you quickly iterate on your Lightning web components (LWCs) and pages, your app preview automatically\n  refreshes when Local Dev detects source code changes.\n\n  When you edit these local files with Local Dev enabled, your org automatically reflects these changes.\n\n  - Basic HTML and CSS edits to LWCs\n  - JavaScript changes to LWCs that don't affect the component's public API\n  - Importing new custom LWCs\n  - Importing another instance of an existing LWC\n\n  To apply any other local changes not listed above, you must deploy them to your org using the `sf project deploy\n  start` command.\n\n  When you make changes directly in your org (like saving new component properties), they're automatically deployed to\n  your live app. To update your local version of the app with those changes, you must retrieve them from your org using\n  the `sf project retrieve start` command.\n\n  To learn more about Local Dev enablement, considerations, and limitations, see the Lightning Web Components Developer\n  Guide.\n\nEXAMPLES\n  Preview the default app for the target org \"myOrg\" in a desktop environment:\n\n    $ sf lightning dev app --target-org myOrg\n\n  Preview the app \"myApp\" for the target org \"myOrg\" in a desktop environment:\n\n    $ sf lightning dev app --name MyApp --target-org myOrg --device-type desktop\n\n  Preview the default app for target org \"myOrg\" on an iOS device:\n\n    $ sf lightning dev app --target-org myOrg --device-type ios --device-id \"iPhone 15 Pro Max\"\n```\n\n_See code: [src/commands/lightning/dev/app.ts](https://github.com/salesforcecli/plugin-lightning-dev/blob/6.2.15/src/commands/lightning/dev/app.ts)_\n\n## `sf lightning dev component`\n\n[Beta] Preview LWC components in isolation.\n\n```\nUSAGE\n  $ sf lightning dev component -o \u003cvalue\u003e [--json] [--flags-dir \u003cvalue\u003e] [-n \u003cvalue\u003e] [--api-version \u003cvalue\u003e] [-c]\n\nFLAGS\n  -c, --client-select        Launch component preview without selecting a component\n  -n, --name=\u003cvalue\u003e         Name of a component to preview.\n  -o, --target-org=\u003cvalue\u003e   (required) Username or alias of the target org. Not required if the `target-org`\n                             configuration variable is already set.\n      --api-version=\u003cvalue\u003e  Override the api version used for api requests made by this command\n\nGLOBAL FLAGS\n  --flags-dir=\u003cvalue\u003e  Import flag values from a directory.\n  --json               Format output as json.\n\nDESCRIPTION\n  [Beta] Preview LWC components in isolation.\n\n  Component preview launches an isolated development environment for Lightning Web Components, enabling rapid iteration\n  without needing to deploy changes. The server provides real-time previews of your components through hot module\n  replacement (HMR), automatically refreshing the view when source files are modified.\n\n  When running the development server, these changes are immediately reflected:\n\n  - Component template (HTML) modifications\n  - Styling updates in component CSS files\n  - JavaScript logic changes that don't modify the component's API\n  - Adding or updating internal component dependencies\n  - Modifying static resources used by the component\n\n  See the LWC Development Guide for more information about component development best practices and limitations.\n\nEXAMPLES\n  Select a component and launch the component preview:\n\n    $ sf lightning dev component\n\n  Launch component preview for \"myComponent\":\n\n    $ sf lightning dev component --name myComponent\n```\n\n_See code: [src/commands/lightning/dev/component.ts](https://github.com/salesforcecli/plugin-lightning-dev/blob/6.2.15/src/commands/lightning/dev/component.ts)_\n\n## `sf lightning dev site`\n\n[Beta] Preview an Experience Builder site locally and in real-time, without deploying it.\n\n```\nUSAGE\n  $ sf lightning dev site -o \u003cvalue\u003e [--flags-dir \u003cvalue\u003e] [-n \u003cvalue\u003e] [--api-version \u003cvalue\u003e]\n\nFLAGS\n  -n, --name=\u003cvalue\u003e         Name of the Experience Builder site to preview. It has to match a site name from the\n                             current org.\n  -o, --target-org=\u003cvalue\u003e   (required) Username or alias of the target org. Not required if the `target-org`\n                             configuration variable is already set.\n      --api-version=\u003cvalue\u003e  Override the api version used for api requests made by this command\n\nGLOBAL FLAGS\n  --flags-dir=\u003cvalue\u003e  Import flag values from a directory.\n\nDESCRIPTION\n  [Beta] Preview an Experience Builder site locally and in real-time, without deploying it.\n\n  Enable Local Dev to see local changes to your site in a real-time preview that you don't have to deploy or manually\n  refresh. To let you quickly iterate on your Lightning web components (LWCs) and pages, your site preview automatically\n  refreshes when Local Dev detects source code changes.\n\n  When you edit these local files with Local Dev enabled, your org automatically reflects these changes.\n\n  - Basic HTML and CSS edits to LWCs\n  - JavaScript changes to LWCs that don't affect the component's public API\n  - Importing new custom LWCs\n  - Importing another instance of an existing LWC\n\n  To apply any other local changes not listed above, you must deploy them to your org using the `sf project deploy\n  start` command. Then republish your site and restart the server for the Local Dev experience.\n\n  For more considerations and limitations, see the Lightning Web Components Developer Guide.\n\nEXAMPLES\n  Select a site to preview from the org \"myOrg\":\n\n    $ sf lightning dev site --target-org myOrg\n\n  Preview the site \"Partner Central\" from the org \"myOrg\":\n\n    $ sf lightning dev site --name \"Partner Central\" --target-org myOrg\n```\n\n_See code: [src/commands/lightning/dev/site.ts](https://github.com/salesforcecli/plugin-lightning-dev/blob/6.2.15/src/commands/lightning/dev/site.ts)_\n\n\u003c!-- commandsstop --\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsalesforcecli%2Fplugin-lightning-dev","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsalesforcecli%2Fplugin-lightning-dev","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsalesforcecli%2Fplugin-lightning-dev/lists"}