@salesforce/templates 66.4.0 → 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/baseGenerator.d.ts +1 -1
- package/lib/generators/baseGenerator.js +2 -2
- package/lib/generators/baseGenerator.js.map +1 -1
- package/lib/generators/lightningComponentGenerator.js +1 -3
- package/lib/generators/lightningComponentGenerator.js.map +1 -1
- 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
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
---
|
|
2
|
-
name: ui-ux
|
|
3
|
-
description: Comprehensive design guide for React + Tailwind + shadcn/ui
|
|
2
|
+
name: webapp-ui-ux
|
|
3
|
+
description: Use when editing any UI code in the web application — styling, layout, design, appearance, Tailwind, shadcn, colors, typography, icons, or visual/UX changes. Comprehensive design guide and searchable database for React + Tailwind + shadcn/ui (styles, color palettes, font pairings, UX guidelines, chart types).
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
#
|
|
6
|
+
# Web App UI/UX
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Use this skill whenever you are editing UI code in the web application — styling, layout, design, appearance, Tailwind, shadcn, colors, typography, icons, or any visual/UX change.
|
|
9
|
+
|
|
10
|
+
Comprehensive design guide for React + Tailwind + shadcn/ui. Contains 67 styles, 96 color palettes, 57 font pairings, 99 UX guidelines, and 25 chart types. Searchable database with priority-based recommendations.
|
|
9
11
|
|
|
10
12
|
## Prerequisites
|
|
11
13
|
|
|
@@ -200,9 +202,10 @@ These are frequently overlooked issues that make UI look unprofessional:
|
|
|
200
202
|
|
|
201
203
|
| Rule | Do | Don't |
|
|
202
204
|
|------|----|----- |
|
|
203
|
-
| **
|
|
205
|
+
| **Icons: Lucide only** | Use **lucide-react** for all UI icons: `import { IconName } from 'lucide-react'` | Use Heroicons, react-icons, or other icon libraries; use emojis as icons |
|
|
206
|
+
| **No emojis ever** | Use words + Lucide icons for labels, empty states, tooltips, headings | Use emojis anywhere in UI or user-facing text (e.g. 🎨 🚀 ⚙️) |
|
|
204
207
|
| **Stable hover states** | Use color/opacity transitions on hover | Use scale transforms that shift layout |
|
|
205
|
-
| **Correct brand logos** | Research official SVG from Simple Icons | Guess or use incorrect logo paths |
|
|
208
|
+
| **Correct brand logos** | Research official SVG from Simple Icons (when needed outside Lucide) | Guess or use incorrect logo paths |
|
|
206
209
|
| **Consistent icon sizing** | Use fixed viewBox (24x24) with w-6 h-6 | Mix different icon sizes randomly |
|
|
207
210
|
|
|
208
211
|
### Interaction & Cursor
|
|
@@ -237,8 +240,8 @@ These are frequently overlooked issues that make UI look unprofessional:
|
|
|
237
240
|
Before delivering UI code, verify these items:
|
|
238
241
|
|
|
239
242
|
### Visual Quality
|
|
240
|
-
- [ ] No emojis
|
|
241
|
-
- [ ] All icons from
|
|
243
|
+
- [ ] No emojis anywhere (UI, labels, empty states, tooltips—use words + Lucide icons only)
|
|
244
|
+
- [ ] All icons from **lucide-react** only (no Heroicons, react-icons, or emojis)
|
|
242
245
|
- [ ] Brand logos are correct (verified from Simple Icons)
|
|
243
246
|
- [ ] Hover states don't cause layout shift
|
|
244
247
|
- [ ] Use theme colors directly (bg-primary) not var() wrapper
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: CLI command generation rules — no node -e one-liners; safe quoting and scripts
|
|
3
|
+
paths:
|
|
4
|
+
- "**/webapplications/**/*"
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# A4D Enforcement: CLI Command Generation & No `node -e` One-Liners
|
|
8
|
+
|
|
9
|
+
When **generating any CLI/shell commands** (for the user or for automation), follow the rules below. Default shell is **Zsh** (macOS); commands must work there without Bash-only syntax.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## 1. Never Use Complex `node -e` One-Liners
|
|
14
|
+
|
|
15
|
+
**Forbidden:** `node -e` (or `node -p`, `node --eval`) for file manipulation, string replacement, reading/writing configs, or multi-line logic.
|
|
16
|
+
|
|
17
|
+
**Why:** In Zsh, `node -e '...'` **silently breaks** due to:
|
|
18
|
+
- **`!` (history expansion):** Zsh expands `!` in double-quoted strings → `event not found` or wrong output.
|
|
19
|
+
- **Backticks:** `` ` `` is command substitution; the shell runs it before Node sees the string.
|
|
20
|
+
- **Nested quoting:** Escaping differs between Bash and Zsh; multi-line JS in one string is fragile.
|
|
21
|
+
|
|
22
|
+
**Allowed:** Trivial one-line only if it has **no** backticks, no `!`, no nested quotes, no multi-line, no `fs` usage. Example: `node -e "console.log(1+1)"`. If in doubt, **use a script file**.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## 2. How To Generate CLI Commands Correctly
|
|
27
|
+
|
|
28
|
+
### Run Node scripts by path, not inline code
|
|
29
|
+
|
|
30
|
+
- **Do:** `node scripts/setup-cli.mjs --target-org myorg`
|
|
31
|
+
- **Do:** `node path/to/script.mjs arg1 arg2`
|
|
32
|
+
- **Do not:** `node -e "require('fs').writeFileSync(...)"` or any non-trivial inline JS.
|
|
33
|
+
|
|
34
|
+
### For file edits or transforms
|
|
35
|
+
|
|
36
|
+
1. **Prefer IDE/agent file tools** (StrReplace, Write, etc.) — they avoid the shell.
|
|
37
|
+
2. **Otherwise:** write a **temporary `.js` or `.mjs` file**, run it, then remove it. Use a **heredoc with quoted delimiter** so the shell does not interpret `$`, `` ` ``, or `!`:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
cat > /tmp/_transform.js << 'SCRIPT'
|
|
41
|
+
const fs = require('fs');
|
|
42
|
+
const data = JSON.parse(fs.readFileSync('package.json', 'utf8'));
|
|
43
|
+
data.name = 'my-app';
|
|
44
|
+
fs.writeFileSync('package.json', JSON.stringify(data, null, 2) + '\n');
|
|
45
|
+
SCRIPT
|
|
46
|
+
node /tmp/_transform.js && rm /tmp/_transform.js
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
3. **Simple replacements:** `sed -i '' 's/old/new/g' path/to/file` (macOS: `-i ''`).
|
|
50
|
+
4. **JSON:** `jq '.name = "my-app"' package.json > tmp.json && mv tmp.json package.json`.
|
|
51
|
+
|
|
52
|
+
### Quoting and shell safety
|
|
53
|
+
|
|
54
|
+
- Use **single quotes** around the outer shell string when the inner content has `$`, `` ` ``, or `!`.
|
|
55
|
+
- For heredocs that must be literal, use **`<< 'END'`** (quoted delimiter) so the body is not expanded.
|
|
56
|
+
- **Do not** generate commands that rely on Bash-only features (e.g. `[[ ]]` is fine in Zsh; avoid `source` vs `.` if you need POSIX).
|
|
57
|
+
|
|
58
|
+
### Paths and working directory
|
|
59
|
+
|
|
60
|
+
- **State where to run from** when it matters, e.g. "From project root" or "From `force-app/main/default/webapplications/<appName>`".
|
|
61
|
+
- Prefer **explicit paths** or `cd <dir> && ...` so the command is copy-paste safe.
|
|
62
|
+
- This project: setup is `node scripts/setup-cli.mjs --target-org <alias>` from **project root**. Web app commands (`npm run dev`, `npm run build`, `npm run lint`) run from the **web app directory** (e.g. `force-app/main/default/webapplications/<appName>` or `**/webapplications/<appName>`).
|
|
63
|
+
|
|
64
|
+
### npm / npx
|
|
65
|
+
|
|
66
|
+
- Use **exact package names** (e.g. `npx @salesforce/webapps-features-experimental list`).
|
|
67
|
+
- For app-specific scripts, **cd to the web app directory first**, then run `npm run <script>` or `npm install ...`.
|
|
68
|
+
- Chain steps with `&&`; one logical command per line is clearer than one giant line.
|
|
69
|
+
|
|
70
|
+
### Summary checklist when generating a command
|
|
71
|
+
|
|
72
|
+
- [ ] No `node -e` / `node -p` / `node --eval` with complex or multi-line code.
|
|
73
|
+
- [ ] If Node logic is needed, use `node path/to/script.mjs` or a temp script with heredoc `<< 'SCRIPT'`.
|
|
74
|
+
- [ ] No unescaped `!`, `` ` ``, or `$` in double-quoted strings in Zsh.
|
|
75
|
+
- [ ] Working directory and required args (e.g. `--target-org`) are clear.
|
|
76
|
+
- [ ] Prefer file-editing tools over shell one-liners when editing project files.
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## 3. Violation Handling
|
|
81
|
+
|
|
82
|
+
- If a generated command used a complex `node -e` one-liner, **revert and redo** using a script file, `sed`/`jq`, or IDE file tools.
|
|
83
|
+
- If the user sees `event not found`, `unexpected token`, or garbled output, **check for**:
|
|
84
|
+
- `node -e` with special characters,
|
|
85
|
+
- Double-quoted strings containing `!` or backticks,
|
|
86
|
+
- Wrong working directory or missing args.
|
|
87
|
+
|
|
88
|
+
**Cross-reference:** **webapp.md** (MUST FOLLOW #1) summarizes the no–`node -e` rule; this file is the full reference for CLI command generation and alternatives.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
description: React-specific patterns and Salesforce data access for SFDX web apps
|
|
3
3
|
paths:
|
|
4
|
-
- "
|
|
4
|
+
- "**/webapplications/**/*"
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# React Web App (SFDX)
|
|
@@ -18,6 +18,15 @@ For layout, navigation, and generation rules, see **webapp.md**.
|
|
|
18
18
|
- Dev server: `npm run dev`
|
|
19
19
|
- Build: `npm run build`
|
|
20
20
|
|
|
21
|
+
## Routing (React Router)
|
|
22
|
+
|
|
23
|
+
Use a **single** router package for the app. When using `createBrowserRouter` and `RouterProvider` from `react-router`, all routing imports must come from **`react-router`** — not from `react-router-dom`.
|
|
24
|
+
|
|
25
|
+
- ✅ `import { createBrowserRouter, RouterProvider, Link, useNavigate, useLocation, Outlet } from 'react-router';`
|
|
26
|
+
- ❌ `import { Link } from 'react-router-dom';` when the app uses `RouterProvider` from `react-router`
|
|
27
|
+
|
|
28
|
+
Mixing packages causes "Cannot destructure property 'basename' of ... as it is null" because `Link`/hooks from `react-router-dom` read a different context than the one provided by `RouterProvider` from `react-router`.
|
|
29
|
+
|
|
21
30
|
## Component Library (MANDATORY)
|
|
22
31
|
|
|
23
32
|
Use **shadcn/ui** for UI components:
|
|
@@ -28,6 +37,42 @@ import { Card, CardHeader, CardContent } from '@/components/ui/card';
|
|
|
28
37
|
import { Input } from '@/components/ui/input';
|
|
29
38
|
```
|
|
30
39
|
|
|
40
|
+
## Icons & No Emojis (MANDATORY)
|
|
41
|
+
|
|
42
|
+
- **Icons:** Use **lucide-react** only. Do not use Heroicons, Simple Icons, or other icon libraries in the web app.
|
|
43
|
+
- ✅ `import { Menu, Settings, Bell } from 'lucide-react';` then `<Menu className="w-5 h-5" />`
|
|
44
|
+
- ❌ Any emoji character as an icon or visual element (e.g. 🎨 🚀 ⚙️ 🔔)
|
|
45
|
+
- ❌ Other icon libraries (e.g. `@heroicons/react`, `react-icons`, custom SVG icon sets)
|
|
46
|
+
- **No emojis ever:** Do not use emojis anywhere in the app: no emojis in UI labels, buttons, headings, empty states, tooltips, or any user-facing text. Use words and lucide-react icons instead.
|
|
47
|
+
- ✅ "Settings" with `<Settings />` icon
|
|
48
|
+
- ❌ "⚙️ Settings" or "Settings 🔧"
|
|
49
|
+
- For icon usage patterns and naming, see the **webapp-ui-ux** skill (`.a4drules/skills/webapp-ui-ux/`, especially `data/icons.csv`).
|
|
50
|
+
|
|
51
|
+
## Editing UI — Source Files Only (CRITICAL)
|
|
52
|
+
|
|
53
|
+
When asked to edit the home page, a section, or any on-screen UI:
|
|
54
|
+
|
|
55
|
+
- **Always edit the actual React/TSX source files.** Never output, paste, or generate raw HTML. The UI is built from components; the agent must locate the component file(s) that render the target area and change **JSX in those files**.
|
|
56
|
+
- **Do not** replace JSX with HTML strings, and do not copy browser-rendered DOM (e.g. expanded `<div>`, `data-slot`, long class strings) into the codebase. That is the output of React + shadcn; the source is `.tsx` with `<Card>`, `<Input>`, etc.
|
|
57
|
+
- **Edit inside the component that owns the UI.** If the element to change is rendered by a **child component** (e.g. `<GlobalSearchInput />` in `Home.tsx`), make the edit **inside that component's file** (e.g. `GlobalSearchInput.tsx`). Do **not** only wrap the component with extra elements in the parent (e.g. adding a `<section>` or `<div>` around `<GlobalSearchInput />`). The parent composes components; the visual/content change belongs in the component that actually renders that part of the UI.
|
|
58
|
+
- **Where to edit:**
|
|
59
|
+
- **Home page content:** `src/pages/Home.tsx` — but if the target is inside a child (e.g. `<GlobalSearchInput />`), edit the child's file, not the parent.
|
|
60
|
+
- **Layout, header, nav:** `src/appLayout.tsx`.
|
|
61
|
+
- **Feature-specific UI (e.g. search, list):** open the **specific component file** that renders the target (e.g. `GlobalSearchInput.tsx` for the search input UI).
|
|
62
|
+
- **Steps:** (1) Identify which **component** owns the section (follow the import: e.g. `GlobalSearchInput` → its file). (2) Open that component's file and modify the JSX there. (3) Only change the parent (e.g. `Home.tsx`) if the change is layout/ordering of components, not the internals of a child. Do not emit a standalone HTML snippet as the “edit.”
|
|
63
|
+
|
|
64
|
+
## Mobile Nav / Hamburger — Must Be Functional
|
|
65
|
+
|
|
66
|
+
When adding a navigation menu that includes a hamburger (or Menu icon) for mobile:
|
|
67
|
+
|
|
68
|
+
- **Do not** add a hamburger/Menu icon that does nothing. The icon must **toggle a visible mobile menu**.
|
|
69
|
+
- **Required implementation:**
|
|
70
|
+
1. **State:** e.g. `const [isOpen, setIsOpen] = useState(false);`
|
|
71
|
+
2. **Toggle button:** The hamburger/Menu button must have `onClick={() => setIsOpen(!isOpen)}` and `aria-label="Toggle menu"` (or equivalent).
|
|
72
|
+
3. **Conditional panel:** A mobile-only menu panel that renders when `isOpen` is true, e.g. `{isOpen && ( <div className="..."> ... nav links ... </div> )}`. Use responsive classes (e.g. `md:hidden`) so the panel is shown only on small screens if the desktop nav is separate.
|
|
73
|
+
4. **Close on navigation:** Each nav link in the mobile panel should call `onClick={() => setIsOpen(false)}` (or similar) so the menu closes when the user navigates.
|
|
74
|
+
- Implement this in `appLayout.tsx` (or the component that owns the header/nav). See existing apps for the full pattern (state + button + conditional panel + link onClick).
|
|
75
|
+
|
|
31
76
|
## Styling
|
|
32
77
|
|
|
33
78
|
- Use **Tailwind CSS** utility classes
|
|
@@ -137,11 +182,20 @@ window.location.reload();
|
|
|
137
182
|
- ❌ Using LWC patterns (`@wire`, LDS) in React
|
|
138
183
|
- ❌ Hardcoded Salesforce IDs or URLs
|
|
139
184
|
- ❌ Missing error handling for async operations
|
|
185
|
+
- ❌ Mixing `react-router` and `react-router-dom` (e.g. `RouterProvider` from `react-router` but `Link` from `react-router-dom`) — use one package for all routing imports
|
|
186
|
+
- ❌ Using emojis anywhere in the app (labels, icons, empty states, headings, tooltips)
|
|
187
|
+
- ❌ Using any icon library other than **lucide-react** (no Heroicons, react-icons, or emoji-as-icon)
|
|
188
|
+
- ❌ Outputting or pasting raw HTML when editing UI — always edit the React/TSX source files (e.g. `Home.tsx`, `appLayout.tsx`, feature components)
|
|
189
|
+
- ❌ Adding a hamburger or Menu icon for mobile nav without implementing toggle state, conditional menu panel, and close-on-navigate
|
|
140
190
|
|
|
141
191
|
## Quality Checklist
|
|
142
192
|
|
|
143
193
|
- [ ] Entry point maintained (`app.tsx`)
|
|
144
194
|
- [ ] Uses shadcn/ui and Tailwind
|
|
195
|
+
- [ ] Icons from **lucide-react** only; no emojis anywhere in UI or user-facing text
|
|
196
|
+
- [ ] UI changes made by editing .tsx source files (never by pasting raw HTML)
|
|
197
|
+
- [ ] If mobile hamburger exists: it has toggle state, conditional menu panel, and close on link click
|
|
198
|
+
- [ ] All routing imports from same package as router (e.g. `react-router` only)
|
|
145
199
|
- [ ] DataSDK used for all Salesforce API calls
|
|
146
200
|
- [ ] Proper error handling with try/catch
|
|
147
201
|
- [ ] Loading and error states implemented
|
|
@@ -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);
|