Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions messages/ui-bundle.generate.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ Use the --template flag for generating the files to get started with a specific

<%= config.bin %> <%= command.id %> --name MyAngularApp --template angularbasic

- Generate a Vue-based UI bundle:

<%= config.bin %> <%= command.id %> --name MyVueApp --template vuebasic

- Generate the React-based UI bundle in the "force-app/main/default/uiBundles" directory:

<%= config.bin %> <%= command.id %> --name MyUiBundle --template reactbasic --output-dir force-app/main/default/uiBundles
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"dependencies": {
"@salesforce/core": "^9.2.0",
"@salesforce/sf-plugins-core": "^13.0.5",
"@salesforce/templates": "^66.16.0"
"@salesforce/templates": "^66.17.2"
},
"devDependencies": {
"@oclif/plugin-command-snapshot": "^6.0.0",
Expand Down
2 changes: 1 addition & 1 deletion src/commands/template/generate/ui-bundle/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export default class UiBundleGenerate extends SfCommand<CreateOutput> {
summary: messages.getMessage('flags.template.summary'),
description: messages.getMessage('flags.template.description'),
default: 'default',
options: ['default', 'reactbasic', 'angularbasic'],
options: ['default', 'reactbasic', 'angularbasic', 'vuebasic'],
}),
label: Flags.string({
char: 'l',
Expand Down
1 change: 0 additions & 1 deletion test/commands/template/generate/analytics/template.nut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ describe('template generate analytics template:', () => {
name: 'fooDashboard_tp',
state: {
widgets: {

text_1: {
parameters: {
content: {
Expand Down
51 changes: 51 additions & 0 deletions test/commands/template/generate/ui-bundle/index.nut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,57 @@ describe('template generate ui-bundle:', () => {
});
});

describe('Check UI bundle creation with vuebasic template', () => {
afterEach(() => {
const rootGraphqlrc = path.join(projectDir, '.graphqlrc.yml');
if (fs.existsSync(rootGraphqlrc)) {
fs.unlinkSync(rootGraphqlrc);
}
});

it('should create Vue UI bundle with all required files and create .graphqlrc.yml at the project root', () => {
const outputDir = path.join(projectDir, 'force-app', 'main', 'default', UI_BUNDLES_DIR);
const firstResult = execCmd(
`template generate ui-bundle --name MyVueApp --template vuebasic --output-dir "${outputDir}"`,
{
ensureExitCode: 0,
}
);
assert.file([
path.join(outputDir, 'MyVueApp', 'MyVueApp.uibundle-meta.xml'),
path.join(outputDir, 'MyVueApp', 'index.html'),
path.join(outputDir, 'MyVueApp', 'ui-bundle.json'),
path.join(outputDir, 'MyVueApp', 'package.json'),
]);

const rootGraphqlrc = path.join(projectDir, '.graphqlrc.yml');
assert.file(rootGraphqlrc);
assert.fileContent(rootGraphqlrc, "schema: 'schema.graphql'");
assert.fileContent(rootGraphqlrc, "documents: './**/src/**/*.{graphql,js,ts,jsx,tsx}'");
expect(firstResult.shellOutput.stdout).to.contain('create .graphqlrc.yml');

const contentBefore = fs.readFileSync(rootGraphqlrc, 'utf8');
const mtimeBefore = fs.statSync(rootGraphqlrc).mtimeMs;

const secondResult = execCmd(
`template generate ui-bundle --name MyVueApp2 --template vuebasic --output-dir "${outputDir}"`,
{
ensureExitCode: 0,
}
);
assert.file([
path.join(outputDir, 'MyVueApp2', 'MyVueApp2.uibundle-meta.xml'),
path.join(outputDir, 'MyVueApp2', 'package.json'),
]);
expect(secondResult.shellOutput.stdout).to.not.contain('create .graphqlrc.yml');

const contentAfter = fs.readFileSync(rootGraphqlrc, 'utf8');
const mtimeAfter = fs.statSync(rootGraphqlrc).mtimeMs;
expect(contentAfter).to.equal(contentBefore);
expect(mtimeAfter).to.equal(mtimeBefore);
});
});

describe('Check that all invalid name errors are thrown', () => {
it('should throw a missing name error', () => {
const stderr = execCmd('template generate ui-bundle').shellOutput.stderr;
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1408,10 +1408,10 @@
cli-progress "^3.12.0"
terminal-link "^3.0.0"

"@salesforce/templates@^66.16.0":
version "66.16.0"
resolved "https://registry.yarnpkg.com/@salesforce/templates/-/templates-66.16.0.tgz#afe4e928334cd4553ce93b20957fb186c14de6ec"
integrity sha512-eJyqw9x0gAIl+rhKKeyOJ0lmQrYSHaz932EErn84pugewSYUjvomTgDUjKHqUrqgJA4yOciav8lQ/gkK2sC3AQ==
"@salesforce/templates@^66.17.2":
version "66.17.2"
resolved "https://registry.yarnpkg.com/@salesforce/templates/-/templates-66.17.2.tgz#ba615bc3f2195c93ac5f3f8feaeccb512236914e"
integrity sha512-6TU/NHWVPIgjG4FDwrJ3En+1n3OFRVTEkwWPyh6JSR7LkH/Iwmi1kuHyrHVNi8m0TCJZxBxNrZ2qdrL9CJuOIw==
dependencies:
"@salesforce/kit" "^4.0.0"
ejs "^3.1.10"
Expand Down
Loading