@salesforce/webapp-template-cli-experimental 1.62.2 → 1.63.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -21
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -19,14 +19,14 @@ npm run build --workspace=@salesforce/webapp-template-cli-experimental
|
|
|
19
19
|
npm run apply-patches -- <feature-path> <app-path> <target-dir>
|
|
20
20
|
|
|
21
21
|
# Examples:
|
|
22
|
-
# Apply
|
|
23
|
-
npm run apply-patches -- packages/template/feature/feature-react-
|
|
22
|
+
# Apply a feature (e.g. chart) to my-app (using base-react-app as reference)
|
|
23
|
+
npm run apply-patches -- packages/template/feature/feature-react-chart packages/template/base-app/base-react-app my-app
|
|
24
24
|
|
|
25
25
|
# Skip dependency installation
|
|
26
|
-
npm run apply-patches -- packages/template/feature/feature-react-
|
|
26
|
+
npm run apply-patches -- packages/template/feature/feature-react-chart packages/template/base-app/base-react-app my-app --skip-dependency-changes
|
|
27
27
|
|
|
28
28
|
# Reset target directory to base app state before applying (preserves node_modules)
|
|
29
|
-
npm run apply-patches -- packages/template/feature/feature-react-
|
|
29
|
+
npm run apply-patches -- packages/template/feature/feature-react-chart packages/template/base-app/base-react-app my-app --reset
|
|
30
30
|
```
|
|
31
31
|
|
|
32
32
|
### Direct usage
|
|
@@ -141,9 +141,9 @@ The CLI tool:
|
|
|
141
141
|
### Example: Apply feature patches to create a new app
|
|
142
142
|
|
|
143
143
|
```bash
|
|
144
|
-
$ npm run apply-patches -- packages/template/feature/feature-react-
|
|
144
|
+
$ npm run apply-patches -- packages/template/feature/feature-react-chart packages/template/base-app/base-react-app my-app
|
|
145
145
|
|
|
146
|
-
Applying patches: packages/template/feature/feature-react-
|
|
146
|
+
Applying patches: packages/template/feature/feature-react-chart → my-app
|
|
147
147
|
ℹ Validating paths...
|
|
148
148
|
✓ Validation passed
|
|
149
149
|
ℹ Creating target directory my-app...
|
|
@@ -153,13 +153,12 @@ Resolving Dependencies
|
|
|
153
153
|
ℹ No dependencies to resolve
|
|
154
154
|
|
|
155
155
|
|
|
156
|
-
Applying: packages/template/feature/feature-react-
|
|
156
|
+
Applying: packages/template/feature/feature-react-chart
|
|
157
157
|
ℹ Discovering files...
|
|
158
158
|
ℹ Found 14 file(s)
|
|
159
159
|
ℹ Validating paths...
|
|
160
160
|
✓ Paths validated
|
|
161
|
-
✓ Added webapplications/feature-react-
|
|
162
|
-
✓ Added webapplications/feature-react-shadcn/src/components/ui/card.tsx
|
|
161
|
+
✓ Added webapplications/feature-react-chart/src/...
|
|
163
162
|
...
|
|
164
163
|
|
|
165
164
|
Installing dependencies
|
|
@@ -248,7 +247,7 @@ import type { Feature } from "../cli/src/types.js";
|
|
|
248
247
|
const feature: Feature = {
|
|
249
248
|
// This feature depends on shadcn UI feature
|
|
250
249
|
// shadcn will be applied first, then this feature
|
|
251
|
-
dependencies: ["packages/template/feature/feature-react-
|
|
250
|
+
dependencies: ["packages/template/feature/feature-react-chart"],
|
|
252
251
|
packageJson: {
|
|
253
252
|
dependencies: {
|
|
254
253
|
"some-package": "^1.0.0",
|
|
@@ -281,7 +280,7 @@ export default feature;
|
|
|
281
280
|
**Notes:**
|
|
282
281
|
|
|
283
282
|
- `templateDir`: All files in this directory will be discovered and applied to the target app
|
|
284
|
-
- `webAppName`: Used to construct the default route path and organize files. Defaults to the feature directory name (e.g., `feature-react-
|
|
283
|
+
- `webAppName`: Used to construct the default route path and organize files. Defaults to the feature directory name (e.g., `feature-react-chart` → `feature-react-chart`)
|
|
285
284
|
- `routeFilePath`: Must be a path relative to `templateDir`. If not specified, defaults to `webapplications/<webAppName>/src/routes.tsx`
|
|
286
285
|
|
|
287
286
|
## Path Mappings
|
|
@@ -290,10 +289,10 @@ Path mappings allow features to use simplified directory structures that are aut
|
|
|
290
289
|
|
|
291
290
|
### Default Behavior (Enabled by Default)
|
|
292
291
|
|
|
293
|
-
By default, all features automatically get the `webApp` mapping, which transforms web application files into the proper nested structure. For example, in `feature-react-
|
|
292
|
+
By default, all features automatically get the `webApp` mapping, which transforms web application files into the proper nested structure. For example, in `feature-react-chart`:
|
|
294
293
|
|
|
295
294
|
```
|
|
296
|
-
template/webApp/src/app.tsx → dist/webapplications/feature-react-
|
|
295
|
+
template/webApp/src/app.tsx → dist/webapplications/feature-react-chart/src/app.tsx
|
|
297
296
|
```
|
|
298
297
|
|
|
299
298
|
This simplifies feature templates by removing the repetitive nested directory structure.
|
|
@@ -301,10 +300,10 @@ This simplifies feature templates by removing the repetitive nested directory st
|
|
|
301
300
|
**Important**: Only files under `webApp/` get the nested structure. SFDX metadata types (like `classes/`, `triggers/`, `objects/`, `lwc/`, etc.) are placed at root level:
|
|
302
301
|
|
|
303
302
|
```
|
|
304
|
-
feature-react-
|
|
303
|
+
feature-react-chart/template/
|
|
305
304
|
├── webApp/
|
|
306
305
|
│ └── src/
|
|
307
|
-
│ └── app.tsx → dist/webapplications/feature-react-
|
|
306
|
+
│ └── app.tsx → dist/webapplications/feature-react-chart/src/app.tsx
|
|
308
307
|
└── classes/
|
|
309
308
|
└── MyClass.cls → dist/classes/MyClass.cls (root level)
|
|
310
309
|
```
|
|
@@ -506,7 +505,7 @@ The CLI builds a complete dependency graph and applies features in topological o
|
|
|
506
505
|
### Example: Building on Shared UI Features
|
|
507
506
|
|
|
508
507
|
```typescript
|
|
509
|
-
// packages/template/feature/feature-react-
|
|
508
|
+
// packages/template/feature/feature-react-chart/feature.ts
|
|
510
509
|
import type { Feature } from "../../../cli/src/types.js";
|
|
511
510
|
|
|
512
511
|
const feature: Feature = {
|
|
@@ -522,7 +521,7 @@ import type { Feature } from "../../../cli/src/types.js";
|
|
|
522
521
|
|
|
523
522
|
const feature: Feature = {
|
|
524
523
|
// Admin dashboard builds on top of shadcn UI
|
|
525
|
-
dependencies: ["packages/template/feature/feature-react-
|
|
524
|
+
dependencies: ["packages/template/feature/feature-react-chart"],
|
|
526
525
|
};
|
|
527
526
|
|
|
528
527
|
export default feature;
|
|
@@ -530,8 +529,8 @@ export default feature;
|
|
|
530
529
|
|
|
531
530
|
When you apply `feature-admin-dashboard`:
|
|
532
531
|
|
|
533
|
-
1. CLI resolves `feature-react-
|
|
534
|
-
2. Applies `feature-react-
|
|
532
|
+
1. CLI resolves `feature-react-chart` as a dependency
|
|
533
|
+
2. Applies `feature-react-chart` first
|
|
535
534
|
3. Applies `feature-admin-dashboard` second (dashboard files and routes)
|
|
536
535
|
4. Result: App has both shared UI and admin dashboard
|
|
537
536
|
|
|
@@ -574,7 +573,7 @@ When multiple features modify the same file:
|
|
|
574
573
|
Example:
|
|
575
574
|
|
|
576
575
|
```
|
|
577
|
-
|
|
576
|
+
Features can provide e.g. src/appLayout.tsx
|
|
578
577
|
feature-custom-app also provides: src/appLayout.tsx
|
|
579
578
|
|
|
580
579
|
When applying feature-custom-app:
|
|
@@ -635,7 +634,7 @@ Routes accumulate across all features, preserving routes from base app and all d
|
|
|
635
634
|
|
|
636
635
|
Dependency paths can be:
|
|
637
636
|
|
|
638
|
-
- **Relative to monorepo root**: `'packages/template/feature/feature-react-
|
|
637
|
+
- **Relative to monorepo root**: `'packages/template/feature/feature-react-chart'`
|
|
639
638
|
- **Absolute paths**: `'/absolute/path/to/feature'`
|
|
640
639
|
|
|
641
640
|
The CLI normalizes and resolves all paths consistently.
|
package/package.json
CHANGED