@salesforce/templates 66.1.1 → 66.2.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/lib/generators/projectGenerator.d.ts +6 -0
- package/lib/generators/projectGenerator.js +43 -4
- package/lib/generators/projectGenerator.js.map +1 -1
- package/lib/templates/project/react-b2e/.a4drules/README.md +35 -0
- package/lib/templates/project/react-b2e/.a4drules/a4d-webapp-generate.md +27 -0
- package/lib/templates/project/react-b2e/.a4drules/build-validation.md +78 -0
- package/lib/templates/project/react-b2e/.a4drules/code-quality.md +137 -0
- package/lib/templates/project/react-b2e/.a4drules/graphql/tools/knowledge/lds-explore-graphql-schema.md +227 -0
- package/lib/templates/project/react-b2e/.a4drules/graphql/tools/knowledge/lds-generate-graphql-mutationquery.md +212 -0
- package/lib/templates/project/react-b2e/.a4drules/graphql/tools/knowledge/lds-generate-graphql-readquery.md +185 -0
- package/lib/templates/project/react-b2e/.a4drules/graphql/tools/knowledge/lds-guide-graphql.md +205 -0
- package/lib/templates/project/react-b2e/.a4drules/graphql/tools/schemas/shared.graphqls +1150 -0
- package/lib/templates/project/react-b2e/.a4drules/graphql.md +409 -0
- package/lib/templates/project/react-b2e/.a4drules/images.md +13 -0
- package/lib/templates/project/react-b2e/.a4drules/react.md +387 -0
- package/lib/templates/project/react-b2e/.a4drules/react_image_processing.md +45 -0
- package/lib/templates/project/react-b2e/.a4drules/typescript.md +224 -0
- package/lib/templates/project/react-b2e/.a4drules/ui-layout.md +23 -0
- package/lib/templates/project/react-b2e/.a4drules/webapp-nav-and-placeholders.md +33 -0
- package/lib/templates/project/react-b2e/.a4drules/webapp-no-node-e.md +25 -0
- package/lib/templates/project/react-b2e/.a4drules/webapp-ui-first.md +32 -0
- package/lib/templates/project/react-b2e/.a4drules/webapp.md +75 -0
- package/lib/templates/project/react-b2e/.forceignore +15 -0
- package/lib/templates/project/react-b2e/.husky/pre-commit +4 -0
- package/lib/templates/project/react-b2e/.prettierignore +11 -0
- package/lib/templates/project/react-b2e/.prettierrc +17 -0
- package/lib/templates/project/react-b2e/AGENT.md +75 -0
- package/lib/templates/project/react-b2e/CHANGELOG.md +696 -0
- package/lib/templates/project/react-b2e/README.md +18 -0
- package/lib/templates/project/react-b2e/config/project-scratch-def.json +13 -0
- package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/.graphqlrc.yml +2 -0
- package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/.prettierignore +9 -0
- package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/.prettierrc +11 -0
- package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/appreacttemplateb2e.webapplication-meta.xml +7 -0
- package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/build/vite.config.d.ts +2 -0
- package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/build/vite.config.js +93 -0
- package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/codegen.yml +94 -0
- package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/e2e/app.spec.ts +17 -0
- package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/eslint.config.js +141 -0
- package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/index.html +13 -0
- package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/package-lock.json +14392 -0
- package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/package.json +58 -0
- package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/playwright.config.ts +24 -0
- package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/scripts/get-graphql-schema.mjs +68 -0
- package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/scripts/rewrite-e2e-assets.mjs +23 -0
- package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/src/api/graphql-operations-types.ts +116 -0
- package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/src/api/utils/accounts.ts +33 -0
- package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/src/api/utils/query/highRevenueAccountsQuery.graphql +29 -0
- package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/src/app.tsx +22 -0
- package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/src/appLayout.tsx +19 -0
- package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/src/assets/icons/book.svg +3 -0
- package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/src/assets/icons/copy.svg +4 -0
- package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/src/assets/icons/rocket.svg +3 -0
- package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/src/assets/icons/star.svg +3 -0
- package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/src/assets/images/codey-1.png +0 -0
- package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/src/assets/images/codey-2.png +0 -0
- package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/src/assets/images/codey-3.png +0 -0
- package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/src/assets/images/vibe-codey.svg +194 -0
- package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/src/components/AgentforceConversationClient.tsx +127 -0
- package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/src/index.ts +6 -0
- package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/src/navigationMenu.tsx +80 -0
- package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/src/pages/Home.tsx +12 -0
- package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/src/pages/NotFound.tsx +18 -0
- package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/src/router-utils.tsx +35 -0
- package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/src/routes.tsx +22 -0
- package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/src/styles/global.css +13 -0
- package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/src/types/conversation.ts +21 -0
- package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/tsconfig.json +36 -0
- package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/tsconfig.node.json +13 -0
- package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/vite-env.d.ts +1 -0
- package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/vite.config.ts +102 -0
- package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/vitest-env.d.ts +2 -0
- package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/vitest.config.ts +11 -0
- package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/vitest.setup.ts +1 -0
- package/lib/templates/project/react-b2e/force-app/main/default/webapplications/appreacttemplateb2e/webapplication.json +7 -0
- package/lib/templates/project/react-b2e/jest.config.js +6 -0
- package/lib/templates/project/react-b2e/package.json +38 -0
- package/lib/templates/project/react-b2e/scripts/apex/hello.apex +10 -0
- package/lib/templates/project/react-b2e/scripts/soql/account.soql +6 -0
- package/lib/templates/project/react-b2e/sfdx-project.json +12 -0
- package/lib/templates/project/react-b2x/.a4drules/README.md +35 -0
- package/lib/templates/project/react-b2x/.a4drules/a4d-webapp-generate.md +27 -0
- package/lib/templates/project/react-b2x/.a4drules/build-validation.md +78 -0
- package/lib/templates/project/react-b2x/.a4drules/code-quality.md +137 -0
- package/lib/templates/project/react-b2x/.a4drules/graphql/tools/knowledge/lds-explore-graphql-schema.md +227 -0
- package/lib/templates/project/react-b2x/.a4drules/graphql/tools/knowledge/lds-generate-graphql-mutationquery.md +212 -0
- package/lib/templates/project/react-b2x/.a4drules/graphql/tools/knowledge/lds-generate-graphql-readquery.md +185 -0
- package/lib/templates/project/react-b2x/.a4drules/graphql/tools/knowledge/lds-guide-graphql.md +205 -0
- package/lib/templates/project/react-b2x/.a4drules/graphql/tools/schemas/shared.graphqls +1150 -0
- package/lib/templates/project/react-b2x/.a4drules/graphql.md +409 -0
- package/lib/templates/project/react-b2x/.a4drules/images.md +13 -0
- package/lib/templates/project/react-b2x/.a4drules/react.md +387 -0
- package/lib/templates/project/react-b2x/.a4drules/react_image_processing.md +45 -0
- package/lib/templates/project/react-b2x/.a4drules/typescript.md +224 -0
- package/lib/templates/project/react-b2x/.a4drules/ui-layout.md +23 -0
- package/lib/templates/project/react-b2x/.a4drules/webapp-nav-and-placeholders.md +33 -0
- package/lib/templates/project/react-b2x/.a4drules/webapp-no-node-e.md +25 -0
- package/lib/templates/project/react-b2x/.a4drules/webapp-ui-first.md +32 -0
- package/lib/templates/project/react-b2x/.a4drules/webapp.md +75 -0
- package/lib/templates/project/react-b2x/.forceignore +15 -0
- package/lib/templates/project/react-b2x/.husky/pre-commit +4 -0
- package/lib/templates/project/react-b2x/.prettierignore +11 -0
- package/lib/templates/project/react-b2x/.prettierrc +17 -0
- package/lib/templates/project/react-b2x/AGENT.md +75 -0
- package/lib/templates/project/react-b2x/CHANGELOG.md +696 -0
- package/lib/templates/project/react-b2x/README.md +18 -0
- package/lib/templates/project/react-b2x/config/project-scratch-def.json +13 -0
- package/lib/templates/project/react-b2x/force-app/main/default/classes/WebAppAuthUtils.cls +68 -0
- package/lib/templates/project/react-b2x/force-app/main/default/classes/WebAppAuthUtils.cls-meta.xml +5 -0
- package/lib/templates/project/react-b2x/force-app/main/default/classes/WebAppChangePassword.cls +77 -0
- package/lib/templates/project/react-b2x/force-app/main/default/classes/WebAppChangePassword.cls-meta.xml +5 -0
- package/lib/templates/project/react-b2x/force-app/main/default/classes/WebAppForgotPassword.cls +71 -0
- package/lib/templates/project/react-b2x/force-app/main/default/classes/WebAppForgotPassword.cls-meta.xml +5 -0
- package/lib/templates/project/react-b2x/force-app/main/default/classes/WebAppLogin.cls +105 -0
- package/lib/templates/project/react-b2x/force-app/main/default/classes/WebAppLogin.cls-meta.xml +5 -0
- package/lib/templates/project/react-b2x/force-app/main/default/classes/WebAppRegistration.cls +162 -0
- package/lib/templates/project/react-b2x/force-app/main/default/classes/WebAppRegistration.cls-meta.xml +5 -0
- package/lib/templates/project/react-b2x/force-app/main/default/digitalExperienceConfigs/appreacttemplateb2x1.digitalExperienceConfig +8 -0
- package/lib/templates/project/react-b2x/force-app/main/default/digitalExperiences/site/appreacttemplateb2x1/appreacttemplateb2x1.digitalExperience-meta.xml +11 -0
- package/lib/templates/project/react-b2x/force-app/main/default/digitalExperiences/site/appreacttemplateb2x1/sfdc_cms__site/appreacttemplateb2x1/_meta.json +5 -0
- package/lib/templates/project/react-b2x/force-app/main/default/digitalExperiences/site/appreacttemplateb2x1/sfdc_cms__site/appreacttemplateb2x1/content.json +10 -0
- package/lib/templates/project/react-b2x/force-app/main/default/networks/appreacttemplateb2x.network +60 -0
- package/lib/templates/project/react-b2x/force-app/main/default/package.xml +20 -0
- package/lib/templates/project/react-b2x/force-app/main/default/sites/appreacttemplateb2x.site +31 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/.graphqlrc.yml +2 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/.prettierignore +9 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/.prettierrc +11 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/appreacttemplateb2x.webapplication-meta.xml +7 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/build/vite.config.d.ts +2 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/build/vite.config.js +93 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/codegen.yml +94 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/e2e/app.spec.ts +17 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/eslint.config.js +141 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/index.html +13 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/package-lock.json +18408 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/package.json +66 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/playwright.config.ts +24 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/scripts/get-graphql-schema.mjs +68 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/scripts/rewrite-e2e-assets.mjs +23 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/api/graphql-operations-types.ts +116 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/api/utils/accounts.ts +33 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/api/utils/query/highRevenueAccountsQuery.graphql +29 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/app.tsx +13 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/appLayout.tsx +11 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/assets/icons/book.svg +3 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/assets/icons/copy.svg +4 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/assets/icons/rocket.svg +3 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/assets/icons/star.svg +3 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/assets/images/codey-1.png +0 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/assets/images/codey-2.png +0 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/assets/images/codey-3.png +0 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/assets/images/vibe-codey.svg +194 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/components/alerts/status-alert.tsx +45 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/components/auth/authHelpers.ts +73 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/components/auth/authenticationConfig.ts +61 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/components/auth/authenticationRouteLayout.tsx +21 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/components/auth/privateRouteLayout.tsx +36 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/components/auth/sessionTimeout/SessionTimeoutValidator.tsx +616 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/components/auth/sessionTimeout/sessionTimeService.ts +161 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/components/auth/sessionTimeout/sessionTimeoutConfig.ts +77 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/components/footers/footer-link.tsx +36 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/components/forms/auth-form.tsx +81 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/components/forms/submit-button.tsx +49 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/components/layout/card-layout.tsx +23 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/components/layout/card-skeleton.tsx +38 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/components/layout/centered-page-layout.tsx +73 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/components/ui/alert.tsx +69 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/components/ui/button.tsx +67 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/components/ui/card.tsx +92 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/components/ui/dialog.tsx +143 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/components/ui/field.tsx +222 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/components/ui/index.ts +72 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/components/ui/input.tsx +19 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/components/ui/label.tsx +19 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/components/ui/pagination.tsx +112 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/components/ui/select.tsx +183 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/components/ui/separator.tsx +26 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/components/ui/skeleton.tsx +14 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/components/ui/spinner.tsx +15 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/components/ui/table.tsx +87 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/components/ui/tabs.tsx +78 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/components.json +18 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/context/AuthContext.tsx +95 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/hooks/form.tsx +116 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/hooks/useCountdownTimer.ts +266 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/hooks/useRetryWithBackoff.ts +109 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/layouts/AuthAppLayout.tsx +12 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/lib/data-sdk.ts +21 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/lib/utils.ts +6 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/navigationMenu.tsx +80 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/pages/ChangePassword.tsx +107 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/pages/ForgotPassword.tsx +73 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/pages/Home.tsx +12 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/pages/Login.tsx +97 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/pages/NotFound.tsx +18 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/pages/Profile.tsx +178 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/pages/Register.tsx +138 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/pages/ResetPassword.tsx +107 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/router-utils.tsx +35 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/routes.tsx +71 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/styles/global.css +135 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/src/utils/helpers.ts +121 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/tsconfig.json +36 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/tsconfig.node.json +13 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/vite-env.d.ts +1 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/vite.config.ts +102 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/vitest-env.d.ts +2 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/vitest.config.ts +11 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/vitest.setup.ts +1 -0
- package/lib/templates/project/react-b2x/force-app/main/default/webapplications/appreacttemplateb2x/webapplication.json +7 -0
- package/lib/templates/project/react-b2x/jest.config.js +6 -0
- package/lib/templates/project/react-b2x/package.json +38 -0
- package/lib/templates/project/react-b2x/scripts/apex/hello.apex +10 -0
- package/lib/templates/project/react-b2x/scripts/soql/account.soql +6 -0
- package/lib/templates/project/react-b2x/sfdx-project.json +12 -0
- package/lib/templates/webapplication/reactbasic/.graphqlrc.yml +2 -0
- package/lib/templates/webapplication/reactbasic/build/vite.config.js +20 -1
- package/lib/templates/webapplication/reactbasic/codegen.yml +94 -0
- package/lib/templates/webapplication/reactbasic/e2e/app.spec.ts +0 -7
- package/lib/templates/webapplication/reactbasic/eslint.config.js +28 -0
- package/lib/templates/webapplication/reactbasic/package-lock.json +10090 -2874
- package/lib/templates/webapplication/reactbasic/package.json +16 -4
- package/lib/templates/webapplication/reactbasic/scripts/get-graphql-schema.mjs +68 -0
- package/lib/templates/webapplication/reactbasic/src/api/graphql-operations-types.ts +23 -34
- package/lib/templates/webapplication/reactbasic/src/api/utils/accounts.ts +33 -0
- package/lib/templates/webapplication/reactbasic/src/app.tsx +10 -1
- package/lib/templates/webapplication/reactbasic/src/appLayout.tsx +2 -0
- package/lib/templates/webapplication/reactbasic/src/navigationMenu.tsx +80 -0
- package/lib/templates/webapplication/reactbasic/src/router-utils.tsx +35 -0
- package/lib/templates/webapplication/reactbasic/src/routes.tsx +1 -7
- package/lib/templates/webapplication/reactbasic/vite.config.ts +20 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/utils/types.d.ts +1 -1
- package/lib/utils/webappTemplateUtils.d.ts +49 -0
- package/lib/utils/webappTemplateUtils.js +210 -0
- package/lib/utils/webappTemplateUtils.js.map +1 -0
- package/package.json +7 -5
- package/lib/templates/webapplication/reactbasic/src/pages/About.tsx +0 -12
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2020",
|
|
4
|
+
"useDefineForClassFields": true,
|
|
5
|
+
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
|
6
|
+
"module": "ESNext",
|
|
7
|
+
"skipLibCheck": true,
|
|
8
|
+
|
|
9
|
+
/* Bundler mode */
|
|
10
|
+
"moduleResolution": "bundler",
|
|
11
|
+
"allowImportingTsExtensions": true,
|
|
12
|
+
"resolveJsonModule": true,
|
|
13
|
+
"isolatedModules": true,
|
|
14
|
+
"noEmit": true,
|
|
15
|
+
"jsx": "react-jsx",
|
|
16
|
+
|
|
17
|
+
/* Linting */
|
|
18
|
+
"strict": true,
|
|
19
|
+
"noUnusedLocals": true,
|
|
20
|
+
"noUnusedParameters": true,
|
|
21
|
+
"noFallthroughCasesInSwitch": true,
|
|
22
|
+
|
|
23
|
+
/* Path mapping */
|
|
24
|
+
"baseUrl": ".",
|
|
25
|
+
"paths": {
|
|
26
|
+
"@/*": ["./src/*"],
|
|
27
|
+
"@api/*": ["./src/api/*"],
|
|
28
|
+
"@components/*": ["./src/components/*"],
|
|
29
|
+
"@utils/*": ["./src/utils/*"],
|
|
30
|
+
"@styles/*": ["./src/styles/*"],
|
|
31
|
+
"@assets/*": ["./src/assets/*"]
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"include": ["src", "vite-env.d.ts", "vitest-env.d.ts"],
|
|
35
|
+
"references": [{ "path": "./tsconfig.node.json" }]
|
|
36
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"composite": true,
|
|
4
|
+
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
|
|
5
|
+
"skipLibCheck": true,
|
|
6
|
+
"module": "ESNext",
|
|
7
|
+
"moduleResolution": "bundler",
|
|
8
|
+
"allowSyntheticDefaultImports": true,
|
|
9
|
+
"strict": true,
|
|
10
|
+
"outDir": "./build"
|
|
11
|
+
},
|
|
12
|
+
"include": ["vite.config.ts"]
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/// <reference types="vite/client" />
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { defineConfig } from 'vite';
|
|
2
|
+
import react from '@vitejs/plugin-react';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import { resolve } from 'path';
|
|
5
|
+
import tailwindcss from '@tailwindcss/vite';
|
|
6
|
+
import salesforce from '@salesforce/vite-plugin-webapp-experimental';
|
|
7
|
+
import codegen from 'vite-plugin-graphql-codegen';
|
|
8
|
+
|
|
9
|
+
export default defineConfig(({ mode }) => {
|
|
10
|
+
return {
|
|
11
|
+
// Ensure root base for e2e/static serve; plugin may override when deployed under a path
|
|
12
|
+
base: '/',
|
|
13
|
+
plugins: [
|
|
14
|
+
tailwindcss(),
|
|
15
|
+
react(),
|
|
16
|
+
salesforce(),
|
|
17
|
+
codegen({
|
|
18
|
+
// Path to the codegen config file
|
|
19
|
+
configFilePathOverride: resolve(__dirname, 'codegen.yml'),
|
|
20
|
+
// Run codegen on dev server start
|
|
21
|
+
runOnStart: true,
|
|
22
|
+
// Don't run codegen on build for now
|
|
23
|
+
runOnBuild: false,
|
|
24
|
+
// Enable file watcher during development
|
|
25
|
+
enableWatcher: true,
|
|
26
|
+
// Fail build if codegen errors
|
|
27
|
+
throwOnBuild: true,
|
|
28
|
+
}),
|
|
29
|
+
],
|
|
30
|
+
|
|
31
|
+
// Build configuration for MPA
|
|
32
|
+
build: {
|
|
33
|
+
outDir: resolve(__dirname, 'dist'),
|
|
34
|
+
assetsDir: 'assets',
|
|
35
|
+
sourcemap: false,
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
// Resolve aliases (shared between build and test)
|
|
39
|
+
resolve: {
|
|
40
|
+
dedupe: ['react', 'react-dom'],
|
|
41
|
+
alias: {
|
|
42
|
+
'@': path.resolve(__dirname, './src'),
|
|
43
|
+
'@api': path.resolve(__dirname, './src/api'),
|
|
44
|
+
'@components': path.resolve(__dirname, './src/components'),
|
|
45
|
+
'@utils': path.resolve(__dirname, './src/utils'),
|
|
46
|
+
'@styles': path.resolve(__dirname, './src/styles'),
|
|
47
|
+
'@assets': path.resolve(__dirname, './src/assets'),
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
|
|
51
|
+
// Vitest configuration
|
|
52
|
+
test: {
|
|
53
|
+
// Override root for tests (build uses src/pages as root)
|
|
54
|
+
root: resolve(__dirname),
|
|
55
|
+
|
|
56
|
+
// Use jsdom environment for React component testing
|
|
57
|
+
environment: 'jsdom',
|
|
58
|
+
|
|
59
|
+
// Setup files to run before each test
|
|
60
|
+
setupFiles: ['./src/test/setup.ts'],
|
|
61
|
+
|
|
62
|
+
// Global test patterns
|
|
63
|
+
include: [
|
|
64
|
+
'src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}',
|
|
65
|
+
'src/**/__tests__/**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}',
|
|
66
|
+
],
|
|
67
|
+
|
|
68
|
+
// Coverage configuration
|
|
69
|
+
coverage: {
|
|
70
|
+
provider: 'v8',
|
|
71
|
+
reporter: ['text', 'html', 'clover', 'json'],
|
|
72
|
+
exclude: [
|
|
73
|
+
'node_modules/',
|
|
74
|
+
'src/test/',
|
|
75
|
+
'src/**/*.d.ts',
|
|
76
|
+
'src/main.tsx',
|
|
77
|
+
'src/vite-env.d.ts',
|
|
78
|
+
'src/components/**/index.ts',
|
|
79
|
+
'**/*.config.ts',
|
|
80
|
+
'build/',
|
|
81
|
+
'dist/',
|
|
82
|
+
'coverage/',
|
|
83
|
+
'eslint.config.js',
|
|
84
|
+
],
|
|
85
|
+
thresholds: {
|
|
86
|
+
global: {
|
|
87
|
+
branches: 85,
|
|
88
|
+
functions: 85,
|
|
89
|
+
lines: 85,
|
|
90
|
+
statements: 85,
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
|
|
95
|
+
// Test timeout
|
|
96
|
+
testTimeout: 10000,
|
|
97
|
+
|
|
98
|
+
// Globals for easier testing
|
|
99
|
+
globals: true,
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom/vitest';
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@salesforce/webapp-template-base-sfdx-project-experimental",
|
|
3
|
+
"version": "1.48.2",
|
|
4
|
+
"description": "Base SFDX project template",
|
|
5
|
+
"private": true,
|
|
6
|
+
"files": [
|
|
7
|
+
"dist"
|
|
8
|
+
],
|
|
9
|
+
"scripts": {
|
|
10
|
+
"build": "echo 'No build required for base-sfdx-project'",
|
|
11
|
+
"clean": "echo 'No clean required for base-sfdx-project'",
|
|
12
|
+
"lint": "eslint **/{aura,lwc}/**/*.js",
|
|
13
|
+
"test": "npm run test:unit",
|
|
14
|
+
"test:coverage": "npm run test",
|
|
15
|
+
"test:unit": "sfdx-lwc-jest -- --passWithNoTests",
|
|
16
|
+
"test:unit:watch": "sfdx-lwc-jest --watch",
|
|
17
|
+
"test:unit:debug": "sfdx-lwc-jest --debug",
|
|
18
|
+
"test:unit:coverage": "sfdx-lwc-jest --coverage",
|
|
19
|
+
"prettier": "prettier --write \"**/*.{cls,cmp,component,css,html,js,json,md,page,trigger,xml,yaml,yml}\"",
|
|
20
|
+
"prettier:verify": "prettier --check \"**/*.{cls,cmp,component,css,html,js,json,md,page,trigger,xml,yaml,yml}\"",
|
|
21
|
+
"precommit": "lint-staged"
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@lwc/eslint-plugin-lwc": "^2.0.0",
|
|
25
|
+
"@prettier/plugin-xml": "^3.2.2",
|
|
26
|
+
"@salesforce/eslint-config-lwc": "^3.2.3",
|
|
27
|
+
"@salesforce/eslint-plugin-aura": "^2.0.0",
|
|
28
|
+
"@salesforce/eslint-plugin-lightning": "^1.0.0",
|
|
29
|
+
"@salesforce/sfdx-lwc-jest": "^7.0.1",
|
|
30
|
+
"eslint": "8.57.1",
|
|
31
|
+
"eslint-plugin-import": "^2.25.4",
|
|
32
|
+
"eslint-plugin-jest": "^28.8.1",
|
|
33
|
+
"husky": "^9.1.5",
|
|
34
|
+
"lint-staged": "^15.1.0",
|
|
35
|
+
"prettier": "^3.1.0",
|
|
36
|
+
"prettier-plugin-apex": "^2.0.1"
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Use .apex files to store anonymous Apex.
|
|
2
|
+
// You can execute anonymous Apex in VS Code by selecting the
|
|
3
|
+
// apex text and running the command:
|
|
4
|
+
// SFDX: Execute Anonymous Apex with Currently Selected Text
|
|
5
|
+
// You can also execute the entire file by running the command:
|
|
6
|
+
// SFDX: Execute Anonymous Apex with Editor Contents
|
|
7
|
+
|
|
8
|
+
string tempvar = 'Enter_your_name_here';
|
|
9
|
+
System.debug('Hello World!');
|
|
10
|
+
System.debug('My name is ' + tempvar);
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# A4D Rules Index
|
|
2
|
+
|
|
3
|
+
Rules in this folder guide the agent for this SFDX project. **Knowledge** (expert content) lives in the **local-expert MCP** repo (e.g. `local-expert-mcp`); rules here reference when to call which expert.
|
|
4
|
+
|
|
5
|
+
## Always-apply rules (MUST follow)
|
|
6
|
+
|
|
7
|
+
| File | Purpose |
|
|
8
|
+
|------|--------|
|
|
9
|
+
| **webapp.md** | Main web app rules: invoke local-expert MCP (`webapplications-design-system` + `webapplications`), no `node -e`, React/SFDX workflow; **replace default boilerplate**; **populate home page**; **frontend aesthetics**—avoid AI slop, follow design-system expert. |
|
|
10
|
+
| **webapp-no-node-e.md** | No `node -e` for any file/config/shell work; use `replace_in_file` or `write_to_file` only. |
|
|
11
|
+
| **a4d-webapp-generate.md** | Before `sf webapp generate`: call `get_expert_knowledge` with `webapplications-design-system` and `webapplications`; then run CLI. |
|
|
12
|
+
| **webapp-ui-first.md** | Build UI (layout, components, styling) first; then implement business logic (APIs, state, handlers). |
|
|
13
|
+
| **webapp-nav-and-placeholders.md** | **Build navigation into the app layout** (`appLayout.tsx`). Always update nav menu (app-specific items/labels) and placeholder name/design (header/nav/footer/title). Often missed—mandatory. |
|
|
14
|
+
|
|
15
|
+
## Context-specific rules (by file pattern or topic)
|
|
16
|
+
|
|
17
|
+
| File | Purpose |
|
|
18
|
+
|------|--------|
|
|
19
|
+
| **react.md** | React web app structure, shadcn/Tailwind, data access, security; edit `appLayout.tsx` when changing layout. |
|
|
20
|
+
| **ui-layout.md** | When changing UI/nav/header/footer/sidebar/theme, always update `appLayout.tsx`. |
|
|
21
|
+
| **code-quality.md** | ESLint, Prettier, import order, naming, lint/build before completion; no `node -e`. |
|
|
22
|
+
| **build-validation.md** | `npm run build` must succeed from web app dir before completing. |
|
|
23
|
+
| **typescript.md** | TypeScript strictness, return types, interfaces. |
|
|
24
|
+
| **images.md** | Images: Unsplash default, CSP, alt text, error handling. |
|
|
25
|
+
| **react_image_processing.md** | Image handling (Unsplash, CSP, accessibility) for React components. |
|
|
26
|
+
| **graphql/** | GraphQL tools and knowledge (schemas, LDS guides). |
|
|
27
|
+
|
|
28
|
+
## Knowledge repository (experts)
|
|
29
|
+
|
|
30
|
+
Expert knowledge is served by the **local-expert MCP** (e.g. at `local-expert-mcp`). The agent must call **`get_expert_knowledge`** with the appropriate topic:
|
|
31
|
+
|
|
32
|
+
- **webapplications-design-system** — Always use for web app UI/design work (design system, typography, color, motion).
|
|
33
|
+
- **webapplications** — Use for app generation and structure; then call sub-topics as needed (e.g. `webapplications-best-practice`, `webapplications-feature-*`).
|
|
34
|
+
|
|
35
|
+
See the MCP repo's **rule-expert-mcp.md** for full topic list and when to call which expert.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: A4D rule — call expert MCP (webapplications + webapplications-design-system) before sf webapp generate
|
|
3
|
+
alwaysApply: true
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# A4D Rule: Before `sf webapp generate`
|
|
7
|
+
|
|
8
|
+
Before running **`sf webapp generate`**, you **must**:
|
|
9
|
+
|
|
10
|
+
1. **Call the expert MCP** (`get_expert_knowledge`) with topic **`webapplications-design-system`** — always invoke this expert for UI/design direction.
|
|
11
|
+
2. **Call the expert MCP** with topic **`webapplications`** to get generation and structure guidance.
|
|
12
|
+
3. Follow the instructions from the MCP responses.
|
|
13
|
+
4. Only after that, run `sf webapp generate` (e.g. `sf webapp generate -n <AppName> -t <template>`).
|
|
14
|
+
|
|
15
|
+
**Webapp name (`-n` / `<AppName>`):** Must be **alphanumerical only**—no spaces, hyphens, underscores, or other special characters. Use only letters (A–Z, a–z) and digits (0–9). If the desired name has spaces or special characters, use a single alphanumeric word (e.g. `CoffeeBoutique` instead of `Coffee Boutique` or `coffee-boutique`).
|
|
16
|
+
|
|
17
|
+
Do not run `sf webapp generate` without having invoked the expert MCP with **`webapplications-design-system`** and **`webapplications`** first.
|
|
18
|
+
|
|
19
|
+
When modifying an existing web app (UI, layout, or new features), **always** call `get_expert_knowledge` with topic **`webapplications-design-system`** before making UI or design changes.
|
|
20
|
+
|
|
21
|
+
**After generating (or when touching a new app):** Replace all default boilerplate content (e.g. "React App", "Vite + React", default document title in `index.html`, placeholder text in the shell) with the actual app name or user-facing copy. Do not leave generic template text in the UI or `<title>`.
|
|
22
|
+
|
|
23
|
+
**Home page content:** Populate the home page (root route) with real, app-specific content (e.g. landing section, banners, tiles, hero, links to features). Never leave the home page as the default template or placeholder.
|
|
24
|
+
|
|
25
|
+
**Navigation menu and placeholder name/design:** After generating or when delivering a web app, **you must** (1) **Edit the navigation menu** in `appLayout.tsx`: replace every default nav item and label with app-specific routes and names; do not leave template "Home"/"About" or placeholder links. (2) **Replace the placeholder app name** in the header, nav brand, footer, and `index.html` `<title>` with the actual app name. (3) **Update placeholder design** in the shell (header/footer/branding) so it is not the template default. See **webapp-nav-and-placeholders.md**. Agents often skip this—do not.
|
|
26
|
+
|
|
27
|
+
Prioritize webapplications generation first, and then generate the metadata.
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# AI Rule: Build Validation
|
|
2
|
+
|
|
3
|
+
Build validation for successful deployments with minimal friction.
|
|
4
|
+
|
|
5
|
+
## Targets
|
|
6
|
+
- `force-app/main/default/webapplications/*/**/*`
|
|
7
|
+
- `**/*.{js,ts,jsx,tsx}`
|
|
8
|
+
|
|
9
|
+
## MANDATORY: Build Success
|
|
10
|
+
|
|
11
|
+
**Before completing any coding session** (from the web app directory `force-app/main/default/webapplications/<appName>/`):
|
|
12
|
+
```bash
|
|
13
|
+
npm run build # MUST succeed with no errors
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Quick Quality Checks
|
|
17
|
+
Run from the web app directory (`force-app/main/default/webapplications/<appName>/`):
|
|
18
|
+
```bash
|
|
19
|
+
npm run lint # ESLint; fix issues before completing
|
|
20
|
+
npm run build # Runs tsc -b && vite build; catches TypeScript and build issues
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Requirements
|
|
24
|
+
|
|
25
|
+
**Must Pass:**
|
|
26
|
+
- `npm run build` completes successfully
|
|
27
|
+
- No TypeScript compilation errors
|
|
28
|
+
- No critical ESLint errors
|
|
29
|
+
|
|
30
|
+
**Can Be Warnings:**
|
|
31
|
+
- ESLint warnings
|
|
32
|
+
- Minor TypeScript warnings
|
|
33
|
+
|
|
34
|
+
## Fix Commands (when available in the web app's package.json)
|
|
35
|
+
```bash
|
|
36
|
+
npm run lint # Run ESLint (always available)
|
|
37
|
+
# If your project adds Prettier/format scripts, use those before completing
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Workflow
|
|
41
|
+
|
|
42
|
+
**During Development:**
|
|
43
|
+
1. Write code with AI assistance
|
|
44
|
+
2. Save frequently (auto-format on save)
|
|
45
|
+
3. Check periodically: `npm run lint` (optional)
|
|
46
|
+
|
|
47
|
+
**Before Completion:**
|
|
48
|
+
1. Run `npm run build` from the web app directory
|
|
49
|
+
2. If it fails: fix TypeScript/ESLint errors (run `npm run lint`), then retry build
|
|
50
|
+
|
|
51
|
+
## Error Priority
|
|
52
|
+
|
|
53
|
+
**Fix Immediately:**
|
|
54
|
+
- TypeScript compilation errors
|
|
55
|
+
- Import/export errors
|
|
56
|
+
- Syntax errors
|
|
57
|
+
|
|
58
|
+
**Fix When Convenient:**
|
|
59
|
+
- ESLint warnings
|
|
60
|
+
- Unused variables
|
|
61
|
+
|
|
62
|
+
## Hard Requirements
|
|
63
|
+
- Build must complete without errors
|
|
64
|
+
- No broken imports
|
|
65
|
+
- Basic TypeScript type safety
|
|
66
|
+
|
|
67
|
+
## Key Commands (web app directory)
|
|
68
|
+
```bash
|
|
69
|
+
npm run start # Start development server (vite)
|
|
70
|
+
npm run build # TypeScript + Vite build; check deployment readiness
|
|
71
|
+
npm run lint # Run ESLint
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Troubleshooting Import Errors
|
|
75
|
+
```bash
|
|
76
|
+
npm install # Check missing dependencies
|
|
77
|
+
# Verify file exists, case sensitivity, export/import match
|
|
78
|
+
```
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
# AI Rule: Code Quality Standards
|
|
2
|
+
|
|
3
|
+
Enforces ESLint, Prettier, and coding best practices for consistent, maintainable code.
|
|
4
|
+
|
|
5
|
+
**Execution rule:** Do not use `node -e` for any file or config edits. Use `replace_in_file` or `write_to_file` only (see **webapp-no-node-e.md**).
|
|
6
|
+
|
|
7
|
+
## Targets
|
|
8
|
+
- `force-app/main/default/webapplications/*/**/*`
|
|
9
|
+
- `**/*.{js,ts,jsx,tsx,json,md}`
|
|
10
|
+
|
|
11
|
+
## MANDATORY Checks
|
|
12
|
+
|
|
13
|
+
**Before completing code** (run from the web app directory `force-app/main/default/webapplications/<appName>/`):
|
|
14
|
+
```bash
|
|
15
|
+
npm run lint # MUST result in: 0 errors (0 warnings preferred)
|
|
16
|
+
npm run build # MUST succeed (includes TypeScript check)
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
If your project adds Prettier, use a consistent config (e.g. `.prettierrc` with `semi`, `singleQuote`, `printWidth`, etc.) and run format checks before completing.
|
|
20
|
+
|
|
21
|
+
## Lint / Fix
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npm run lint # Run ESLint (always available in the template web app)
|
|
25
|
+
# Use your editor's format-on-save or add npm scripts for Prettier if desired
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Import Order (MANDATORY)
|
|
29
|
+
```typescript
|
|
30
|
+
// 1. React ecosystem
|
|
31
|
+
import { useState, useEffect } from 'react';
|
|
32
|
+
|
|
33
|
+
// 2. External libraries (alphabetical)
|
|
34
|
+
import axios from 'axios';
|
|
35
|
+
import clsx from 'clsx';
|
|
36
|
+
|
|
37
|
+
// 3. UI components (alphabetical)
|
|
38
|
+
import { Button } from '@/components/ui/button';
|
|
39
|
+
import { Card } from '@/components/ui/card';
|
|
40
|
+
|
|
41
|
+
// 4. Internal utilities (alphabetical)
|
|
42
|
+
import { useAuth } from '../hooks/useAuth';
|
|
43
|
+
import { formatDate } from '../utils/dateUtils';
|
|
44
|
+
|
|
45
|
+
// 5. Relative imports
|
|
46
|
+
import { ComponentA } from './ComponentA';
|
|
47
|
+
|
|
48
|
+
// 6. Type imports (separate, at end)
|
|
49
|
+
import type { User, ApiResponse } from '../types';
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Naming Conventions
|
|
53
|
+
```typescript
|
|
54
|
+
// PascalCase: Components, classes
|
|
55
|
+
const UserProfile = () => {};
|
|
56
|
+
const ApiClient = class {};
|
|
57
|
+
|
|
58
|
+
// camelCase: Variables, functions, properties
|
|
59
|
+
const userName = 'john';
|
|
60
|
+
const fetchUserData = async () => {};
|
|
61
|
+
|
|
62
|
+
// SCREAMING_SNAKE_CASE: Constants
|
|
63
|
+
const API_BASE_URL = 'https://api.example.com';
|
|
64
|
+
|
|
65
|
+
// kebab-case: Files
|
|
66
|
+
// user-profile.tsx, api-client.ts
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## React Component Structure
|
|
70
|
+
```typescript
|
|
71
|
+
interface ComponentProps {
|
|
72
|
+
// Props interface first
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const Component: React.FC<ComponentProps> = ({ prop1, prop2 }) => {
|
|
76
|
+
// 1. Hooks
|
|
77
|
+
// 2. Computed values
|
|
78
|
+
// 3. Event handlers
|
|
79
|
+
// 4. JSX return
|
|
80
|
+
|
|
81
|
+
return <div />;
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
export default Component;
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## JSX Standards
|
|
88
|
+
```typescript
|
|
89
|
+
// Self-closing tags
|
|
90
|
+
<Button onClick={handleClick} />
|
|
91
|
+
|
|
92
|
+
// Conditional rendering
|
|
93
|
+
{isLoading && <Spinner />}
|
|
94
|
+
{error ? <ErrorMessage error={error} /> : <Content />}
|
|
95
|
+
|
|
96
|
+
// Lists with keys
|
|
97
|
+
{items.map(item => <Item key={item.id} data={item} />)}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Error Handling
|
|
101
|
+
```typescript
|
|
102
|
+
// Async functions with try-catch
|
|
103
|
+
const fetchData = async (id: string): Promise<Data> => {
|
|
104
|
+
try {
|
|
105
|
+
const response = await api.get(`/data/${id}`);
|
|
106
|
+
return response.data;
|
|
107
|
+
} catch (error) {
|
|
108
|
+
console.error('Failed to fetch data:', error);
|
|
109
|
+
throw error;
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Anti-Patterns (FORBIDDEN)
|
|
115
|
+
```typescript
|
|
116
|
+
// NEVER disable ESLint without justification
|
|
117
|
+
// eslint-disable-next-line
|
|
118
|
+
|
|
119
|
+
// NEVER mutate state directly
|
|
120
|
+
state.items.push(newItem); // Wrong
|
|
121
|
+
setItems(prev => [...prev, newItem]); // Correct
|
|
122
|
+
|
|
123
|
+
// NEVER use magic numbers/strings
|
|
124
|
+
setTimeout(() => {}, 5000); // Wrong
|
|
125
|
+
const DEBOUNCE_DELAY = 5000; // Correct
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Quality Workflow
|
|
129
|
+
|
|
130
|
+
**Before Committing:**
|
|
131
|
+
1. `npm run lint` - 0 errors (and 0 warnings when possible)
|
|
132
|
+
2. `npm run build` - Build must succeed (TypeScript + Vite)
|
|
133
|
+
|
|
134
|
+
## Zero Tolerance Policy
|
|
135
|
+
- ESLint errors: MUST be 0
|
|
136
|
+
- ESLint warnings: MUST be 0 (fix when convenient)
|
|
137
|
+
- TypeScript errors: MUST be 0 (enforced by `npm run build`)
|