@salesforce/templates 66.4.1 → 66.4.2
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/lib/generators/projectGenerator.js +30 -1
- package/lib/generators/projectGenerator.js.map +1 -1
- package/lib/templates/project/nativemobile/README.md +21 -0
- package/lib/templates/project/nativemobile/ScratchDef.json +5 -0
- package/lib/templates/project/nativemobile/appMetadata-content.json +29 -0
- package/lib/templates/project/nativemobile/appMetadata-meta.json +5 -0
- package/lib/templates/project/nativemobile/buildMetadata-content.json +8 -0
- package/lib/templates/project/nativemobile/buildMetadata-meta.json +5 -0
- package/lib/templates/project/nativemobile/digitalExperience-meta.xml +4 -0
- package/lib/templates/project/nativemobile/ecDefinition-content.json +5 -0
- package/lib/templates/project/nativemobile/ecDefinition-meta.json +5 -0
- package/lib/templates/project/nativemobile/homeScreen-content.json +77 -0
- package/lib/templates/project/nativemobile/homeScreen-meta.json +5 -0
- package/lib/templates/project/reactb2e/AGENT.md +17 -13
- package/lib/templates/project/reactb2e/CHANGELOG.md +276 -0
- package/lib/templates/project/reactb2e/_p_/_m_/_w_/_a_/index.html +2 -2
- package/lib/templates/project/reactb2e/_p_/_m_/_w_/_a_/package.json +10 -5
- package/lib/templates/project/reactb2e/_p_/_m_/_w_/_a_/src/app.tsx +1 -9
- package/lib/templates/project/reactb2e/_p_/_m_/_w_/_a_/src/components/AgentforceConversationClient.tsx +15 -5
- package/lib/templates/project/reactb2e/_p_/_m_/_w_/_a_/tsconfig.tsbuildinfo +1 -0
- package/lib/templates/project/reactb2e/_p_/_m_/_w_/_a_/vite.config.ts +1 -2
- package/lib/templates/project/reactb2e/_r_/skills/feature-graphql-graphql-data-access/docs/generate-mutation-query.md +11 -5
- package/lib/templates/project/reactb2e/_r_/skills/feature-graphql-graphql-data-access/docs/generate-read-query.md +13 -6
- package/lib/templates/project/reactb2e/_r_/skills/feature-react-file-upload-file-upload/SKILL.md +396 -0
- package/lib/templates/project/reactb2e/_r_/skills/webapp-features/SKILL.md +210 -0
- package/lib/templates/project/reactb2e/_r_/skills/{webapp-react-add-component → webapp-react}/SKILL.md +5 -3
- package/lib/templates/project/reactb2e/_r_/skills/{webapp-react-add-component → webapp-react}/implementation/header-footer.md +8 -0
- package/lib/templates/project/{reactb2x/_r_/skills/webapp-react-add-component → reactb2e/_r_/skills/webapp-react}/implementation/page.md +8 -7
- package/lib/templates/project/reactb2e/_r_/skills/webapp-ui-ux/SKILL.md +11 -8
- package/lib/templates/project/reactb2e/_r_/webapp-cli-commands.md +88 -0
- package/lib/templates/project/reactb2e/_r_/webapp-react-code-quality.md +1 -1
- package/lib/templates/project/reactb2e/_r_/webapp-react-typescript.md +1 -1
- package/lib/templates/project/reactb2e/_r_/webapp-react.md +55 -1
- package/lib/templates/project/reactb2e/_r_/webapp-skills-first.md +1 -1
- package/lib/templates/project/reactb2e/_r_/webapp-webapplication.md +159 -0
- package/lib/templates/project/reactb2e/_r_/webapp.md +2 -2
- package/lib/templates/project/reactb2e/package.json +1 -1
- package/lib/templates/project/reactb2e/scripts/prepare-import-unique-fields.js +17 -3
- package/lib/templates/project/reactb2e/scripts/setup-cli.mjs +318 -67
- package/lib/templates/project/reactb2x/AGENT.md +17 -13
- package/lib/templates/project/reactb2x/CHANGELOG.md +276 -0
- package/lib/templates/project/reactb2x/_p_/_m_/_d_/_s_/_a1_/sfdc_cms__site/appreacttemplateb2x1/content.json +1 -1
- package/lib/templates/project/reactb2x/_p_/_m_/_w_/_a_/index.html +2 -2
- package/lib/templates/project/reactb2x/_p_/_m_/_w_/_a_/package.json +10 -4
- package/lib/templates/project/reactb2x/_p_/_m_/_w_/_a_/src/_f_/authentication/api/userProfileApi.ts +15 -1
- package/lib/templates/project/reactb2x/_p_/_m_/_w_/_a_/src/_f_/authentication/pages/ChangePassword.tsx +1 -1
- package/lib/templates/project/reactb2x/_p_/_m_/_w_/_a_/src/_f_/authentication/pages/ForgotPassword.tsx +1 -1
- package/lib/templates/project/reactb2x/_p_/_m_/_w_/_a_/src/_f_/authentication/pages/Login.tsx +2 -2
- package/lib/templates/project/reactb2x/_p_/_m_/_w_/_a_/src/_f_/authentication/pages/Register.tsx +2 -2
- package/lib/templates/project/reactb2x/_p_/_m_/_w_/_a_/src/_f_/authentication/pages/ResetPassword.tsx +1 -1
- package/lib/templates/project/reactb2x/_p_/_m_/_w_/_a_/src/app.tsx +2 -1
- package/lib/templates/project/reactb2x/_p_/_m_/_w_/_a_/tsconfig.tsbuildinfo +1 -0
- package/lib/templates/project/reactb2x/_p_/_m_/_w_/_a_/vite.config.ts +1 -2
- package/lib/templates/project/reactb2x/_r_/skills/feature-graphql-graphql-data-access/docs/generate-mutation-query.md +11 -5
- package/lib/templates/project/reactb2x/_r_/skills/feature-graphql-graphql-data-access/docs/generate-read-query.md +13 -6
- package/lib/templates/project/reactb2x/_r_/skills/feature-react-file-upload-file-upload/SKILL.md +396 -0
- package/lib/templates/project/reactb2x/_r_/skills/webapp-features/SKILL.md +210 -0
- package/lib/templates/project/reactb2x/_r_/skills/{webapp-react-add-component → webapp-react}/SKILL.md +5 -3
- package/lib/templates/project/reactb2x/_r_/skills/{webapp-react-add-component → webapp-react}/implementation/header-footer.md +8 -0
- package/lib/templates/project/{reactb2e/_r_/skills/webapp-react-add-component → reactb2x/_r_/skills/webapp-react}/implementation/page.md +8 -7
- package/lib/templates/project/reactb2x/_r_/skills/webapp-ui-ux/SKILL.md +11 -8
- package/lib/templates/project/reactb2x/_r_/webapp-cli-commands.md +88 -0
- package/lib/templates/project/reactb2x/_r_/webapp-react-code-quality.md +1 -1
- package/lib/templates/project/reactb2x/_r_/webapp-react-typescript.md +1 -1
- package/lib/templates/project/reactb2x/_r_/webapp-react.md +55 -1
- package/lib/templates/project/reactb2x/_r_/webapp-skills-first.md +1 -1
- package/lib/templates/project/reactb2x/_r_/webapp-webapplication.md +159 -0
- package/lib/templates/project/reactb2x/_r_/webapp.md +2 -2
- package/lib/templates/project/reactb2x/package.json +1 -1
- package/lib/templates/project/reactb2x/scripts/prepare-import-unique-fields.js +17 -3
- package/lib/templates/project/reactb2x/scripts/setup-cli.mjs +318 -67
- package/lib/templates/webapplication/reactbasic/index.html +2 -2
- package/lib/templates/webapplication/reactbasic/package.json +3 -3
- package/lib/templates/webapplication/reactbasic/src/app.tsx +1 -9
- package/lib/templates/webapplication/reactbasic/vite.config.ts +1 -2
- package/lib/utils/types.d.ts +1 -1
- package/package.json +6 -6
- package/lib/templates/project/reactb2e/_r_/webapp-no-node-e.md +0 -65
- package/lib/templates/project/reactb2x/_r_/webapp-no-node-e.md +0 -65
- /package/lib/templates/project/reactb2e/_r_/skills/{webapp-react-add-component → webapp-react}/implementation/component.md +0 -0
- /package/lib/templates/project/reactb2x/_r_/skills/{webapp-react-add-component → webapp-react}/implementation/component.md +0 -0
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
|
|
2
|
+
---
|
|
3
|
+
paths:
|
|
4
|
+
- "**/webapplications/**/*"
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# WebApplication Requirements
|
|
8
|
+
|
|
9
|
+
## Bundle Rules
|
|
10
|
+
- A WebApplication bundle must live under `webapplications/<AppName>/`
|
|
11
|
+
- The bundle must contain `<AppName>.webapplication-meta.xml`
|
|
12
|
+
- The metadata filename must exactly match the folder name
|
|
13
|
+
- A build output directory must exist and contain at least one file
|
|
14
|
+
- Default build output directory: `dist/`
|
|
15
|
+
- If `webapplication.json.outputDir` is set, it overrides `dist/`
|
|
16
|
+
|
|
17
|
+
Valid example:
|
|
18
|
+
```text
|
|
19
|
+
webapplications/
|
|
20
|
+
MyApp/
|
|
21
|
+
MyApp.webapplication-meta.xml
|
|
22
|
+
webapplication.json
|
|
23
|
+
dist/
|
|
24
|
+
index.html
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Metadata XML
|
|
28
|
+
Required fields:
|
|
29
|
+
- `masterLabel`
|
|
30
|
+
- `version` (max 20 chars)
|
|
31
|
+
- `isActive` (boolean)
|
|
32
|
+
|
|
33
|
+
Optional fields:
|
|
34
|
+
- `description` (max 255 chars)
|
|
35
|
+
|
|
36
|
+
## webapplication.json
|
|
37
|
+
`webapplication.json` is optional.
|
|
38
|
+
|
|
39
|
+
Allowed top-level keys only:
|
|
40
|
+
- `outputDir`
|
|
41
|
+
- `routing`
|
|
42
|
+
- `headers`
|
|
43
|
+
|
|
44
|
+
### File Constraints
|
|
45
|
+
- Must be valid UTF-8 JSON
|
|
46
|
+
- Max size: 100 KB
|
|
47
|
+
- Root must be a non-empty object
|
|
48
|
+
- Never allow `{}`, arrays, or primitives as the root
|
|
49
|
+
|
|
50
|
+
### Path Safety
|
|
51
|
+
Applies to:
|
|
52
|
+
- `outputDir`
|
|
53
|
+
- `routing.fallback`
|
|
54
|
+
|
|
55
|
+
Reject:
|
|
56
|
+
- backslashes
|
|
57
|
+
- leading `/` or `\`
|
|
58
|
+
- `..` segments
|
|
59
|
+
- null or control characters
|
|
60
|
+
- globs: `*`, `?`, `**`
|
|
61
|
+
- `%`
|
|
62
|
+
|
|
63
|
+
All resolved paths must stay within the application bundle.
|
|
64
|
+
|
|
65
|
+
### outputDir
|
|
66
|
+
- Must be a non-empty string
|
|
67
|
+
- Must reference a subdirectory only
|
|
68
|
+
- Reject `.` and `./`
|
|
69
|
+
- The directory must exist in the bundle
|
|
70
|
+
- The directory must contain at least one file
|
|
71
|
+
|
|
72
|
+
### routing
|
|
73
|
+
- If present, must be a non-empty object
|
|
74
|
+
- Allowed keys only:
|
|
75
|
+
- `rewrites`
|
|
76
|
+
- `redirects`
|
|
77
|
+
- `fallback`
|
|
78
|
+
- `trailingSlash`
|
|
79
|
+
- `fileBasedRouting`
|
|
80
|
+
|
|
81
|
+
#### routing.trailingSlash
|
|
82
|
+
- Must be one of: `"always"`, `"never"`, `"auto"`
|
|
83
|
+
|
|
84
|
+
#### routing.fileBasedRouting
|
|
85
|
+
- Must be a boolean
|
|
86
|
+
|
|
87
|
+
#### routing.fallback
|
|
88
|
+
- Must be a non-empty string
|
|
89
|
+
- Must satisfy Path Safety rules
|
|
90
|
+
- Target file must exist
|
|
91
|
+
|
|
92
|
+
#### routing.rewrites
|
|
93
|
+
- Must be a non-empty array
|
|
94
|
+
- Each item must be a non-empty object
|
|
95
|
+
- Allowed keys: `route`, `rewrite`
|
|
96
|
+
- `rewrite` must be a non-empty string
|
|
97
|
+
- `route`, if present, must be a non-empty string
|
|
98
|
+
|
|
99
|
+
Example:
|
|
100
|
+
```json
|
|
101
|
+
{
|
|
102
|
+
"routing": {
|
|
103
|
+
"rewrites": [
|
|
104
|
+
{ "route": "/app/:path*", "rewrite": "/index.html" }
|
|
105
|
+
]
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
#### routing.redirects
|
|
111
|
+
- Must be a non-empty array
|
|
112
|
+
- Each item must be a non-empty object
|
|
113
|
+
- Allowed keys: `route`, `redirect`, `statusCode`
|
|
114
|
+
- `redirect` must be a non-empty string
|
|
115
|
+
- `route`, if present, must be a non-empty string
|
|
116
|
+
- `statusCode`, if present, must be one of: `301`, `302`, `307`, `308`
|
|
117
|
+
|
|
118
|
+
Example:
|
|
119
|
+
```json
|
|
120
|
+
{
|
|
121
|
+
"routing": {
|
|
122
|
+
"redirects": [
|
|
123
|
+
{ "route": "/old-page", "redirect": "/new-page", "statusCode": 301 }
|
|
124
|
+
]
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### headers
|
|
130
|
+
- If present, must be a non-empty array
|
|
131
|
+
- Each item must be a non-empty object
|
|
132
|
+
- Allowed keys: `source`, `headers`
|
|
133
|
+
- `headers` must be a non-empty array
|
|
134
|
+
|
|
135
|
+
Each header entry must contain:
|
|
136
|
+
- `key`: non-empty string
|
|
137
|
+
- `value`: non-empty string
|
|
138
|
+
|
|
139
|
+
Example:
|
|
140
|
+
```json
|
|
141
|
+
{
|
|
142
|
+
"headers": [
|
|
143
|
+
{
|
|
144
|
+
"source": "/assets/**",
|
|
145
|
+
"headers": [
|
|
146
|
+
{ "key": "Cache-Control", "value": "public, max-age=31536000, immutable" }
|
|
147
|
+
]
|
|
148
|
+
}
|
|
149
|
+
]
|
|
150
|
+
}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## Never Suggest
|
|
154
|
+
- `{}` as the JSON root
|
|
155
|
+
- `"routing": {}`
|
|
156
|
+
- empty arrays
|
|
157
|
+
- empty array items such as `[{}]`
|
|
158
|
+
- `"outputDir": "."`
|
|
159
|
+
- `"outputDir": "./"`
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
description: Core web application rules for SFDX React apps
|
|
3
3
|
paths:
|
|
4
|
-
- "
|
|
4
|
+
- "**/webapplications/**/*"
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# Skills-First (MUST FOLLOW)
|
|
@@ -81,7 +81,7 @@ Agents consistently miss these. **You must not leave them default.**
|
|
|
81
81
|
|
|
82
82
|
# Shell Command Safety (MUST FOLLOW)
|
|
83
83
|
|
|
84
|
-
**Never use complex `node -e` one-liners** for file edits or multi-line transforms. They break in Zsh due to `!` history expansion and backtick interpolation. Use a temporary `.js` file, `sed`/`awk`, `jq`, or IDE file-editing tools instead. See **webapp-
|
|
84
|
+
**Never use complex `node -e` one-liners** for file edits or multi-line transforms. They break in Zsh due to `!` history expansion and backtick interpolation. Use a temporary `.js` file, `sed`/`awk`, `jq`, or IDE file-editing tools instead. See **webapp-cli-commands.md** for full details and approved alternatives.
|
|
85
85
|
|
|
86
86
|
# Development Cycle
|
|
87
87
|
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*
|
|
6
6
|
* Usage:
|
|
7
7
|
* node scripts/prepare-import-unique-fields.js
|
|
8
|
-
* node scripts/prepare-import-unique-fields.js --data-dir /path/to
|
|
8
|
+
* node scripts/prepare-import-unique-fields.js --data-dir /path/to/<sfdx-source>/data
|
|
9
9
|
*
|
|
10
10
|
* Expects data dir to contain (optional) JSON files:
|
|
11
11
|
* Contact.json (Email with unique domain per run, LastName, FirstName, Phone — standard Contact)
|
|
@@ -18,8 +18,22 @@
|
|
|
18
18
|
const fs = require('fs');
|
|
19
19
|
const path = require('path');
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
const
|
|
21
|
+
function resolveSfdxSource() {
|
|
22
|
+
const sfdxPath = path.resolve(__dirname, '..', 'sfdx-project.json');
|
|
23
|
+
if (!fs.existsSync(sfdxPath)) {
|
|
24
|
+
console.error('Error: sfdx-project.json not found at project root.');
|
|
25
|
+
process.exit(1);
|
|
26
|
+
}
|
|
27
|
+
const sfdxProject = JSON.parse(fs.readFileSync(sfdxPath, 'utf8'));
|
|
28
|
+
const pkgDir = sfdxProject?.packageDirectories?.[0]?.path;
|
|
29
|
+
if (!pkgDir) {
|
|
30
|
+
console.error('Error: No packageDirectories[].path found in sfdx-project.json.');
|
|
31
|
+
process.exit(1);
|
|
32
|
+
}
|
|
33
|
+
return path.resolve(__dirname, '..', pkgDir, 'main', 'default');
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const DEFAULT_DATA_DIR = path.resolve(resolveSfdxSource(), 'data');
|
|
23
37
|
|
|
24
38
|
function parseArgs() {
|
|
25
39
|
const args = process.argv.slice(2);
|