update
This commit is contained in:
15
dist/smartscaf.classes.smartscaf.d.ts
vendored
15
dist/smartscaf.classes.smartscaf.d.ts
vendored
@ -7,14 +7,19 @@ export interface ScafTemplateContructorOptions {
|
||||
export declare class ScafTemplate {
|
||||
name: string;
|
||||
description: string;
|
||||
templateObject: Smartfile[];
|
||||
requiredVariables: any[];
|
||||
constructor();
|
||||
templateSmartfileArray: Smartfile[];
|
||||
requiredVariables: string[];
|
||||
suppliedVariables: any;
|
||||
missingVariables: string[];
|
||||
/**
|
||||
* read a template from a directory
|
||||
*/
|
||||
readTemplateFromDir(dirArg: string): Promise<void>;
|
||||
writeWithVariables(variablesArg: any): Promise<void>;
|
||||
readTemplateFromDir(dirPathArg: string): Promise<void>;
|
||||
/**
|
||||
* supply the variables to render the teplate with
|
||||
* @param variablesArg
|
||||
*/
|
||||
supplyVariables(variablesArg: any): Promise<void>;
|
||||
/**
|
||||
* finds all variables in a Template
|
||||
*/
|
||||
|
30
dist/smartscaf.classes.smartscaf.js
vendored
30
dist/smartscaf.classes.smartscaf.js
vendored
@ -10,18 +10,27 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const plugins = require("./smartscaf.plugins");
|
||||
class ScafTemplate {
|
||||
constructor() { }
|
||||
constructor() {
|
||||
this.missingVariables = [];
|
||||
}
|
||||
/**
|
||||
* read a template from a directory
|
||||
*/
|
||||
readTemplateFromDir(dirArg) {
|
||||
readTemplateFromDir(dirPathArg) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
this.templateObject = yield plugins.smartfile.fs.fileTreeToObject(dirArg, '**/*');
|
||||
let dirPath = plugins.path.resolve(dirPathArg);
|
||||
this.templateSmartfileArray = yield plugins.smartfile.fs.fileTreeToObject(dirPath, '**/*');
|
||||
this._findVariablesInTemplate();
|
||||
});
|
||||
}
|
||||
writeWithVariables(variablesArg) {
|
||||
/**
|
||||
* supply the variables to render the teplate with
|
||||
* @param variablesArg
|
||||
*/
|
||||
supplyVariables(variablesArg) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
yield this._checkSuppliedVariables(variablesArg);
|
||||
this.suppliedVariables = variablesArg;
|
||||
this.missingVariables = yield this._checkSuppliedVariables(variablesArg);
|
||||
});
|
||||
}
|
||||
/**
|
||||
@ -29,6 +38,8 @@ class ScafTemplate {
|
||||
*/
|
||||
_findVariablesInTemplate() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
for (let localSmartfile of this.templateSmartfileArray) {
|
||||
}
|
||||
});
|
||||
}
|
||||
/**
|
||||
@ -36,8 +47,15 @@ class ScafTemplate {
|
||||
*/
|
||||
_checkSuppliedVariables(variablesArg) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let missingVars = [];
|
||||
for (let templateSmartFile of this.templateSmartfileArray) {
|
||||
console.log(templateSmartFile);
|
||||
let localMissingVars = yield plugins.smarthbs.checkVarsSatisfaction(templateSmartFile.contents.toString(), variablesArg);
|
||||
missingVars = plugins.lodash.concat(missingVars, localMissingVars);
|
||||
}
|
||||
return missingVars;
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.ScafTemplate = ScafTemplate;
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRzY2FmLmNsYXNzZXMuc21hcnRzY2FmLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnRzY2FmLmNsYXNzZXMuc21hcnRzY2FmLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7QUFBQSwrQ0FBOEM7QUFXOUM7SUFLRSxnQkFBZSxDQUFDO0lBRWhCOztPQUVHO0lBQ0csbUJBQW1CLENBQUUsTUFBYzs7WUFDdkMsSUFBSSxDQUFDLGNBQWMsR0FBRyxNQUFNLE9BQU8sQ0FBQyxTQUFTLENBQUMsRUFBRSxDQUFDLGdCQUFnQ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QyxpQkFBaUIsR0FBRyxZQUFZLENBQUE7WUFDckMsSUFBSSxDQUFDLGdCQUFnQixHQUFHLE1BQU0sSUFBSSxDQUFDLHVCQUF1QixDQUFDLFlBQVksQ0FBQyxDQUFBO1FBQzFFLENBQUM7S0FBQTtJQUVEOztPQUVHO0lBQ1csd0JBQXdCOztZQUNwQyxHQUFHLENBQUMsQ0FBQyxJQUFJLGNBQWMsSUFBSSxJQUFJLENBQUMsc0JBQXNCLENBQUMsQ0FBQyxDQUFDO1lBRXpELENBQUM7UUFDSCxDQUFDO0tBQUE7SUFFRDs7T0FFRztJQUNXLHVCQUF1QixDQUFDLFlBQVk7O1lBQ2hELElBQUksV0FBVyxHQUFhLEVBQUUsQ0FBQTtZQUM5QixHQUFHLENBQUMsQ0FBQyxJQUFJLGlCQUFpQixJQUFJLElBQUksQ0FBQyxzQkFBc0IsQ0FBQyxDQUFDLENBQUM7Z0JBQzFELE9BQU8sQ0FBQyxHQUFHLENBQUMsaUJBQWlCLENBQUMsQ0FBQTtnQkFDOUIsSUFBSSxnQkFBZ0IsR0FBRyxNQUFNLE9BQU8sQ0FBQyxRQUFRLENBQUMscUJBQXFCLENBQ2pFLGlCQUFpQixDQUFDLFFBQVEsQ0FBQyxRQUFRLEVBQUUsRUFDckMsWUFBWSxDQUNiLENBQUE7Z0JBQ0QsV0FBVyxHQUFHLE9BQU8sQ0FBQyxNQUFNLENBQUMsTUFBTSxDQUFDLFdBQVcsRUFBRSxnQkFBZ0IsQ0FBQyxDQUFBO1lBQ3BFLENBQUM7WUFFRCxNQUFNLENBQUMsV0FBVyxDQUFBO1FBQ3BCLENBQUM7S0FBQTtDQUNGO0FBbkRELG9DQW1EQyJ9
|
5
dist/smartscaf.plugins.d.ts
vendored
5
dist/smartscaf.plugins.d.ts
vendored
@ -1,4 +1,7 @@
|
||||
import 'typings-global';
|
||||
import * as lodash from 'lodash';
|
||||
import * as path from 'path';
|
||||
import * as smartfile from 'smartfile';
|
||||
import * as smarthbs from 'smarthbs';
|
||||
import * as smartq from 'smartq';
|
||||
export { smartfile, smarthbs, smartq };
|
||||
export { lodash, path, smartfile, smarthbs, smartq };
|
||||
|
7
dist/smartscaf.plugins.js
vendored
7
dist/smartscaf.plugins.js
vendored
@ -1,9 +1,14 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
require("typings-global");
|
||||
const lodash = require("lodash");
|
||||
exports.lodash = lodash;
|
||||
const path = require("path");
|
||||
exports.path = path;
|
||||
const smartfile = require("smartfile");
|
||||
exports.smartfile = smartfile;
|
||||
const smarthbs = require("smarthbs");
|
||||
exports.smarthbs = smarthbs;
|
||||
const smartq = require("smartq");
|
||||
exports.smartq = smartq;
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRzY2FmLnBsdWdpbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydHNjYWYucGx1Z2lucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLHVDQUFzQztBQUtwQyw4QkFBUztBQUpYLHFDQUFvQztBQUtsQyw0QkFBUTtBQUpWLGlDQUFnQztBQUs5Qix3QkFBTSJ9
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRzY2FmLnBsdWdpbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydHNjYWYucGx1Z2lucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDBCQUF1QjtBQUN2QixpQ0FBZ0M7QUFPOUIsd0JBQU07QUFOUiw2QkFBNEI7QUFPMUIsb0JBQUk7QUFOTix1Q0FBc0M7QUFPcEMsOEJBQVM7QUFOWCxxQ0FBb0M7QUFPbEMsNEJBQVE7QUFOVixpQ0FBZ0M7QUFPOUIsd0JBQU0ifQ==
|
Reference in New Issue
Block a user