update
This commit is contained in:
parent
0cffae9eaa
commit
c8f6b0296d
1
dist/index.d.ts
vendored
Normal file
1
dist/index.d.ts
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
export * from './smartscaf.classes.smartscaf';
|
7
dist/index.js
vendored
Normal file
7
dist/index.js
vendored
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
"use strict";
|
||||||
|
function __export(m) {
|
||||||
|
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
||||||
|
}
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
__export(require("./smartscaf.classes.smartscaf"));
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQUFBLG1EQUE4QyJ9
|
74
dist/smartscaf.classes.smartscaf.d.ts
vendored
Normal file
74
dist/smartscaf.classes.smartscaf.d.ts
vendored
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
import { Smartfile } from '@pushrocks/smartfile';
|
||||||
|
export interface ScafTemplateContructorOptions {
|
||||||
|
name?: string;
|
||||||
|
description?: string;
|
||||||
|
sourceDir?: string;
|
||||||
|
}
|
||||||
|
export declare class ScafTemplate {
|
||||||
|
static createTemplateFromDir(): Promise<void>;
|
||||||
|
/**
|
||||||
|
* the name of the template
|
||||||
|
*/
|
||||||
|
name: string;
|
||||||
|
/**
|
||||||
|
* the descriptions of the template
|
||||||
|
*/
|
||||||
|
description: string;
|
||||||
|
/**
|
||||||
|
* the location on disk of the template
|
||||||
|
*/
|
||||||
|
dirPath: string;
|
||||||
|
/**
|
||||||
|
* the files of the template as array of Smartfiles
|
||||||
|
*/
|
||||||
|
templateSmartfileArray: Smartfile[];
|
||||||
|
requiredVariables: string[];
|
||||||
|
defaultVariables: any;
|
||||||
|
suppliedVariables: any;
|
||||||
|
missingVariables: string[];
|
||||||
|
constructor(dirPathArg: string);
|
||||||
|
/**
|
||||||
|
* read a template from a directory
|
||||||
|
*/
|
||||||
|
readTemplateFromDir(): Promise<void>;
|
||||||
|
/**
|
||||||
|
* supply the variables to render the teplate with
|
||||||
|
* @param variablesArg gets merged with this.suppliedVariables
|
||||||
|
*/
|
||||||
|
supplyVariables(variablesArg: any): Promise<void>;
|
||||||
|
/**
|
||||||
|
* Will ask for the missing variables by cli interaction
|
||||||
|
*/
|
||||||
|
askCliForMissingVariables(): Promise<void>;
|
||||||
|
/**
|
||||||
|
* writes a file to disk
|
||||||
|
* @param destinationDirArg
|
||||||
|
*/
|
||||||
|
writeToDisk(destinationDirArg: any): Promise<void>;
|
||||||
|
/**
|
||||||
|
* finds all variables in a Template in as string
|
||||||
|
* e.g. myobject.someKey and myobject.someOtherKey
|
||||||
|
*/
|
||||||
|
private _findVariablesInTemplate;
|
||||||
|
/**
|
||||||
|
* checks if supplied Variables satisfy the template
|
||||||
|
*/
|
||||||
|
private _checkSuppliedVariables;
|
||||||
|
/**
|
||||||
|
* checks the smartscaf.yml default values at the root of a template
|
||||||
|
* 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;
|
||||||
|
/**
|
||||||
|
* resolve template dependencies
|
||||||
|
*/
|
||||||
|
private _resolveTemplateDependencies;
|
||||||
|
}
|
180
dist/smartscaf.classes.smartscaf.js
vendored
Normal file
180
dist/smartscaf.classes.smartscaf.js
vendored
Normal file
File diff suppressed because one or more lines are too long
4
dist/smartscaf.helpers.d.ts
vendored
Normal file
4
dist/smartscaf.helpers.d.ts
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
/**
|
||||||
|
* adds a variable in string dot notation to an already more or less expanded object
|
||||||
|
*/
|
||||||
|
export declare let deepAddToObject: (objectArg: any, varStringArg: string, valueArg: string) => Promise<void>;
|
35
dist/smartscaf.helpers.js
vendored
Normal file
35
dist/smartscaf.helpers.js
vendored
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
/**
|
||||||
|
* adds a variable in string dot notation to an already more or less expanded object
|
||||||
|
*/
|
||||||
|
exports.deepAddToObject = async (objectArg, varStringArg, valueArg) => {
|
||||||
|
let varNamesArray = varStringArg.split('.');
|
||||||
|
let referencePointer = objectArg;
|
||||||
|
for (let i = 0; i !== varNamesArray.length; i++) {
|
||||||
|
let varName = varNamesArray[i];
|
||||||
|
// is there a next variable ?
|
||||||
|
let varNameNext = (() => {
|
||||||
|
if (varNamesArray[i + 1]) {
|
||||||
|
return varNamesArray[i + 1];
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
})();
|
||||||
|
// build the tree in suppliedVariables
|
||||||
|
if (!referencePointer[varName] && !varNameNext) {
|
||||||
|
referencePointer[varName] = valueArg;
|
||||||
|
referencePointer = null;
|
||||||
|
}
|
||||||
|
else if (!referencePointer[varName] && varNameNext) {
|
||||||
|
referencePointer[varName] = {};
|
||||||
|
referencePointer = referencePointer[varName];
|
||||||
|
}
|
||||||
|
else if (referencePointer[varName] && varNameNext) {
|
||||||
|
referencePointer = referencePointer[varName];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
throw new Error('Something is strange!');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRzY2FmLmhlbHBlcnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydHNjYWYuaGVscGVycy50c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Z0IsQ0FBQyxPQUFPLENBQUMsQ0FBQztTQUM5QzthQUFNLElBQUksZ0JBQWdCLENBQUMsT0FBTyxDQUFDLElBQUksV0FBVyxFQUFFO1lBQ25ELGdCQUFnQixHQUFHLGdCQUFnQixDQUFDLE9BQU8sQ0FBQyxDQUFDO1NBQzlDO2FBQU07WUFDTCxNQUFNLElBQUksS0FBSyxDQUFDLHVCQUF1QixDQUFDLENBQUM7U0FDMUM7S0FDRjtBQUNILENBQUMsQ0FBQyJ9
|
9
dist/smartscaf.plugins.d.ts
vendored
Normal file
9
dist/smartscaf.plugins.d.ts
vendored
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
import * as path from 'path';
|
||||||
|
import * as lik from '@pushrocks/lik';
|
||||||
|
import * as smartfile from '@pushrocks/smartfile';
|
||||||
|
import * as smartfm from '@pushrocks/smartfm';
|
||||||
|
import * as smarthbs from '@pushrocks/smarthbs';
|
||||||
|
import * as smartinteract from '@pushrocks/smartinteract';
|
||||||
|
import * as smartq from '@pushrocks/smartpromise';
|
||||||
|
import * as smartyaml from '@pushrocks/smartyaml';
|
||||||
|
export { path, lik, smartfile, smartfm, smarthbs, smartinteract, smartq, smartyaml };
|
26
dist/smartscaf.plugins.js
vendored
Normal file
26
dist/smartscaf.plugins.js
vendored
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
"use strict";
|
||||||
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
|
if (mod && mod.__esModule) return mod;
|
||||||
|
var result = {};
|
||||||
|
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||||
|
result["default"] = mod;
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
const path = __importStar(require("path"));
|
||||||
|
exports.path = path;
|
||||||
|
const lik = __importStar(require("@pushrocks/lik"));
|
||||||
|
exports.lik = lik;
|
||||||
|
const smartfile = __importStar(require("@pushrocks/smartfile"));
|
||||||
|
exports.smartfile = smartfile;
|
||||||
|
const smartfm = __importStar(require("@pushrocks/smartfm"));
|
||||||
|
exports.smartfm = smartfm;
|
||||||
|
const smarthbs = __importStar(require("@pushrocks/smarthbs"));
|
||||||
|
exports.smarthbs = smarthbs;
|
||||||
|
const smartinteract = __importStar(require("@pushrocks/smartinteract"));
|
||||||
|
exports.smartinteract = smartinteract;
|
||||||
|
const smartq = __importStar(require("@pushrocks/smartpromise"));
|
||||||
|
exports.smartq = smartq;
|
||||||
|
const smartyaml = __importStar(require("@pushrocks/smartyaml"));
|
||||||
|
exports.smartyaml = smartyaml;
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRzY2FmLnBsdWdpbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydHNjYWYucGx1Z2lucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7QUFBQSwyQ0FBNkI7QUFTcEIsb0JBQUk7QUFSYixvREFBc0M7QUFRdkIsa0JBQUc7QUFQbEIsZ0VBQWtEO0FBTzlCLDhCQUFTO0FBTjdCLDREQUE4QztBQU1mLDBCQUFPO0FBTHRDLDhEQUFnRDtBQUtSLDRCQUFRO0FBSmhELHdFQUEwRDtBQUlSLHNDQUFhO0FBSC9ELGdFQUFrRDtBQUdlLHdCQUFNO0FBRnZFLGdFQUFrRDtBQUV1Qiw4QkFBUyJ9
|
Loading…
Reference in New Issue
Block a user