@salesforce/webapp-template-cli-experimental 1.43.0 → 1.44.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 +34 -37
- package/dist/nx-plugin/executors/build-dist-app/executor.d.ts +2 -1
- package/dist/nx-plugin/executors/build-dist-app/executor.d.ts.map +1 -1
- package/dist/nx-plugin/executors/build-dist-app/executor.js +14 -6
- package/dist/nx-plugin/executors/build-dist-app/executor.js.map +1 -1
- package/executors.json +1 -1
- package/package.json +2 -2
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/feature/feature-react-
|
|
22
|
+
# Apply shadcn UI patches to my-app (using base-react-app as reference)
|
|
23
|
+
npm run apply-patches -- packages/template/feature/feature-react-shadcn packages/template/base-app/base-react-app my-app
|
|
24
24
|
|
|
25
25
|
# Skip dependency installation
|
|
26
|
-
npm run apply-patches -- packages/feature/feature-react-
|
|
26
|
+
npm run apply-patches -- packages/template/feature/feature-react-shadcn 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/feature/feature-react-
|
|
29
|
+
npm run apply-patches -- packages/template/feature/feature-react-shadcn 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/feature/feature-react-
|
|
144
|
+
$ npm run apply-patches -- packages/template/feature/feature-react-shadcn packages/template/base-app/base-react-app my-app
|
|
145
145
|
|
|
146
|
-
Applying patches: packages/feature-react-
|
|
146
|
+
Applying patches: packages/template/feature/feature-react-shadcn → my-app
|
|
147
147
|
ℹ Validating paths...
|
|
148
148
|
✓ Validation passed
|
|
149
149
|
ℹ Creating target directory my-app...
|
|
@@ -153,17 +153,14 @@ Resolving Dependencies
|
|
|
153
153
|
ℹ No dependencies to resolve
|
|
154
154
|
|
|
155
155
|
|
|
156
|
-
Applying: packages/feature-react-
|
|
156
|
+
Applying: packages/template/feature/feature-react-shadcn
|
|
157
157
|
ℹ Discovering files...
|
|
158
|
-
ℹ Found
|
|
158
|
+
ℹ Found 14 file(s)
|
|
159
159
|
ℹ Validating paths...
|
|
160
160
|
✓ Paths validated
|
|
161
|
-
✓ Added webapplications/feature-react-
|
|
162
|
-
✓ Added webapplications/feature-react-
|
|
163
|
-
|
|
164
|
-
✓ Added webapplications/feature-react-nav-menu/src/router-utils.tsx
|
|
165
|
-
✓ Added webapplications/feature-react-nav-menu/src/about.tsx
|
|
166
|
-
✓ Added webapplications/feature-react-nav-menu/src/new.tsx
|
|
161
|
+
✓ Added webapplications/feature-react-shadcn/src/components/ui/button.tsx
|
|
162
|
+
✓ Added webapplications/feature-react-shadcn/src/components/ui/card.tsx
|
|
163
|
+
...
|
|
167
164
|
|
|
168
165
|
Installing dependencies
|
|
169
166
|
ℹ Installing dependencies...
|
|
@@ -249,9 +246,9 @@ export default feature;
|
|
|
249
246
|
import type { Feature } from "../cli/src/types.js";
|
|
250
247
|
|
|
251
248
|
const feature: Feature = {
|
|
252
|
-
// This feature depends on
|
|
253
|
-
//
|
|
254
|
-
dependencies: ["packages/feature/feature-react-
|
|
249
|
+
// This feature depends on shadcn UI feature
|
|
250
|
+
// shadcn will be applied first, then this feature
|
|
251
|
+
dependencies: ["packages/template/feature/feature-react-shadcn"],
|
|
255
252
|
packageJson: {
|
|
256
253
|
dependencies: {
|
|
257
254
|
"some-package": "^1.0.0",
|
|
@@ -284,7 +281,7 @@ export default feature;
|
|
|
284
281
|
**Notes:**
|
|
285
282
|
|
|
286
283
|
- `templateDir`: All files in this directory will be discovered and applied to the target app
|
|
287
|
-
- `webAppName`: Used to construct the default route path and organize files. Defaults to the feature directory name (e.g., `feature-react-
|
|
284
|
+
- `webAppName`: Used to construct the default route path and organize files. Defaults to the feature directory name (e.g., `feature-react-shadcn` → `feature-react-shadcn`)
|
|
288
285
|
- `routeFilePath`: Must be a path relative to `templateDir`. If not specified, defaults to `webapplications/<webAppName>/src/routes.tsx`
|
|
289
286
|
|
|
290
287
|
## Path Mappings
|
|
@@ -293,10 +290,10 @@ Path mappings allow features to use simplified directory structures that are aut
|
|
|
293
290
|
|
|
294
291
|
### Default Behavior (Enabled by Default)
|
|
295
292
|
|
|
296
|
-
By default, all features automatically get the `webApp` mapping, which transforms web application files into the proper nested structure. For example, in `feature-react-
|
|
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-shadcn`:
|
|
297
294
|
|
|
298
295
|
```
|
|
299
|
-
template/webApp/src/app.tsx → dist/webapplications/feature-react-
|
|
296
|
+
template/webApp/src/app.tsx → dist/webapplications/feature-react-shadcn/src/app.tsx
|
|
300
297
|
```
|
|
301
298
|
|
|
302
299
|
This simplifies feature templates by removing the repetitive nested directory structure.
|
|
@@ -304,12 +301,12 @@ This simplifies feature templates by removing the repetitive nested directory st
|
|
|
304
301
|
**Important**: Only files under `webApp/` get the nested structure. SFDX metadata types (like `classes/`, `triggers/`, `objects/`, `lwc/`, etc.) are placed at root level:
|
|
305
302
|
|
|
306
303
|
```
|
|
307
|
-
feature-react-
|
|
304
|
+
feature-react-shadcn/template/
|
|
308
305
|
├── webApp/
|
|
309
306
|
│ └── src/
|
|
310
|
-
│ └── app.tsx → dist/webapplications/feature-react-
|
|
307
|
+
│ └── app.tsx → dist/webapplications/feature-react-shadcn/src/app.tsx
|
|
311
308
|
└── classes/
|
|
312
|
-
└──
|
|
309
|
+
└── MyClass.cls → dist/classes/MyClass.cls (root level)
|
|
313
310
|
```
|
|
314
311
|
|
|
315
312
|
### Using the Default Mapping
|
|
@@ -506,26 +503,26 @@ Application order: C → B → A (dependencies first)
|
|
|
506
503
|
|
|
507
504
|
The CLI builds a complete dependency graph and applies features in topological order.
|
|
508
505
|
|
|
509
|
-
### Example: Building on
|
|
506
|
+
### Example: Building on Shared UI Features
|
|
510
507
|
|
|
511
508
|
```typescript
|
|
512
|
-
// packages/feature/feature-react-
|
|
509
|
+
// packages/template/feature/feature-react-shadcn/feature.ts
|
|
513
510
|
import type { Feature } from "../../../cli/src/types.js";
|
|
514
511
|
|
|
515
512
|
const feature: Feature = {
|
|
516
|
-
//
|
|
513
|
+
// Shadcn UI has no dependencies
|
|
517
514
|
};
|
|
518
515
|
|
|
519
516
|
export default feature;
|
|
520
517
|
```
|
|
521
518
|
|
|
522
519
|
```typescript
|
|
523
|
-
// packages/feature/feature-admin-dashboard/feature.ts
|
|
520
|
+
// packages/template/feature/feature-admin-dashboard/feature.ts
|
|
524
521
|
import type { Feature } from "../../../cli/src/types.js";
|
|
525
522
|
|
|
526
523
|
const feature: Feature = {
|
|
527
|
-
// Admin dashboard builds on top of
|
|
528
|
-
dependencies: ["packages/feature/feature-react-
|
|
524
|
+
// Admin dashboard builds on top of shadcn UI
|
|
525
|
+
dependencies: ["packages/template/feature/feature-react-shadcn"],
|
|
529
526
|
};
|
|
530
527
|
|
|
531
528
|
export default feature;
|
|
@@ -533,10 +530,10 @@ export default feature;
|
|
|
533
530
|
|
|
534
531
|
When you apply `feature-admin-dashboard`:
|
|
535
532
|
|
|
536
|
-
1. CLI resolves `feature-react-
|
|
537
|
-
2. Applies `feature-react-
|
|
533
|
+
1. CLI resolves `feature-react-shadcn` as a dependency
|
|
534
|
+
2. Applies `feature-react-shadcn` first (UI components)
|
|
538
535
|
3. Applies `feature-admin-dashboard` second (dashboard files and routes)
|
|
539
|
-
4. Result: App has both
|
|
536
|
+
4. Result: App has both shared UI and admin dashboard
|
|
540
537
|
|
|
541
538
|
### Nested Dependencies
|
|
542
539
|
|
|
@@ -577,11 +574,11 @@ When multiple features modify the same file:
|
|
|
577
574
|
Example:
|
|
578
575
|
|
|
579
576
|
```
|
|
580
|
-
feature-react-
|
|
577
|
+
feature-react-shadcn provides: src/appLayout.tsx
|
|
581
578
|
feature-custom-app also provides: src/appLayout.tsx
|
|
582
579
|
|
|
583
580
|
When applying feature-custom-app:
|
|
584
|
-
1.
|
|
581
|
+
1. shadcn's appLayout.tsx is applied
|
|
585
582
|
2. custom-app's appLayout.tsx overwrites it
|
|
586
583
|
3. Final result: custom-app's version is used
|
|
587
584
|
```
|
|
@@ -638,7 +635,7 @@ Routes accumulate across all features, preserving routes from base app and all d
|
|
|
638
635
|
|
|
639
636
|
Dependency paths can be:
|
|
640
637
|
|
|
641
|
-
- **Relative to monorepo root**: `'packages/feature/feature-react-
|
|
638
|
+
- **Relative to monorepo root**: `'packages/template/feature/feature-react-shadcn'`
|
|
642
639
|
- **Absolute paths**: `'/absolute/path/to/feature'`
|
|
643
640
|
|
|
644
641
|
The CLI normalizes and resolves all paths consistently.
|
|
@@ -1534,7 +1531,7 @@ You can set default options for all projects in `nx.json`:
|
|
|
1534
1531
|
|
|
1535
1532
|
#### `build-dist-app`
|
|
1536
1533
|
|
|
1537
|
-
Builds the application in the dist folder by running `npm ci` and `npm run build`. This executor is useful for building feature apps after patches have been applied.
|
|
1534
|
+
Builds the application in the dist folder by running `npm ci` (or `npm install` when no `package-lock.json` exists) and `npm run build`. This executor is useful for building feature apps after patches have been applied.
|
|
1538
1535
|
|
|
1539
1536
|
**Usage in `package.json`:**
|
|
1540
1537
|
|
|
@@ -1594,7 +1591,7 @@ nx run-many -t build test
|
|
|
1594
1591
|
|
|
1595
1592
|
2. **build-dist-app executor**:
|
|
1596
1593
|
- Locates the built application in `dist/force-app/main/default/webapplications/<project-name>/`
|
|
1597
|
-
- Runs `npm ci` to install dependencies
|
|
1594
|
+
- Runs `npm ci` to install dependencies (or `npm install` when no `package-lock.json` exists)
|
|
1598
1595
|
- Runs `npm run build` to build the application
|
|
1599
1596
|
- Suitable for CI/CD pipelines and automated testing
|
|
1600
1597
|
|
|
@@ -9,7 +9,8 @@ export interface BuildDistAppExecutorResult {
|
|
|
9
9
|
/**
|
|
10
10
|
* Nx executor for building the application in the dist folder
|
|
11
11
|
*
|
|
12
|
-
* This executor navigates to the project's dist folder and runs npm ci
|
|
12
|
+
* This executor navigates to the project's dist folder and runs npm ci (or npm install when
|
|
13
|
+
* no package-lock.json exists) followed by npm run build.
|
|
13
14
|
*
|
|
14
15
|
* @param options - Executor options
|
|
15
16
|
* @param context - Nx executor context
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../../../src/nx-plugin/executors/build-dist-app/executor.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../../../src/nx-plugin/executors/build-dist-app/executor.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,KAAK,eAAe,EAAU,MAAM,YAAY,CAAC;AAC1D,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,UAAU,CAAC;AAG5D;;GAEG;AACH,MAAM,WAAW,0BAA0B;IAC1C,OAAO,EAAE,OAAO,CAAC;CACjB;AAED;;;;;;;;;GASG;AACH,wBAA8B,WAAW,CACxC,OAAO,EAAE,2BAA2B,EACpC,OAAO,EAAE,eAAe,GACtB,OAAO,CAAC,0BAA0B,CAAC,CAkCrC"}
|
|
@@ -4,13 +4,15 @@
|
|
|
4
4
|
* For full license text, see the LICENSE.txt file
|
|
5
5
|
*/
|
|
6
6
|
import { execSync } from "child_process";
|
|
7
|
+
import { existsSync } from "fs";
|
|
7
8
|
import { join } from "path";
|
|
8
9
|
import { logger } from "@nx/devkit";
|
|
9
10
|
import { createProjectPaths } from "../utils";
|
|
10
11
|
/**
|
|
11
12
|
* Nx executor for building the application in the dist folder
|
|
12
13
|
*
|
|
13
|
-
* This executor navigates to the project's dist folder and runs npm ci
|
|
14
|
+
* This executor navigates to the project's dist folder and runs npm ci (or npm install when
|
|
15
|
+
* no package-lock.json exists) followed by npm run build.
|
|
14
16
|
*
|
|
15
17
|
* @param options - Executor options
|
|
16
18
|
* @param context - Nx executor context
|
|
@@ -25,13 +27,19 @@ export default async function runExecutor(options, context) {
|
|
|
25
27
|
// Build absolute path to the web app
|
|
26
28
|
const targetPath = join(context.root, projectPaths.webApp);
|
|
27
29
|
logger.info(`Building application in ${targetPath}...`);
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
const execOptions = { cwd: targetPath, stdio: "inherit", env: process.env };
|
|
31
|
+
const hasLockfile = existsSync(join(targetPath, "package-lock.json"));
|
|
32
|
+
if (hasLockfile) {
|
|
33
|
+
logger.info("Running npm ci...");
|
|
34
|
+
execSync("npm ci", execOptions);
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
logger.info("No package-lock.json found; running npm install...");
|
|
38
|
+
execSync("npm install", execOptions);
|
|
39
|
+
}
|
|
32
40
|
// Execute npm run build
|
|
33
41
|
logger.info("Running npm run build...");
|
|
34
|
-
execSync("npm run build",
|
|
42
|
+
execSync("npm run build", execOptions);
|
|
35
43
|
logger.info("Build completed successfully");
|
|
36
44
|
return { success: true };
|
|
37
45
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../../src/nx-plugin/executors/build-dist-app/executor.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,QAAQ,EAAwB,MAAM,eAAe,CAAC;AAC/D,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAwB,MAAM,EAAE,MAAM,YAAY,CAAC;AAE1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAS9C
|
|
1
|
+
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../../src/nx-plugin/executors/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AC,IAAI,CAAC,0BAA0B,CAAC,CAAC;QACxC,QAAQ,CAAC,eAAe,EAAE,WAAW,CAAC,CAAC;QAEvC,MAAM,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC;QAC5C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAC1B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,MAAM,YAAY,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC5E,MAAM,CAAC,KAAK,CAAC,6BAA6B,YAAY,EAAE,CAAC,CAAC;QAC1D,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAC3B,CAAC;AACF,CAAC"}
|
package/executors.json
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"build-dist-app": {
|
|
14
14
|
"implementation": "./src/nx-plugin/executors/build-dist-app/executor.ts",
|
|
15
15
|
"schema": "./src/nx-plugin/executors/build-dist-app/schema.json",
|
|
16
|
-
"description": "Builds the application in the dist folder by running npm ci and npm run build"
|
|
16
|
+
"description": "Builds the application in the dist folder by running npm ci (or npm install when no package-lock.json) and npm run build"
|
|
17
17
|
},
|
|
18
18
|
"dev-server": {
|
|
19
19
|
"implementation": "./src/nx-plugin/executors/dev-server/executor.ts",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/webapp-template-cli-experimental",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.44.0",
|
|
4
4
|
"description": "CLI tool for applying feature patches to base apps",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"type": "module",
|
|
@@ -45,5 +45,5 @@
|
|
|
45
45
|
"typescript": "~5.9.3",
|
|
46
46
|
"vitest": "^4.0.17"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "00f5b3b58d400b13a1b1130d11f571c2e1366cb4"
|
|
49
49
|
}
|