You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: make webapplication.json optional for sf webapp dev command (#16)
This change makes the webapplication.json manifest file optional when running
the `sf webapp dev` command. Webapps are now discovered by folder structure
within the `webapplications/` directory.
Key changes:
- Webapp discovery now uses folder-based detection within webapplications/ folder
- If webapplication.json exists, use manifest values; otherwise use defaults
- Default dev command changed from 'npm run build' to 'npm run dev'
- Auto-select webapp when running from inside a webapp folder
- ManifestWatcher only enabled when webapplication.json is present
- Improved error messages for missing dependencies (command not found)
Code cleanup:
- Remove unused ErrorHandler factory methods and inline single-use utilities
- Remove dead code from ProxyServer (unused stats tracking)
- Remove unused exported functions from webappDiscovery
Testing & docs:
- Add comprehensive unit tests for webappDiscovery (39 tests)
- Update developer guide for optional manifest feature
@@ -10,7 +10,9 @@ The `sf webapp dev` command enables local development of modern web applications
10
10
11
11
### Key Features
12
12
13
-
-**Auto-Discovery**: Automatically finds `webapplication.json` files in your project
13
+
-**Auto-Discovery**: Automatically finds webapps in `webapplications/` folder
14
+
-**Optional Manifest**: `webapplication.json` is optional - uses sensible defaults
15
+
-**Auto-Selection**: Automatically selects webapp when running from inside its folder
14
16
-**Interactive Selection**: Prompts with arrow-key navigation when multiple webapps exist
15
17
-**Authentication Injection**: Automatically adds Salesforce auth headers to API calls
16
18
-**Intelligent Routing**: Routes requests to dev server or Salesforce based on URL patterns
@@ -22,18 +24,15 @@ The `sf webapp dev` command enables local development of modern web applications
22
24
23
25
## Quick Start
24
26
25
-
### 1. Create `webapplication.json`in your project
27
+
### 1. Create your webapp in the `webapplications/` folder
26
28
27
-
```json
28
-
{
29
-
"name": "myApp",
30
-
"label": "My Application",
31
-
"version": "1.0.0",
32
-
"outputDir": "dist",
33
-
"dev": {
34
-
"command": "npm run dev"
35
-
}
36
-
}
29
+
```
30
+
my-project/
31
+
└── webapplications/
32
+
└── my-app/ # Your webapp folder
33
+
├── package.json
34
+
├── src/
35
+
└── webapplication.json # Optional!
37
36
```
38
37
39
38
### 2. Run the command
@@ -46,6 +45,12 @@ sf webapp dev --target-org myOrg --open
46
45
47
46
Browser opens to `http://localhost:4545` with your app running and Salesforce authentication ready.
48
47
48
+
> **Note**: `webapplication.json` is optional! If not present, the command uses:
49
+
>
50
+
> -**Name**: Folder name (e.g., "my-app")
51
+
> -**Dev command**: `npm run dev`
52
+
> -**Manifest watching**: Disabled
53
+
49
54
---
50
55
51
56
## Command Syntax
@@ -90,62 +95,96 @@ SF_LOG_LEVEL=debug sf webapp dev --target-org myOrg
90
95
91
96
## Webapp Discovery
92
97
93
-
The command automatically discovers `webapplication.json` files in your project, making the `--name` flag optional in most cases.
98
+
The command automatically discovers webapps in the `webapplications/` folder. Each subfolder is treated as a webapp, with `webapplication.json` being optional.
0 commit comments