forked from forcedotcom/salesforcedx-templates
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvisualforceComponentGenerator.ts
More file actions
37 lines (34 loc) · 1.26 KB
/
Copy pathvisualforceComponentGenerator.ts
File metadata and controls
37 lines (34 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*
* Copyright (c) 2019, salesforce.com, inc.
* All rights reserved.
* Licensed under the BSD 3-Clause license.
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/
import * as path from 'path';
import { CreateUtil } from '../utils';
import { VisualforceComponentOptions } from '../utils/types';
import { BaseGenerator } from './baseGenerator';
export default class VisualforceComponentGenerator extends BaseGenerator<VisualforceComponentOptions> {
public validateOptions(): void {
CreateUtil.checkInputs(this.options.componentname);
CreateUtil.checkInputs(this.options.template);
}
public async generate(): Promise<void> {
const { template, label, componentname } = this.options;
this.sourceRootWithPartialPath('visualforcecomponent');
await this.render(
this.templatePath(`${template}.component`),
this.destinationPath(
path.join(this.outputdir, `${componentname}.component`)
),
{}
),
await this.render(
this.templatePath('_component.component-meta.xml'),
this.destinationPath(
path.join(this.outputdir, `${componentname}.component-meta.xml`)
),
{ vfLabel: label, apiVersion: this.apiversion }
);
}
}