2017-04-28 22:44:23 +00:00
|
|
|
import { Smartfile } from 'smartfile';
|
|
|
|
export interface ScafTemplateContructorOptions {
|
|
|
|
name?: string;
|
|
|
|
description?: string;
|
|
|
|
sourceDir?: string;
|
|
|
|
}
|
|
|
|
export declare class ScafTemplate {
|
|
|
|
name: string;
|
|
|
|
description: string;
|
2017-05-03 07:45:22 +00:00
|
|
|
templateSmartfileArray: Smartfile[];
|
|
|
|
requiredVariables: string[];
|
2017-05-25 16:32:53 +00:00
|
|
|
defaultVariables: any;
|
2017-05-03 07:45:22 +00:00
|
|
|
suppliedVariables: any;
|
|
|
|
missingVariables: string[];
|
2017-04-28 22:44:23 +00:00
|
|
|
/**
|
|
|
|
* read a template from a directory
|
|
|
|
*/
|
2017-05-03 07:45:22 +00:00
|
|
|
readTemplateFromDir(dirPathArg: string): Promise<void>;
|
|
|
|
/**
|
|
|
|
* supply the variables to render the teplate with
|
2017-05-25 16:32:53 +00:00
|
|
|
* @param variablesArg gets merged with this.suppliedVariables
|
2017-05-03 07:45:22 +00:00
|
|
|
*/
|
|
|
|
supplyVariables(variablesArg: any): Promise<void>;
|
2017-05-06 23:23:03 +00:00
|
|
|
/**
|
|
|
|
* Will ask for the missing variables by cli interaction
|
|
|
|
*/
|
|
|
|
askCliForMissingVariables(): Promise<void>;
|
2017-05-26 13:32:50 +00:00
|
|
|
writeToDisk(destinationDirArg: any): Promise<void>;
|
2017-04-28 22:44:23 +00:00
|
|
|
/**
|
2017-05-25 16:32:53 +00:00
|
|
|
* finds all variables in a Template in as string
|
|
|
|
* e.g. myobject.someKey and myobject.someOtherKey
|
2017-04-28 22:44:23 +00:00
|
|
|
*/
|
|
|
|
private _findVariablesInTemplate();
|
|
|
|
/**
|
|
|
|
* checks if supplied Variables satisfy the template
|
|
|
|
*/
|
2017-05-06 23:23:03 +00:00
|
|
|
private _checkSuppliedVariables();
|
2017-05-25 16:32:53 +00:00
|
|
|
/**
|
|
|
|
* checks the default.yml at the root of a template for default variables
|
|
|
|
* allows 2 ways of notation in YAML:
|
|
|
|
* >> myObject.myKey.someDeeperKey: someValue
|
|
|
|
* >> myObject.yourKey.yourDeeperKey: yourValue
|
|
|
|
* or
|
|
|
|
* >> myObject:
|
|
|
|
* >> - someKey:
|
|
|
|
* >> - someDeeperKey: someValue
|
|
|
|
* >> - yourKey:
|
|
|
|
* >> - yourDeeperKey: yourValue
|
|
|
|
*/
|
|
|
|
private _checkDefaultVariables();
|
2017-04-28 22:44:23 +00:00
|
|
|
}
|