Skip to content

Commit bca47ba

Browse files
sf webapp dev command @W-20242483@ (#6)
1 parent 2964c13 commit bca47ba

38 files changed

Lines changed: 10748 additions & 3369 deletions

COMMANDS.md

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
<!-- commands -->
44

55
- [`sf webapp dev`](#sf-webapp-dev)
6-
- [`sf webapp generate`](#sf-webapp-generate)
76

87
## `sf webapp dev`
98

@@ -42,42 +41,4 @@ EXAMPLES
4241
$ sf webapp dev --name myWebApp --port 8080
4342
```
4443

45-
## `sf webapp generate`
46-
47-
Create a web app and associated metadata.
48-
49-
```
50-
USAGE
51-
$ sf webapp generate -n <value> -l <value> [--json] [--flags-dir <value>] [-t <value>] [-w]
52-
53-
FLAGS
54-
-l, --label=<value> (required) Human readable name of your web app
55-
-n, --name=<value> (required) Name of your web app
56-
-t, --template=<value> [default: empty] Template to use for web app generation (pulls from central solution)
57-
-w, --wizard Run in interactive wizard mode
58-
59-
GLOBAL FLAGS
60-
--flags-dir=<value> Import flag values from a directory.
61-
--json Format output as json.
62-
63-
DESCRIPTION
64-
Create a web app and associated metadata.
65-
66-
This command creates a new web app with the specified configuration, including the basic structure and metadata
67-
files.
68-
69-
EXAMPLES
70-
Create an empty web app:
71-
72-
$ sf webapp generate --name "myWebApp" --label "My first Web App"
73-
74-
Create a web app with a specific template:
75-
76-
$ sf webapp generate --name "myWebApp" --label "My Web App" --template "React app starter"
77-
78-
Create a web app using the wizard:
79-
80-
$ sf webapp generate --name "myWebApp" --label "My Web App" --wizard
81-
```
82-
8344
<!-- commandsstop -->

LICENSE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Apache License Version 2.0
22

3-
Copyright (c) 2025 Salesforce, Inc.
3+
Copyright (c) 2026 Salesforce, Inc.
44
All rights reserved.
55

66
Apache License

README.md

Lines changed: 101 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,69 @@ Additionally, there are some additional tests that the Salesforce CLI will enfor
4040
- [@salesforce/dev-config](https://github.com/forcedotcom/dev-config)
4141
- [@salesforce/dev-scripts](https://github.com/forcedotcom/dev-scripts)
4242

43-
# Everything past here is only a suggestion as to what should be in your specific plugin's description
43+
# Salesforce CLI Webapp Plugin
44+
45+
A Salesforce CLI plugin for building and deploying web applications that integrate with Salesforce. This plugin provides tools for local development, packaging, and deployment of webapps with built-in Salesforce authentication.
4446

4547
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).
4648

4749
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.
4850

51+
## Features
52+
53+
- 🔐 **Local Development Proxy** - Run webapps locally with automatic Salesforce authentication
54+
- 🌐 **Intelligent Request Routing** - Automatically routes requests between Salesforce APIs and dev servers
55+
- 🔄 **Dev Server Management** - Spawns and monitors dev servers (Vite, CRA, Next.js)
56+
- 🎨 **Beautiful Error Handling** - HTML error pages with auto-refresh and diagnostics
57+
- 💚 **Health Monitoring** - Periodic health checks with status updates
58+
- 🔧 **Hot Config Reload** - Detects `webapp.json` changes automatically
59+
60+
## Quick Start
61+
62+
1. **Install the plugin:**
63+
64+
```bash
65+
sf plugins install @salesforce/plugin-webapp
66+
```
67+
68+
2. **Authenticate with Salesforce:**
69+
70+
```bash
71+
sf org login web --alias myorg
72+
```
73+
74+
3. **Create webapp.json:**
75+
76+
```json
77+
{
78+
"name": "myapp",
79+
"label": "My Web App",
80+
"version": "1.0.0",
81+
"apiVersion": "60.0",
82+
"outputDir": "dist",
83+
"dev": {
84+
"command": "npm run dev"
85+
}
86+
}
87+
```
88+
89+
4. **Start development:**
90+
```bash
91+
sf webapp dev --name myapp --target-org myorg --open
92+
```
93+
94+
## Documentation
95+
96+
📚 **[Complete Guide](SF_WEBAPP_DEV_GUIDE.md)** - Comprehensive documentation covering:
97+
- Overview and architecture
98+
- Getting started (5-minute quick start)
99+
- Building the plugin
100+
- Command usage and options
101+
- File structure and components
102+
- VSCode integration
103+
- Advanced features (hot reload, error capture, etc.)
104+
- Troubleshooting and FAQ
105+
49106
## Install
50107

51108
```bash
@@ -105,45 +162,65 @@ sf plugins
105162

106163
## Commands
107164

108-
<!-- commands -->
165+
### `sf webapp dev`
109166

110-
- [`sf hello world`](#sf-hello-world)
167+
Start a local development proxy server for webapp development with Salesforce authentication.
111168

112-
## `sf hello world`
113-
114-
Say hello.
115-
116-
```
169+
```bash
117170
USAGE
118-
$ sf hello world [--json] [--flags-dir <value>] [-n <value>]
171+
$ sf webapp dev --name <webapp-name> --target-org <org-alias> [options]
172+
173+
REQUIRED FLAGS
174+
-n, --name=<value> Name of the webapp (must match webapp.json)
175+
-o, --target-org=<value> Salesforce org to authenticate against
119176

120-
FLAGS
121-
-n, --name=<value> [default: World] The name of the person you'd like to say hello to.
177+
OPTIONAL FLAGS
178+
-u, --url=<value> Dev server URL (overrides webapp.json)
179+
-p, --port=<value> Proxy server port (default: 4545)
180+
--open Open browser automatically
122181

123182
GLOBAL FLAGS
124-
--flags-dir=<value> Import flag values from a directory.
125-
--json Format output as json.
183+
--flags-dir=<value> Import flag values from a directory
184+
--json Format output as json
126185

127186
DESCRIPTION
128-
Say hello.
187+
Start a local development proxy server for webapp development.
129188

130-
Say hello either to the world or someone you know.
189+
This command starts a local HTTP proxy server that handles Salesforce
190+
authentication and routes requests between your local dev server and
191+
Salesforce APIs. It automatically spawns and monitors your dev server,
192+
detects the URL, and provides health monitoring.
131193

132194
EXAMPLES
133-
Say hello to the world:
195+
Start proxy with automatic dev server management:
134196

135-
$ sf hello world
197+
$ sf webapp dev --name myapp --target-org myorg --open
136198

137-
Say hello to someone you know:
199+
Use existing dev server:
138200

139-
$ sf hello world --name Astro
201+
$ sf webapp dev --name myapp --target-org myorg --url http://localhost:5173 --open
140202

141-
FLAG DESCRIPTIONS
142-
-n, --name=<value> The name of the person you'd like to say hello to.
203+
Use custom proxy port:
143204

144-
This person can be anyone in the world!
145-
```
205+
$ sf webapp dev --name myapp --target-org myorg --port 8080 --open
146206

147-
_See code: [src/commands/hello/world.ts](https://github.com/salesforcecli/plugin-webapp/blob/1.1.73/src/commands/hello/world.ts)_
207+
SUPPORTED DEV SERVERS
208+
- Vite
209+
- Create React App (Webpack)
210+
- Next.js
211+
- Any server that outputs http://localhost:PORT
212+
213+
FEATURES
214+
- Automatic Salesforce authentication injection
215+
- Intelligent request routing (Salesforce vs dev server)
216+
- WebSocket support for Hot Module Replacement (HMR)
217+
- Beautiful HTML error pages with auto-refresh
218+
- Periodic health monitoring (every 5s)
219+
- Configuration file watching (webapp.json)
220+
- Graceful shutdown on Ctrl+C
221+
222+
SEE ALSO
223+
- Complete Guide: SF_WEBAPP_DEV_GUIDE.md
224+
```
148225

149226
<!-- commandsstop -->

0 commit comments

Comments
 (0)