Skip to content

Commit d775b5d

Browse files
committed
chore: readme updates
1 parent 3230d17 commit d775b5d

File tree

1 file changed

+72
-41
lines changed

1 file changed

+72
-41
lines changed

README.md

Lines changed: 72 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -2,47 +2,6 @@
22

33
[![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-BSD%203--Clause-brightgreen.svg)](https://raw.githubusercontent.com/salesforcecli/plugin-lightning-dev/main/LICENSE.txt)
44

5-
## Setup
6-
7-
Prereqs:
8-
9-
1. Setup an Experience Site and publish it
10-
11-
2. Run the following:
12-
13-
```bash
14-
yarn && yarn build
15-
yarn link-lwr
16-
sf org login web --instance-url ${orgfarmUrl}
17-
```
18-
19-
## Run the command
20-
21-
Then run the following for your environment:
22-
23-
```bash
24-
./bin/dev.js lightning dev site
25-
```
26-
27-
or for debugging:
28-
29-
```bash
30-
NODE_OPTIONS='--inspect-brk' ./bin/dev.js lightning dev site
31-
```
32-
33-
No need to recompile or watch typescript files as this happens automagically.
34-
35-
## Fix Snapshots
36-
37-
```bash
38-
node --loader ts-node/esm --no-warnings=ExperimentalWarning ./bin/dev.js snapshot:compare
39-
node --loader ts-node/esm --no-warnings=ExperimentalWarning ./bin/dev.js schema:compare
40-
yarn && yarn build
41-
yarn update-snapshots
42-
```
43-
44-
## TODO Update
45-
465
This 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).
476

487
We always recommend using the latest version of these commands bundled with the CLI, however, you can install a specific version or tag if needed.
@@ -53,6 +12,12 @@ We always recommend using the latest version of these commands bundled with the
5312
sf plugins install @salesforce/plugin-lightning-dev@x.y.z
5413
```
5514

15+
or
16+
17+
```bash
18+
sf plugins install @salesforce/plugin-lightning-dev
19+
```
20+
5621
## Issues
5722

5823
Please report any issues at https://github.com/forcedotcom/cli/issues
@@ -104,6 +69,72 @@ sf plugins link .
10469
sf plugins
10570
```
10671

72+
## LWR Sites Development Environment
73+
74+
Follow these instructions if you want to setup a dev environment for the `sf lightning dev site` command.
75+
76+
## Setup
77+
78+
1. [Enable Local Development] (https://developer.salesforce.com/docs/platform/lwc/guide/get-started-test-components.html#enable-local-dev)
79+
80+
2. Deploy some source files to your org from your SFDX project
81+
82+
```bash
83+
sf org login web --alias dev --instance-url ${orgfarmUrl}
84+
85+
```
86+
87+
3. Add those source files to an LWR site in the Experience Builder and Publish the site (basePath: '/')
88+
89+
4. Follow the [Build the plugin locally](#build) instructions
90+
91+
5. [optional] Linking / Debugging LWR Source
92+
93+
```bash
94+
# build and link lwr source
95+
cd lwr
96+
yarn && yarn link-lwr
97+
98+
# build and link plugin-lightning-dev source
99+
cd plugin-lightning-dev
100+
yarn && yarn build
101+
yarn link-lwr
102+
103+
# SFDX Project
104+
cd sfdx-project
105+
106+
# Login to your org
107+
sf org login web --alias dev --instance-url https://login.test1.pc-rnd.salesforce.com/ (orgfarm needs instance url)
108+
109+
# run/debug the sf cli command (attach to the CLI from the LWR repo in VS Code)
110+
NODE_OPTIONS="--inspect-brk" sf lightning dev site --target-org dev
111+
```
112+
113+
Now you can Remote Attach to the CLI from the vscode debugger:
114+
115+
- Use the "Attach" launch configuration
116+
- Run launch config from LWR repo if you want to debug LWR source
117+
- Run launch config from plugin-lightning-dev source if you want to debug the SFDX plugin source specifically
118+
119+
If this doesn't work for whatever reason, you can always alias the build output directly like so:
120+
121+
```bash
122+
alias sfdev="/{pathToGitDir}/plugin-lightning-dev/bin/run.js"
123+
# SFDX Project
124+
NODE_OPTIONS="--inspect-brk" sfdev lightning dev site --target-org dev
125+
```
126+
127+
6. Make changes to your c-namespace components and you should see the browser refresh with those changes!
128+
129+
## Fixing Snapshots
130+
131+
```bash
132+
node --loader ts-node/esm --no-warnings=ExperimentalWarning ./bin/dev.js snapshot:compare
133+
node --loader ts-node/esm --no-warnings=ExperimentalWarning ./bin/dev.js schema:compare
134+
yarn && yarn build
135+
yarn update-snapshots
136+
```
137+
107138
## Commands
108139

109140
<!-- commands -->

0 commit comments

Comments
 (0)