forked from forcedotcom/salesforcedx-templates
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvisualforcePageGenerator.ts
More file actions
35 lines (32 loc) · 1.17 KB
/
Copy pathvisualforcePageGenerator.ts
File metadata and controls
35 lines (32 loc) · 1.17 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
/*
* Copyright (c) 2020, 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 { VisualforcePageOptions } from '../utils/types';
import { BaseGenerator } from './baseGenerator';
export default class VisualforcePageGenerator extends BaseGenerator<VisualforcePageOptions> {
public validateOptions(): void {
CreateUtil.checkInputs(this.options.pagename);
CreateUtil.checkInputs(this.options.template);
}
public async generate(): Promise<void> {
const { template, label, pagename } = this.options;
this.sourceRootWithPartialPath('visualforcepage');
await this.render(
this.templatePath(`${template}.page`),
this.destinationPath(path.join(this.outputdir, `${pagename}.page`)),
{}
);
await this.render(
this.templatePath('_page.page-meta.xml'),
this.destinationPath(
path.join(this.outputdir, `${pagename}.page-meta.xml`)
),
{ vfLabel: label, apiVersion: this.apiversion }
);
}
}