Skip to content

Commit 3006cc1

Browse files
nrkruksvc-cli-bot
andauthored
feat: remove unused command flags / update readme (#143)
* chore: readme updates * chore(release): 1.0.26-alpha.0 [skip ci] * chore: cleanup command arguments * chore: update snapshots * chore: remove --json flag * chore: update text * feat: re-enable CI publish * chore(release): 1.0.26-alpha.1 [skip ci] * chore: readme updates --------- Co-authored-by: svc-cli-bot <[email protected]>
1 parent 69dd550 commit 3006cc1

File tree

10 files changed

+207
-130
lines changed

10 files changed

+207
-130
lines changed

.github/workflows/create-github-release.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
name: create-github-release
22

33
on:
4-
# push:
5-
# branches:
6-
# - main
7-
# - prerelease/**
8-
# tags-ignore:
9-
# - '*'
4+
push:
5+
branches:
6+
- main
7+
- prerelease/**
8+
tags-ignore:
9+
- '*'
1010
workflow_dispatch:
1111
inputs:
1212
prerelease:

PLUGIN_TEMPLATE.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
## Using the template
2+
3+
This repository provides a template for creating a plugin for the Salesforce CLI. To convert this template to a working plugin:
4+
5+
1. Please get in touch with the Platform CLI team. We want to help you develop your plugin.
6+
2. Generate your plugin:
7+
8+
```
9+
sf plugins install dev
10+
sf dev generate plugin
11+
12+
git init -b main
13+
git add . && git commit -m "chore: initial commit"
14+
```
15+
16+
3. Create your plugin's repo in the salesforcecli github org
17+
4. When you're ready, replace the contents of this README with the information you want.
18+
19+
## Learn about `sf` plugins
20+
21+
Salesforce CLI plugins are based on the [oclif plugin framework](https://oclif.io/docs/introduction). Read the [plugin developer guide](https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_plugins.meta/sfdx_cli_plugins/cli_plugins_architecture_sf_cli.htm) to learn about Salesforce CLI plugin development.
22+
23+
This repository contains a lot of additional scripts and tools to help with general Salesforce node development and enforce coding standards. You should familiarize yourself with some of the [node developer packages](#tooling) used by Salesforce. There is also a default circleci config using the [release management orb](https://github.com/forcedotcom/npm-release-management-orb) standards.
24+
25+
Additionally, there are some additional tests that the Salesforce CLI will enforce if this plugin is ever bundled with the CLI. These test are included by default under the `posttest` script and it is required to keep these tests active in your plugin if you plan to have it bundled.
26+
27+
### Tooling
28+
29+
- [@salesforce/core](https://github.com/forcedotcom/sfdx-core)
30+
- [@salesforce/kit](https://github.com/forcedotcom/kit)
31+
- [@salesforce/sf-plugins-core](https://github.com/salesforcecli/sf-plugins-core)
32+
- [@salesforce/ts-types](https://github.com/forcedotcom/ts-types)
33+
- [@salesforce/ts-sinon](https://github.com/forcedotcom/ts-sinon)
34+
- [@salesforce/dev-config](https://github.com/forcedotcom/dev-config)
35+
- [@salesforce/dev-scripts](https://github.com/forcedotcom/dev-scripts)
36+
37+
# Everything past here is only a suggestion as to what should be in your specific plugin's description

README.md

Lines changed: 157 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -1,86 +1,7 @@
1-
**NOTE: This template for sf plugins is not yet official. Please consult with the Platform CLI team before using this template.**
2-
31
# plugin-lightning-dev
42

53
[![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)
64

7-
## Setup
8-
9-
Prereqs:
10-
11-
1. Setup an Experience Site and publish it
12-
13-
2. Run the following:
14-
15-
```bash
16-
yarn && yarn build
17-
yarn link-lwr
18-
sf org login web --instance-url ${orgfarmUrl}
19-
```
20-
21-
## Run the command
22-
23-
Then run the following for your environment:
24-
25-
```bash
26-
./bin/dev.js lightning dev site
27-
```
28-
29-
or for debugging:
30-
31-
```bash
32-
NODE_OPTIONS='--inspect-brk' ./bin/dev.js lightning dev site
33-
```
34-
35-
No need to recompile or watch typescript files as this happens automagically.
36-
37-
## Fix Snapshots
38-
39-
```bash
40-
node --loader ts-node/esm --no-warnings=ExperimentalWarning ./bin/dev.js snapshot:compare
41-
node --loader ts-node/esm --no-warnings=ExperimentalWarning ./bin/dev.js schema:compare
42-
yarn && yarn build
43-
yarn update-snapshots
44-
```
45-
46-
## Using the template
47-
48-
This repository provides a template for creating a plugin for the Salesforce CLI. To convert this template to a working plugin:
49-
50-
1. Please get in touch with the Platform CLI team. We want to help you develop your plugin.
51-
2. Generate your plugin:
52-
53-
```
54-
sf plugins install dev
55-
sf dev generate plugin
56-
57-
git init -b main
58-
git add . && git commit -m "chore: initial commit"
59-
```
60-
61-
3. Create your plugin's repo in the salesforcecli github org
62-
4. When you're ready, replace the contents of this README with the information you want.
63-
64-
## Learn about `sf` plugins
65-
66-
Salesforce CLI plugins are based on the [oclif plugin framework](https://oclif.io/docs/introduction). Read the [plugin developer guide](https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_plugins.meta/sfdx_cli_plugins/cli_plugins_architecture_sf_cli.htm) to learn about Salesforce CLI plugin development.
67-
68-
This repository contains a lot of additional scripts and tools to help with general Salesforce node development and enforce coding standards. You should familiarize yourself with some of the [node developer packages](#tooling) used by Salesforce. There is also a default circleci config using the [release management orb](https://github.com/forcedotcom/npm-release-management-orb) standards.
69-
70-
Additionally, there are some additional tests that the Salesforce CLI will enforce if this plugin is ever bundled with the CLI. These test are included by default under the `posttest` script and it is required to keep these tests active in your plugin if you plan to have it bundled.
71-
72-
### Tooling
73-
74-
- [@salesforce/core](https://github.com/forcedotcom/sfdx-core)
75-
- [@salesforce/kit](https://github.com/forcedotcom/kit)
76-
- [@salesforce/sf-plugins-core](https://github.com/salesforcecli/sf-plugins-core)
77-
- [@salesforce/ts-types](https://github.com/forcedotcom/ts-types)
78-
- [@salesforce/ts-sinon](https://github.com/forcedotcom/ts-sinon)
79-
- [@salesforce/dev-config](https://github.com/forcedotcom/dev-config)
80-
- [@salesforce/dev-scripts](https://github.com/forcedotcom/dev-scripts)
81-
82-
# Everything past here is only a suggestion as to what should be in your specific plugin's description
83-
845
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).
856

867
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.
@@ -91,6 +12,12 @@ We always recommend using the latest version of these commands bundled with the
9112
sf plugins install @salesforce/[email protected]
9213
```
9314

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

9623
Please report any issues at https://github.com/forcedotcom/cli/issues
@@ -142,45 +69,181 @@ sf plugins link .
14269
sf plugins
14370
```
14471

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+
145138
## Commands
146139

147140
<!-- commands -->
148141

149-
- [`sf hello world`](#sf-hello-world)
142+
- [`sf lightning dev app`](#sf-lightning-dev-app)
143+
- [`sf lightning dev site`](#sf-lightning-dev-site)
150144

151-
## `sf hello world`
145+
## `sf lightning dev app`
152146

153-
Say hello.
147+
Preview a Lightning Experience app locally and in real-time, without deploying it.
154148

155149
```
156150
USAGE
157-
$ sf hello world [--json] [--flags-dir <value>] [-n <value>]
151+
$ sf lightning dev app -o <value> [--flags-dir <value>] [-n <value>] [-t desktop|ios|android] [-i <value>]
158152
159153
FLAGS
160-
-n, --name=<value> [default: World] The name of the person you'd like to say hello to.
154+
-i, --device-id=<value> ID of the mobile device to display the preview if device type is set to `ios` or
155+
`android`. The default value is the ID of the first available mobile device.
156+
-n, --name=<value> Name of the Lightning Experience app to preview.
157+
-o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
158+
configuration variable is already set.
159+
-t, --device-type=<option> [default: desktop] Type of device to display the app preview.
160+
<options: desktop|ios|android>
161161
162162
GLOBAL FLAGS
163163
--flags-dir=<value> Import flag values from a directory.
164-
--json Format output as JSON.
165164
166165
DESCRIPTION
167-
Say hello.
166+
Preview a Lightning Experience app locally and in real-time, without deploying it.
167+
168+
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
169+
refresh. To let you quickly iterate on your Lightning web components (LWCs) and pages, your app preview automatically
170+
refreshes when Local Dev detects source code changes.
168171
169-
Say hello either to the world or someone you know.
172+
When you edit these local files with Local Dev enabled, your org automatically reflects these changes.
173+
174+
- Basic HTML and CSS edits to LWCs
175+
- JavaScript changes to LWCs that don't affect the component's public API
176+
- Importing new custom LWCs
177+
- Importing another instance of an existing LWC
178+
179+
To apply any other local changes not listed above, you must deploy them to your org using the `sf project deploy
180+
start` command.
181+
182+
When you make changes directly in your org (like saving new component properties), they're automatically deployed to
183+
your live app. To update your local version of the app with those changes, you must retrieve them from your org using
184+
the `sf project retrieve start` command.
185+
186+
To learn more about Local Dev enablement, considerations, and limitations, see the Lightning Web Components Developer
187+
Guide.
170188
171189
EXAMPLES
172-
Say hello to the world:
190+
Preview the default app for the target org "myOrg" in a desktop environment:
191+
192+
$ sf lightning dev app --target-org myOrg
193+
194+
Preview the app "myApp" for the target org "myOrg" in a desktop environment:
195+
196+
$ sf lightning dev app --name MyApp --target-org myOrg --device-type desktop
173197
174-
$ sf hello world
198+
Preview the default app for target org "myOrg" on an iOS device:
175199
176-
Say hello to someone you know:
200+
$ sf lightning dev app --target-org myOrg --device-type ios --device-id "iPhone 15 Pro Max"
201+
```
202+
203+
_See code: [src/commands/lightning/dev/app.ts](https://github.com/salesforcecli/plugin-lightning-dev/blob/1.0.26-alpha.1/src/commands/lightning/dev/app.ts)_
177204

178-
$ sf hello world --name Astro
205+
## `sf lightning dev site`
179206

180-
FLAG DESCRIPTIONS
181-
-n, --name=<value> The name of the person you'd like to say hello to.
207+
Preview an Experience Builder site locally and in real-time, without deploying it.
182208

183-
This person can be anyone in the world!
184209
```
210+
USAGE
211+
$ sf lightning dev site -o <value> [--flags-dir <value>] [-n <value>]
212+
213+
FLAGS
214+
-n, --name=<value> Name of the Experience Builder site to preview. It has to match a site name from the current
215+
org.
216+
-o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
217+
configuration variable is already set.
218+
219+
GLOBAL FLAGS
220+
--flags-dir=<value> Import flag values from a directory.
221+
222+
DESCRIPTION
223+
Preview an Experience Builder site locally and in real-time, without deploying it.
224+
225+
Enable Local Dev to see local changes to your site in a real-time preview that you don't have to deploy or manually
226+
refresh. To let you quickly iterate on your Lightning web components (LWCs) and pages, your site preview automatically
227+
refreshes when Local Dev detects source code changes.
228+
229+
When you edit these local files with Local Dev enabled, your org automatically reflects these changes.
230+
231+
- Basic HTML and CSS edits to LWCs
232+
- JavaScript changes to LWCs that don't affect the component's public API
233+
- Importing new custom LWCs
234+
- Importing another instance of an existing LWC
235+
236+
To apply any other local changes not listed above, you must deploy them to your org using the `sf project deploy
237+
start` command. Then republish your site and restart the server for the Local Dev experience.
238+
239+
For more considerations and limitations, see the Lightning Web Components Developer Guide.
240+
241+
EXAMPLES
242+
Preview the site "Partner Central" from the org "myOrg":
243+
244+
$ sf lightning dev site --name "Partner Central" --target-org myOrg
245+
```
246+
247+
_See code: [src/commands/lightning/dev/site.ts](https://github.com/salesforcecli/plugin-lightning-dev/blob/1.0.26-alpha.1/src/commands/lightning/dev/site.ts)_
185248

186249
<!-- commandsstop -->

command-snapshot.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
"command": "lightning:dev:app",
55
"flagAliases": [],
66
"flagChars": ["i", "n", "o", "t"],
7-
"flags": ["device-id", "device-type", "flags-dir", "json", "name", "target-org"],
7+
"flags": ["device-id", "device-type", "flags-dir", "name", "target-org"],
88
"plugin": "@salesforce/plugin-lightning-dev"
99
},
1010
{
1111
"alias": [],
1212
"command": "lightning:dev:site",
1313
"flagAliases": [],
1414
"flagChars": ["n", "o"],
15-
"flags": ["debug", "flags-dir", "json", "name", "target-org"],
15+
"flags": ["flags-dir", "name", "target-org"],
1616
"plugin": "@salesforce/plugin-lightning-dev"
1717
}
1818
]

messages/lightning.dev.app.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@ To learn more about Local Dev enablement, considerations, and limitations, see t
2323

2424
Name of the Lightning Experience app to preview.
2525

26-
# flags.target-org.summary
27-
28-
Username or alias of the target org. Not required if the `target-org` configuration variable is already set.
29-
3026
# flags.device-type.summary
3127

3228
Type of device to display the app preview.

0 commit comments

Comments
 (0)