diff --git a/messages/project.md b/messages/project.md index bf525165..9dfef1b3 100644 --- a/messages/project.md +++ b/messages/project.md @@ -58,6 +58,8 @@ The standard template provides a complete force-app directory structure so you k The analytics template provides similar files and the force-app/main/default/waveTemplates directory. +The reactb2e and reactb2x templates provide React-based project scaffolding for B2E and B2X web application use cases. + # flags.namespace.summary Namespace associated with this project and any connected scratch orgs. diff --git a/package.json b/package.json index 21b401cf..e83d91b8 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "dependencies": { "@salesforce/core": "^8.26.2", "@salesforce/sf-plugins-core": "^12", - "@salesforce/templates": "^65.5.11" + "@salesforce/templates": "^66.2.0" }, "devDependencies": { "@oclif/plugin-command-snapshot": "^5.3.9", diff --git a/src/commands/template/generate/project/index.ts b/src/commands/template/generate/project/index.ts index f8bc66bd..ea6bbd04 100644 --- a/src/commands/template/generate/project/index.ts +++ b/src/commands/template/generate/project/index.ts @@ -33,7 +33,7 @@ export default class Project extends SfCommand { summary: messages.getMessage('flags.template.summary'), description: messages.getMessage('flags.template.description'), default: 'standard', - options: ['standard', 'empty', 'analytics'] as const, + options: ['standard', 'empty', 'analytics', 'reactb2e', 'reactb2x'] as const, })(), 'output-dir': outputDirFlag, namespace: Flags.string({ diff --git a/test/commands/template/generate/project/index.nut.ts b/test/commands/template/generate/project/index.nut.ts index 4d71ef9d..efb9bce0 100644 --- a/test/commands/template/generate/project/index.nut.ts +++ b/test/commands/template/generate/project/index.nut.ts @@ -231,6 +231,50 @@ describe('template generate project:', () => { assert.file([path.join(session.project.dir, 'analytics1', 'eslint.config.js')]); assert.file([path.join(session.project.dir, 'analytics1', 'eslint.config.js')]); }); + + it('should create project with reactb2e template', () => { + const projectName = 'react-b2e-test'; + const alphanumericName = 'reactb2etest'; + execCmd(`template generate project --projectname ${projectName} --template reactb2e`, { + ensureExitCode: 0, + }); + const projectDir = path.join(session.project.dir, projectName); + assert.file([path.join(projectDir, 'sfdx-project.json')]); + assert.fileContent(path.join(projectDir, 'sfdx-project.json'), 'sourceApiVersion'); + const webappMetaPath = path.join( + projectDir, + 'force-app', + 'main', + 'default', + 'webapplications', + alphanumericName, + `${alphanumericName}.webapplication-meta.xml` + ); + assert.file([webappMetaPath]); + assert.fileContent(webappMetaPath, alphanumericName); + }); + + it('should create project with reactb2x template', () => { + const projectName = 'react-b2x-test'; + const alphanumericName = 'reactb2xtest'; + execCmd(`template generate project --projectname ${projectName} --template reactb2x`, { + ensureExitCode: 0, + }); + const projectDir = path.join(session.project.dir, projectName); + assert.file([path.join(projectDir, 'sfdx-project.json')]); + assert.fileContent(path.join(projectDir, 'sfdx-project.json'), 'sourceApiVersion'); + const webappMetaPath = path.join( + projectDir, + 'force-app', + 'main', + 'default', + 'webapplications', + alphanumericName, + `${alphanumericName}.webapplication-meta.xml` + ); + assert.file([webappMetaPath]); + assert.fileContent(webappMetaPath, alphanumericName); + }); }); describe('project creation failures', () => { diff --git a/yarn.lock b/yarn.lock index 4484e1bf..e25ae04b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1953,10 +1953,10 @@ cli-progress "^3.12.0" terminal-link "^3.0.0" -"@salesforce/templates@^65.5.11": - version "65.5.11" - resolved "https://registry.yarnpkg.com/@salesforce/templates/-/templates-65.5.11.tgz#cdc4cce1e4dcab0c8884d0711d10644bd0a9d007" - integrity sha512-dBw3MCnzCrpQNIXaxkFj8ZYU+4yx+uxpoWiDnCS/wqN3I9GaHOOni0UgtrCFTdHIhQP2a4EW+mcbwF9DLQAU4Q== +"@salesforce/templates@^66.2.0": + version "66.2.0" + resolved "https://registry.yarnpkg.com/@salesforce/templates/-/templates-66.2.0.tgz#8959b18a89a9b5679f0e5eb1e36cbddd25924da5" + integrity sha512-hOZZUQ2NDR+Z3Ew8m+l21z2zI3yj1rC3WIO4sx4ici8ZXoCNLUEzC0ea6NkJ8g9hIUB1CNBswZizGRjafNN8jA== dependencies: "@salesforce/kit" "^3.2.4" ejs "^3.1.10" @@ -1964,7 +1964,7 @@ hpagent "^1.2.0" mime-types "^3.0.2" proxy-from-env "^1.1.0" - tar "^7.5.8" + tar "^7.5.9" tslib "^2.8.1" "@salesforce/ts-types@^2.0.11", "@salesforce/ts-types@^2.0.12": @@ -7738,7 +7738,7 @@ supports-preserve-symlinks-flag@^1.0.0: resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz" integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w== -tar@^7.5.8: +tar@^7.5.9: version "7.5.9" resolved "https://registry.yarnpkg.com/tar/-/tar-7.5.9.tgz#817ac12a54bc4362c51340875b8985d7dc9724b8" integrity sha512-BTLcK0xsDh2+PUe9F6c2TlRp4zOOBMTkoQHQIWSIzI0R7KG46uEwq4OPk2W7bZcprBMsuaeFsqwYr7pjh6CuHg==