Skip to content

Commit e6a37c6

Browse files
authored
Merge pull request #859 from salesforcecli/kj/adding-webapp-project-generate-1
@W-21338760 adding webapp project generate
2 parents d4bb3ee + 93ca7f8 commit e6a37c6

5 files changed

Lines changed: 54 additions & 8 deletions

File tree

messages/project.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ The standard template provides a complete force-app directory structure so you k
5858

5959
The analytics template provides similar files and the force-app/main/default/waveTemplates directory.
6060

61+
The reactb2e and reactb2x templates provide React-based project scaffolding for B2E and B2X web application use cases.
62+
6163
# flags.namespace.summary
6264

6365
Namespace associated with this project and any connected scratch orgs.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"dependencies": {
1010
"@salesforce/core": "^8.26.2",
1111
"@salesforce/sf-plugins-core": "^12",
12-
"@salesforce/templates": "^65.5.11"
12+
"@salesforce/templates": "^66.2.1"
1313
},
1414
"devDependencies": {
1515
"@oclif/plugin-command-snapshot": "^5.3.9",

src/commands/template/generate/project/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export default class Project extends SfCommand<CreateOutput> {
3333
summary: messages.getMessage('flags.template.summary'),
3434
description: messages.getMessage('flags.template.description'),
3535
default: 'standard',
36-
options: ['standard', 'empty', 'analytics'] as const,
36+
options: ['standard', 'empty', 'analytics', 'reactb2e', 'reactb2x'] as const,
3737
})(),
3838
'output-dir': outputDirFlag,
3939
namespace: Flags.string({

test/commands/template/generate/project/index.nut.ts

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,50 @@ describe('template generate project:', () => {
231231
assert.file([path.join(session.project.dir, 'analytics1', 'eslint.config.js')]);
232232
assert.file([path.join(session.project.dir, 'analytics1', 'eslint.config.js')]);
233233
});
234+
235+
it('should create project with reactb2e template', () => {
236+
const projectName = 'react-b2e-test';
237+
const alphanumericName = 'reactb2etest';
238+
execCmd(`template generate project --projectname ${projectName} --template reactb2e`, {
239+
ensureExitCode: 0,
240+
});
241+
const projectDir = path.join(session.project.dir, projectName);
242+
assert.file([path.join(projectDir, 'sfdx-project.json')]);
243+
assert.fileContent(path.join(projectDir, 'sfdx-project.json'), 'sourceApiVersion');
244+
const webappMetaPath = path.join(
245+
projectDir,
246+
'force-app',
247+
'main',
248+
'default',
249+
'webapplications',
250+
alphanumericName,
251+
`${alphanumericName}.webapplication-meta.xml`
252+
);
253+
assert.file([webappMetaPath]);
254+
assert.fileContent(webappMetaPath, alphanumericName);
255+
});
256+
257+
it('should create project with reactb2x template', () => {
258+
const projectName = 'react-b2x-test';
259+
const alphanumericName = 'reactb2xtest';
260+
execCmd(`template generate project --projectname ${projectName} --template reactb2x`, {
261+
ensureExitCode: 0,
262+
});
263+
const projectDir = path.join(session.project.dir, projectName);
264+
assert.file([path.join(projectDir, 'sfdx-project.json')]);
265+
assert.fileContent(path.join(projectDir, 'sfdx-project.json'), 'sourceApiVersion');
266+
const webappMetaPath = path.join(
267+
projectDir,
268+
'force-app',
269+
'main',
270+
'default',
271+
'webapplications',
272+
alphanumericName,
273+
`${alphanumericName}.webapplication-meta.xml`
274+
);
275+
assert.file([webappMetaPath]);
276+
assert.fileContent(webappMetaPath, alphanumericName);
277+
});
234278
});
235279

236280
describe('project creation failures', () => {

yarn.lock

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1953,18 +1953,18 @@
19531953
cli-progress "^3.12.0"
19541954
terminal-link "^3.0.0"
19551955

1956-
"@salesforce/templates@^65.5.11":
1957-
version "65.5.11"
1958-
resolved "https://registry.yarnpkg.com/@salesforce/templates/-/templates-65.5.11.tgz#cdc4cce1e4dcab0c8884d0711d10644bd0a9d007"
1959-
integrity sha512-dBw3MCnzCrpQNIXaxkFj8ZYU+4yx+uxpoWiDnCS/wqN3I9GaHOOni0UgtrCFTdHIhQP2a4EW+mcbwF9DLQAU4Q==
1956+
"@salesforce/templates@^66.2.1":
1957+
version "66.2.1"
1958+
resolved "https://registry.yarnpkg.com/@salesforce/templates/-/templates-66.2.1.tgz#cb38cb60088f9e3a3d936930c45e2d825f425a56"
1959+
integrity sha512-y39+Jyjsa/7+MwtyMCrryirWXiMCnSt2Nkm3AXDvt2bOKHlHeTBkM7/qEp1g94qgoLJO5lHBD2XExk7sTaSCHw==
19601960
dependencies:
19611961
"@salesforce/kit" "^3.2.4"
19621962
ejs "^3.1.10"
19631963
got "^11.8.6"
19641964
hpagent "^1.2.0"
19651965
mime-types "^3.0.2"
19661966
proxy-from-env "^1.1.0"
1967-
tar "^7.5.8"
1967+
tar "^7.5.9"
19681968
tslib "^2.8.1"
19691969

19701970
"@salesforce/ts-types@^2.0.11", "@salesforce/ts-types@^2.0.12":
@@ -7738,7 +7738,7 @@ supports-preserve-symlinks-flag@^1.0.0:
77387738
resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz"
77397739
integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==
77407740

7741-
tar@^7.5.8:
7741+
tar@^7.5.9:
77427742
version "7.5.9"
77437743
resolved "https://registry.yarnpkg.com/tar/-/tar-7.5.9.tgz#817ac12a54bc4362c51340875b8985d7dc9724b8"
77447744
integrity sha512-BTLcK0xsDh2+PUe9F6c2TlRp4zOOBMTkoQHQIWSIzI0R7KG46uEwq4OPk2W7bZcprBMsuaeFsqwYr7pjh6CuHg==

0 commit comments

Comments
 (0)