@salesforce/templates
Version:
Salesforce JS library for templates
50 lines (49 loc) • 1.97 kB
TypeScript
import { CreateOutput, TemplateOptions, TemplateType } from '../utils/types';
/**
* Template Service
*/
export declare class TemplateService {
private static instance;
private adapter;
private env;
constructor(cwd?: string);
/**
* Get an instance of TemplateService
* @param cwd cwd of current yeoman environment. CLI: don't need to set explicitly. VS Code: it's typically the root workspace path
*/
static getInstance(cwd?: string): TemplateService;
/**
* Getting cwd of current yeoman environment
*/
get cwd(): string;
/**
* Setting cwd of current yeoman environment
* In VS Code, it's typically the root workspace path
*/
set cwd(cwd: string);
/**
* Look up package version of @salesforce/templates package to supply a default API version
*/
static getDefaultApiVersion(): string;
/**
* Create using templates
* @param templateType template type
* @param templateOptions template options
* @param customTemplatesRootPathOrGitRepo custom templates root path or git repo. If not specified, use built-in templates
*/
create<TOptions extends TemplateOptions>(templateType: TemplateType, templateOptions: TOptions, customTemplatesRootPathOrGitRepo?: string): Promise<CreateOutput>;
/**
* Local custom templates path set by user
* or set to a local cache of a git repo.
* Used by the generators.
*/
customTemplatesRootPath?: string;
private resetEnv;
/**
* Set custom templates root path or git repo.
* Throws an error if local path doesn't exist or cannot reach git repo.
* @param customTemplatesRootPathOrGitRepo custom templates root path or git repo
* @param forceLoadingRemoteRepo by default do not reload remote repo if the repo is already downloaded
*/
setCustomTemplatesRootPathOrGitRepo(pathOrRepoUri?: string, forceLoadingRemoteRepo?: boolean): Promise<void>;
}