now working

This commit is contained in:
Philipp Kunz 2017-05-25 18:32:53 +02:00
parent ddb11fb9b6
commit eac20873e5
13 changed files with 349 additions and 83 deletions

View File

@ -9,6 +9,7 @@ export declare class ScafTemplate {
description: string; description: string;
templateSmartfileArray: Smartfile[]; templateSmartfileArray: Smartfile[];
requiredVariables: string[]; requiredVariables: string[];
defaultVariables: any;
suppliedVariables: any; suppliedVariables: any;
missingVariables: string[]; missingVariables: string[];
/** /**
@ -17,7 +18,7 @@ export declare class ScafTemplate {
readTemplateFromDir(dirPathArg: string): Promise<void>; readTemplateFromDir(dirPathArg: string): Promise<void>;
/** /**
* supply the variables to render the teplate with * supply the variables to render the teplate with
* @param variablesArg * @param variablesArg gets merged with this.suppliedVariables
*/ */
supplyVariables(variablesArg: any): Promise<void>; supplyVariables(variablesArg: any): Promise<void>;
/** /**
@ -25,11 +26,25 @@ export declare class ScafTemplate {
*/ */
askCliForMissingVariables(): Promise<void>; askCliForMissingVariables(): Promise<void>;
/** /**
* finds all variables in a Template * finds all variables in a Template in as string
* e.g. myobject.someKey and myobject.someOtherKey
*/ */
private _findVariablesInTemplate(); private _findVariablesInTemplate();
/** /**
* checks if supplied Variables satisfy the template * checks if supplied Variables satisfy the template
*/ */
private _checkSuppliedVariables(); private _checkSuppliedVariables();
/**
* 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();
} }

View File

@ -9,8 +9,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
}; };
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
const plugins = require("./smartscaf.plugins"); const plugins = require("./smartscaf.plugins");
const helpers = require("./smartscaf.helpers");
class ScafTemplate { class ScafTemplate {
constructor() { constructor() {
this.suppliedVariables = {};
this.missingVariables = []; this.missingVariables = [];
} }
/** /**
@ -20,16 +22,18 @@ class ScafTemplate {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
let dirPath = plugins.path.resolve(dirPathArg); let dirPath = plugins.path.resolve(dirPathArg);
this.templateSmartfileArray = yield plugins.smartfile.fs.fileTreeToObject(dirPath, '**/*'); this.templateSmartfileArray = yield plugins.smartfile.fs.fileTreeToObject(dirPath, '**/*');
this._findVariablesInTemplate(); yield this._findVariablesInTemplate();
yield this._checkSuppliedVariables();
yield this._checkDefaultVariables();
}); });
} }
/** /**
* supply the variables to render the teplate with * supply the variables to render the teplate with
* @param variablesArg * @param variablesArg gets merged with this.suppliedVariables
*/ */
supplyVariables(variablesArg) { supplyVariables(variablesArg) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
this.suppliedVariables = variablesArg; this.suppliedVariables = plugins.lodash.merge(this.suppliedVariables, variablesArg);
this.missingVariables = yield this._checkSuppliedVariables(); this.missingVariables = yield this._checkSuppliedVariables();
}); });
} }
@ -44,20 +48,35 @@ class ScafTemplate {
localSmartInteract.addQuestions([{ localSmartInteract.addQuestions([{
name: missingVariable, name: missingVariable,
type: 'input', type: 'input',
default: `undefined ${missingVariable}`, default: (() => {
if (this.defaultVariables[missingVariable]) {
return this.defaultVariables[missingVariable];
}
else {
return 'undefined variable';
}
})(),
message: `What is the value of ${missingVariable}?` message: `What is the value of ${missingVariable}?`
}]); }]);
} }
let answers = yield localSmartInteract.runQueue(); let answerBucket = yield localSmartInteract.runQueue();
answerBucket.answerMap.forEach((answer) => __awaiter(this, void 0, void 0, function* () {
yield helpers.deepAddToObject(this.suppliedVariables, answer.name, answer.value);
}));
}); });
} }
/** /**
* finds all variables in a Template * finds all variables in a Template in as string
* e.g. myobject.someKey and myobject.someOtherKey
*/ */
_findVariablesInTemplate() { _findVariablesInTemplate() {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
for (let localSmartfile of this.templateSmartfileArray) { let templateVariables = [];
for (let templateSmartfile of this.templateSmartfileArray) {
let localTemplateVariables = yield plugins.smarthbs.findVarsInHbsString(templateSmartfile.contents.toString());
templateVariables = plugins.lodash.concat(templateVariables, localTemplateVariables);
} }
templateVariables = plugins.lodash.uniq(templateVariables);
}); });
} }
/** /**
@ -66,14 +85,40 @@ class ScafTemplate {
_checkSuppliedVariables() { _checkSuppliedVariables() {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
let missingVars = []; let missingVars = [];
for (let templateSmartFile of this.templateSmartfileArray) { for (let templateSmartfile of this.templateSmartfileArray) {
let localMissingVars = yield plugins.smarthbs.checkVarsSatisfaction(templateSmartFile.contents.toString(), this.suppliedVariables); let localMissingVars = yield plugins.smarthbs.checkVarsSatisfaction(templateSmartfile.contents.toString(), this.suppliedVariables);
missingVars = plugins.lodash.concat(missingVars, localMissingVars); missingVars = plugins.lodash.concat(missingVars, localMissingVars);
missingVars = plugins.lodash.uniq(missingVars);
} }
missingVars = plugins.lodash.uniq(missingVars);
return missingVars; return missingVars;
}); });
} }
/**
* 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
*/
_checkDefaultVariables() {
return __awaiter(this, void 0, void 0, function* () {
let defaultsSmartfile = this.templateSmartfileArray.filter(smartfileArg => {
return smartfileArg.parsedPath.base === 'defaults.yml';
})[0];
if (defaultsSmartfile) {
let defaultObject = yield plugins.smartyaml.yamlStringToObject(defaultsSmartfile.contents.toString());
this.defaultVariables = defaultObject;
}
else {
this.defaultVariables = {};
}
});
}
} }
exports.ScafTemplate = ScafTemplate; exports.ScafTemplate = ScafTemplate;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9u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RUFDckMsSUFBSSxDQUFDLGlCQUFpQixDQUN2QixDQUFBO2dCQUNELFdBQVcsR0FBRyxPQUFPLENBQUMsTUFBTSxDQUFDLE1BQU0sQ0FBQyxXQUFXLEVBQUUsZ0JBQWdCLENBQUMsQ0FBQTtZQUNwRSxDQUFDO1lBQ0QsV0FBVyxHQUFHLE9BQU8sQ0FBQyxNQUFNLENBQUMsSUFBSSxDQUFDLFdBQVcsQ0FBQyxDQUFBO1lBQzlDLE1BQU0sQ0FBQyxXQUFXLENBQUE7UUFDcEIsQ0FBQztLQUFBO0lBRUQ7Ozs7Ozs7Ozs7O09BV0c7SUFDVyxzQkFBc0I7O1lBQ2xDLElBQUksaUJBQWlCLEdBQUcsSUFBSSxDQUFDLHNCQUFzQixDQUFDLE1BQU0sQ0FBQyxZQUFZO2dCQUNyRSxNQUFNLENBQUMsWUFBWSxDQUFDLFVBQVUsQ0FBQyxJQUFJLEtBQUssY0FBYyxDQUFBO1lBQ3hELENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFBO1lBRUwsRUFBRSxDQUFDLENBQUMsaUJBQWlCLENBQUMsQ0FBQyxDQUFDO2dCQUN0QixJQUFJLGFBQWEsR0FBRyxNQUFNLE9BQU8sQ0FBQyxTQUFTLENBQUMsa0JBQWtCLENBQzVELGlCQUFpQixDQUFDLFFBQVEsQ0FBQyxRQUFRLEVBQUUsQ0FDdEMsQ0FBQTtnQkFDRCxJQUFJLENBQUMsZ0JBQWdCLEdBQUcsYUFBYSxDQUFBO1lBQ3ZDLENBQUM7WUFBQyxJQUFJLENBQUMsQ0FBQztnQkFDTixJQUFJLENBQUMsZ0JBQWdCLEdBQUcsRUFBRSxDQUFBO1lBQzVCLENBQUM7UUFDSCxDQUFDO0tBQUE7Q0FDRjtBQS9HRCxvQ0ErR0MifQ==

View 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>;

View File

@ -1,3 +1,36 @@
"use strict"; "use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRzY2FmLmhlbHBlcnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydHNjYWYuaGVscGVycy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiIn0= /**
* adds a variable in string dot notation to an already more or less expanded object
*/
exports.deepAddToObject = (objectArg, varStringArg, valueArg) => __awaiter(this, void 0, void 0, function* () {
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;
}
else if (!referencePointer[varName] && varNameNext) {
referencePointer[varName] = {};
referencePointer = referencePointer[varName];
}
}
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRzY2FmLmhlbHBlcnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydHNjYWYuaGVscGVycy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7O0FBRUE7O0dBRUc7QUFDUSxRQUFBLGVBQWUsR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FBZ0IsQ0FBQyxPQUFPLENBQUMsQ0FBQTtRQUM5QyxDQUFDO0lBQ0gsQ0FBQztBQUNILENBQUMsQ0FBQSxDQUFBIn0=

View File

@ -5,4 +5,5 @@ import * as smartfile from 'smartfile';
import * as smarthbs from 'smarthbs'; import * as smarthbs from 'smarthbs';
import * as smartinteract from 'smartinteract'; import * as smartinteract from 'smartinteract';
import * as smartq from 'smartq'; import * as smartq from 'smartq';
export { lodash, path, smartfile, smarthbs, smartinteract, smartq }; import * as smartyaml from 'smartyaml';
export { lodash, path, smartfile, smarthbs, smartinteract, smartq, smartyaml };

View File

@ -13,4 +13,6 @@ const smartinteract = require("smartinteract");
exports.smartinteract = smartinteract; exports.smartinteract = smartinteract;
const smartq = require("smartq"); const smartq = require("smartq");
exports.smartq = smartq; exports.smartq = smartq;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRzY2FmLnBsdWdpbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydHNjYWYucGx1Z2lucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDBCQUF1QjtBQUN2QixpQ0FBZ0M7QUFROUIsd0JBQU07QUFQUiw2QkFBNEI7QUFRMUIsb0JBQUk7QUFQTix1Q0FBc0M7QUFRcEMsOEJBQVM7QUFQWCxxQ0FBb0M7QUFRbEMsNEJBQVE7QUFQViwrQ0FBOEM7QUFRNUMsc0NBQWE7QUFQZixpQ0FBZ0M7QUFROUIsd0JBQU0ifQ== const smartyaml = require("smartyaml");
exports.smartyaml = smartyaml;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRzY2FmLnBsdWdpbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydHNjYWYucGx1Z2lucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDBCQUF1QjtBQUN2QixpQ0FBZ0M7QUFTOUIsd0JBQU07QUFSUiw2QkFBNEI7QUFTMUIsb0JBQUk7QUFSTix1Q0FBc0M7QUFTcEMsOEJBQVM7QUFSWCxxQ0FBb0M7QUFTbEMsNEJBQVE7QUFSViwrQ0FBOEM7QUFTNUMsc0NBQWE7QUFSZixpQ0FBZ0M7QUFTOUIsd0JBQU07QUFSUix1Q0FBc0M7QUFTcEMsOEJBQVMifQ==

View File

@ -23,15 +23,16 @@
"npm" "npm"
], ],
"devDependencies": { "devDependencies": {
"tapbundle": "^1.0.10" "tapbundle": "^1.0.12"
}, },
"dependencies": { "dependencies": {
"@types/lodash": "^4.14.63", "@types/lodash": "^4.14.64",
"lodash": "^4.17.4", "lodash": "^4.17.4",
"smartfile": "^4.2.9", "smartfile": "^4.2.11",
"smarthbs": "^1.0.12", "smarthbs": "^1.0.12",
"smartinteract": "^1.0.4", "smartinteract": "^1.0.4",
"smartq": "^1.1.1", "smartq": "^1.1.1",
"smartyaml": "^1.0.2",
"typings-global": "^1.0.16" "typings-global": "^1.0.16"
} }
} }

View File

@ -2,6 +2,8 @@ import { expect, tap } from 'tapbundle'
import * as smartscaf from '../dist/index' import * as smartscaf from '../dist/index'
process.env.CI = 'true'
let testScafTemplate: smartscaf.ScafTemplate let testScafTemplate: smartscaf.ScafTemplate
tap.test('should create new Smartscaf instance', async () => { tap.test('should create new Smartscaf instance', async () => {
@ -11,7 +13,7 @@ tap.test('should create new Smartscaf instance', async () => {
tap.test('Smartscaf instance -> should read a template directory', async () => { tap.test('Smartscaf instance -> should read a template directory', async () => {
await testScafTemplate.readTemplateFromDir('./test/test_template') await testScafTemplate.readTemplateFromDir('./test/test_template')
expect(testScafTemplate.templateSmartfileArray.length).to.equal(3) expect(testScafTemplate.templateSmartfileArray.length).to.equal(4)
}) })
tap.test('smartfile -> should accept variables', async () => { tap.test('smartfile -> should accept variables', async () => {

View File

@ -0,0 +1,2 @@
templateVar1: from default yaml
templateVar2: this is another value from yml

View File

@ -1,4 +1,5 @@
import * as plugins from './smartscaf.plugins' import * as plugins from './smartscaf.plugins'
import * as helpers from './smartscaf.helpers'
// interfaces // interfaces
import { Smartfile } from 'smartfile' import { Smartfile } from 'smartfile'
@ -14,7 +15,8 @@ export class ScafTemplate {
description: string description: string
templateSmartfileArray: Smartfile[] templateSmartfileArray: Smartfile[]
requiredVariables: string[] requiredVariables: string[]
suppliedVariables: any defaultVariables: any
suppliedVariables: any = {}
missingVariables: string[] = [] missingVariables: string[] = []
/** /**
@ -23,15 +25,17 @@ export class ScafTemplate {
async readTemplateFromDir (dirPathArg: string) { async readTemplateFromDir (dirPathArg: string) {
let dirPath = plugins.path.resolve(dirPathArg) let dirPath = plugins.path.resolve(dirPathArg)
this.templateSmartfileArray = await plugins.smartfile.fs.fileTreeToObject(dirPath, '**/*') this.templateSmartfileArray = await plugins.smartfile.fs.fileTreeToObject(dirPath, '**/*')
this._findVariablesInTemplate() await this._findVariablesInTemplate()
await this._checkSuppliedVariables()
await this._checkDefaultVariables()
} }
/** /**
* supply the variables to render the teplate with * supply the variables to render the teplate with
* @param variablesArg * @param variablesArg gets merged with this.suppliedVariables
*/ */
async supplyVariables (variablesArg) { async supplyVariables (variablesArg) {
this.suppliedVariables = variablesArg this.suppliedVariables = plugins.lodash.merge(this.suppliedVariables, variablesArg)
this.missingVariables = await this._checkSuppliedVariables() this.missingVariables = await this._checkSuppliedVariables()
} }
@ -45,35 +49,76 @@ export class ScafTemplate {
localSmartInteract.addQuestions([{ localSmartInteract.addQuestions([{
name: missingVariable, name: missingVariable,
type: 'input', type: 'input',
default: `undefined ${missingVariable}`, default: (() => {
if (this.defaultVariables[missingVariable]) {
return this.defaultVariables[missingVariable]
} else {
return 'undefined variable'
}
})(),
message: `What is the value of ${missingVariable}?` message: `What is the value of ${missingVariable}?`
}]) }])
} }
let answers = await localSmartInteract.runQueue() let answerBucket = await localSmartInteract.runQueue()
answerBucket.answerMap.forEach(async answer => {
await helpers.deepAddToObject(this.suppliedVariables, answer.name, answer.value)
})
} }
/** /**
* finds all variables in a Template * finds all variables in a Template in as string
* e.g. myobject.someKey and myobject.someOtherKey
*/ */
private async _findVariablesInTemplate() { private async _findVariablesInTemplate () {
for (let localSmartfile of this.templateSmartfileArray) { let templateVariables: string[] = []
for (let templateSmartfile of this.templateSmartfileArray) {
let localTemplateVariables = await plugins.smarthbs.findVarsInHbsString(templateSmartfile.contents.toString())
templateVariables = plugins.lodash.concat(templateVariables, localTemplateVariables)
} }
templateVariables = plugins.lodash.uniq(templateVariables)
} }
/** /**
* checks if supplied Variables satisfy the template * checks if supplied Variables satisfy the template
*/ */
private async _checkSuppliedVariables() { private async _checkSuppliedVariables () {
let missingVars: string[] = [] let missingVars: string[] = []
for (let templateSmartFile of this.templateSmartfileArray) { for (let templateSmartfile of this.templateSmartfileArray) {
let localMissingVars = await plugins.smarthbs.checkVarsSatisfaction( let localMissingVars = await plugins.smarthbs.checkVarsSatisfaction(
templateSmartFile.contents.toString(), templateSmartfile.contents.toString(),
this.suppliedVariables this.suppliedVariables
) )
missingVars = plugins.lodash.concat(missingVars, localMissingVars) missingVars = plugins.lodash.concat(missingVars, localMissingVars)
missingVars = plugins.lodash.uniq(missingVars)
} }
missingVars = plugins.lodash.uniq(missingVars)
return missingVars return missingVars
} }
/**
* 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 async _checkDefaultVariables () {
let defaultsSmartfile = this.templateSmartfileArray.filter(smartfileArg => {
return smartfileArg.parsedPath.base === 'defaults.yml'
})[0]
if (defaultsSmartfile) {
let defaultObject = await plugins.smartyaml.yamlStringToObject(
defaultsSmartfile.contents.toString()
)
this.defaultVariables = defaultObject
} else {
this.defaultVariables = {}
}
}
} }

View File

@ -1,2 +1,28 @@
import * as plugins from './smartscaf.plugins' import * as plugins from './smartscaf.plugins'
/**
* adds a variable in string dot notation to an already more or less expanded object
*/
export let deepAddToObject = async (objectArg, varStringArg: string, valueArg: string) => {
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: string = (() => {
if (varNamesArray[i + 1]) {
return varNamesArray[i + 1]
}
return null
})()
// build the tree in suppliedVariables
if (!referencePointer[varName] && !varNameNext) {
referencePointer[varName] = valueArg
} else if (!referencePointer[varName] && varNameNext) {
referencePointer[varName] = {}
referencePointer = referencePointer[varName]
}
}
}

View File

@ -5,6 +5,7 @@ import * as smartfile from 'smartfile'
import * as smarthbs from 'smarthbs' import * as smarthbs from 'smarthbs'
import * as smartinteract from 'smartinteract' import * as smartinteract from 'smartinteract'
import * as smartq from 'smartq' import * as smartq from 'smartq'
import * as smartyaml from 'smartyaml'
export { export {
lodash, lodash,
@ -12,5 +13,6 @@ export {
smartfile, smartfile,
smarthbs, smarthbs,
smartinteract, smartinteract,
smartq smartq,
smartyaml
} }

184
yarn.lock
View File

@ -19,9 +19,9 @@
version "3.5.2" version "3.5.2"
resolved "https://registry.yarnpkg.com/@types/chai/-/chai-3.5.2.tgz#c11cd2817d3a401b7ba0f5a420f35c56139b1c1e" resolved "https://registry.yarnpkg.com/@types/chai/-/chai-3.5.2.tgz#c11cd2817d3a401b7ba0f5a420f35c56139b1c1e"
"@types/fs-extra@2.x.x": "@types/fs-extra@3.x.x":
version "2.1.0" version "3.0.2"
resolved "https://registry.yarnpkg.com/@types/fs-extra/-/fs-extra-2.1.0.tgz#8b350239c0455d92b8d3c626edac193860ff395f" resolved "https://registry.yarnpkg.com/@types/fs-extra/-/fs-extra-3.0.2.tgz#00cbf48563f377f9ce5cf24237b21b3d9779e055"
dependencies: dependencies:
"@types/node" "*" "@types/node" "*"
@ -36,17 +36,21 @@
"@types/rx" "*" "@types/rx" "*"
"@types/through" "*" "@types/through" "*"
"@types/lodash@^4.14.62", "@types/lodash@^4.14.63": "@types/js-yaml@^3.5.30":
version "4.14.63" version "3.5.30"
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.63.tgz#5ac475f55bfdc62bc88c4239dbc482f2f3bead93" resolved "https://registry.yarnpkg.com/@types/js-yaml/-/js-yaml-3.5.30.tgz#f555118c022318e57e36d803379cb8ee38ee20a7"
"@types/lodash@^4.14.55", "@types/lodash@^4.14.62", "@types/lodash@^4.14.64":
version "4.14.64"
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.64.tgz#979cf3a3d4a368670840bf9b3e448dc33ffe84ee"
"@types/minimatch@2.x.x": "@types/minimatch@2.x.x":
version "2.0.29" version "2.0.29"
resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-2.0.29.tgz#5002e14f75e2d71e564281df0431c8c1b4a2a36a" resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-2.0.29.tgz#5002e14f75e2d71e564281df0431c8c1b4a2a36a"
"@types/node@*", "@types/node@^6.0.48": "@types/node@*", "@types/node@^6.0.48":
version "6.0.72" version "6.0.73"
resolved "https://registry.yarnpkg.com/@types/node/-/node-6.0.72.tgz#0f19de38555f3c33d733d678991347f7d0eefaff" resolved "https://registry.yarnpkg.com/@types/node/-/node-6.0.73.tgz#85dc4bb6f125377c75ddd2519a1eeb63f0a4ed70"
"@types/promises-a-plus@*": "@types/promises-a-plus@*":
version "0.0.27" version "0.0.27"
@ -213,11 +217,24 @@ beautycolor@^1.0.7:
ansi-256-colors "^1.1.0" ansi-256-colors "^1.1.0"
typings-global "^1.0.14" typings-global "^1.0.14"
beautylog@^6.1.10:
version "6.1.10"
resolved "https://registry.yarnpkg.com/beautylog/-/beautylog-6.1.10.tgz#9c27e566937684cb689f9372d98cfa5415d50b72"
dependencies:
"@types/lodash" "^4.14.55"
beautycolor "^1.0.7"
figlet "^1.2.0"
lodash "^4.17.4"
ora "^1.1.0"
smartenv "^2.0.0"
smartq "^1.1.1"
typings-global "^1.0.14"
bindings@^1.2.1: bindings@^1.2.1:
version "1.2.1" version "1.2.1"
resolved "https://registry.yarnpkg.com/bindings/-/bindings-1.2.1.tgz#14ad6113812d2d37d72e67b4cacb4bb726505f11" resolved "https://registry.yarnpkg.com/bindings/-/bindings-1.2.1.tgz#14ad6113812d2d37d72e67b4cacb4bb726505f11"
brace-expansion@^1.0.0: brace-expansion@^1.1.7:
version "1.1.7" version "1.1.7"
resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.7.tgz#3effc3c50e000531fb720eaff80f0ae8ef23cf59" resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.7.tgz#3effc3c50e000531fb720eaff80f0ae8ef23cf59"
dependencies: dependencies:
@ -257,7 +274,7 @@ chai@^3.5.0:
deep-eql "^0.1.3" deep-eql "^0.1.3"
type-detect "^1.0.0" type-detect "^1.0.0"
chalk@^1.0.0: chalk@^1.0.0, chalk@^1.1.1:
version "1.1.3" version "1.1.3"
resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98"
dependencies: dependencies:
@ -277,6 +294,16 @@ cli-cursor@^1.0.1:
dependencies: dependencies:
restore-cursor "^1.0.1" restore-cursor "^1.0.1"
cli-cursor@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-2.1.0.tgz#b35dac376479facc3e94747d41d0d0f5238ffcb5"
dependencies:
restore-cursor "^2.0.0"
cli-spinners@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/cli-spinners/-/cli-spinners-1.0.0.tgz#ef987ed3d48391ac3dab9180b406a742180d6e6a"
cli-width@^2.0.0: cli-width@^2.0.0:
version "2.1.0" version "2.1.0"
resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.1.0.tgz#b234ca209b29ef66fc518d9b98d5847b00edf00a" resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.1.0.tgz#b234ca209b29ef66fc518d9b98d5847b00edf00a"
@ -371,6 +398,10 @@ external-editor@^1.1.0:
spawn-sync "^1.0.15" spawn-sync "^1.0.15"
tmp "^0.0.29" tmp "^0.0.29"
figlet@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/figlet/-/figlet-1.2.0.tgz#6c46537378fab649146b5a6143dda019b430b410"
figures@^1.3.5: figures@^1.3.5:
version "1.7.0" version "1.7.0"
resolved "https://registry.yarnpkg.com/figures/-/figures-1.7.0.tgz#cbe1e3affcf1cd44b80cadfed28dc793a9701d2e" resolved "https://registry.yarnpkg.com/figures/-/figures-1.7.0.tgz#cbe1e3affcf1cd44b80cadfed28dc793a9701d2e"
@ -384,9 +415,9 @@ first-chunk-stream@^2.0.0:
dependencies: dependencies:
readable-stream "^2.0.2" readable-stream "^2.0.2"
fs-extra@^3.0.0: fs-extra@^3.0.1:
version "3.0.0" version "3.0.1"
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-3.0.0.tgz#244e0c4b0b8818f54040ec049d8a2bddc1202861" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-3.0.1.tgz#3794f378c58b342ea7dbbb23095109c4b3b62291"
dependencies: dependencies:
graceful-fs "^4.1.2" graceful-fs "^4.1.2"
jsonfile "^3.0.0" jsonfile "^3.0.0"
@ -397,13 +428,13 @@ fs.realpath@^1.0.0:
resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f"
glob@^7.0.0, glob@^7.1.1: glob@^7.0.0, glob@^7.1.1:
version "7.1.1" version "7.1.2"
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.1.tgz#805211df04faaf1c63a3600306cdf5ade50b2ec8" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15"
dependencies: dependencies:
fs.realpath "^1.0.0" fs.realpath "^1.0.0"
inflight "^1.0.4" inflight "^1.0.4"
inherits "2" inherits "2"
minimatch "^3.0.2" minimatch "^3.0.4"
once "^1.3.0" once "^1.3.0"
path-is-absolute "^1.0.0" path-is-absolute "^1.0.0"
@ -411,9 +442,9 @@ graceful-fs@^4.1.2, graceful-fs@^4.1.6:
version "4.1.11" version "4.1.11"
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658"
handlebars@^4.0.7: handlebars@^4.0.8:
version "4.0.8" version "4.0.10"
resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.0.8.tgz#22b875cd3f0e6cbea30314f144e82bc7a72ff420" resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.0.10.tgz#3d30c718b09a3d96f23ea4cc1f403c4d3ba9ff4f"
dependencies: dependencies:
async "^1.4.0" async "^1.4.0"
optimist "^0.6.1" optimist "^0.6.1"
@ -493,9 +524,9 @@ isarray@~1.0.0:
version "1.0.0" version "1.0.0"
resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11"
js-yaml@^3.8.3: js-yaml@^3.8.3, js-yaml@^3.8.4:
version "3.8.3" version "3.8.4"
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.8.3.tgz#33a05ec481c850c8875929166fe1beb61c728766" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.8.4.tgz#520b4564f86573ba96662af85a8cafa7b4b5a6f6"
dependencies: dependencies:
argparse "^1.0.7" argparse "^1.0.7"
esprima "^3.1.1" esprima "^3.1.1"
@ -507,8 +538,8 @@ jsonfile@^3.0.0:
graceful-fs "^4.1.6" graceful-fs "^4.1.6"
kind-of@^3.0.2: kind-of@^3.0.2:
version "3.2.0" version "3.2.2"
resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.2.0.tgz#b58abe4d5c044ad33726a8c1525b48cf891bff07" resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.2.2.tgz#31ea21a734bab9bbb0f32466d893aea51e4a3c64"
dependencies: dependencies:
is-buffer "^1.1.5" is-buffer "^1.1.5"
@ -546,6 +577,12 @@ lodash@^4.17.4, lodash@^4.3.0:
version "4.17.4" version "4.17.4"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae"
log-symbols@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-1.0.2.tgz#376ff7b58ea3086a0f09facc74617eca501e1a18"
dependencies:
chalk "^1.0.0"
longest@^1.0.1: longest@^1.0.1:
version "1.0.1" version "1.0.1"
resolved "https://registry.yarnpkg.com/longest/-/longest-1.0.1.tgz#30a0b2da38f73770e8294a0d22e6625ed77d0097" resolved "https://registry.yarnpkg.com/longest/-/longest-1.0.1.tgz#30a0b2da38f73770e8294a0d22e6625ed77d0097"
@ -557,11 +594,15 @@ memwatch-next@^0.3.0:
bindings "^1.2.1" bindings "^1.2.1"
nan "^2.3.2" nan "^2.3.2"
minimatch@^3.0.2, minimatch@^3.0.3: mimic-fn@^1.0.0:
version "3.0.3" version "1.1.0"
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.3.tgz#2a4e4090b96b2db06a9d7df01055a62a77c9b774" resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.1.0.tgz#e667783d92e89dbd342818b5230b9d62a672ad18"
minimatch@^3.0.3, minimatch@^3.0.4:
version "3.0.4"
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083"
dependencies: dependencies:
brace-expansion "^1.0.0" brace-expansion "^1.1.7"
minimist@^1.2.0: minimist@^1.2.0:
version "1.2.0" version "1.2.0"
@ -597,6 +638,12 @@ onetime@^1.0.0:
version "1.1.0" version "1.1.0"
resolved "https://registry.yarnpkg.com/onetime/-/onetime-1.1.0.tgz#a1f7838f8314c516f05ecefcbc4ccfe04b4ed789" resolved "https://registry.yarnpkg.com/onetime/-/onetime-1.1.0.tgz#a1f7838f8314c516f05ecefcbc4ccfe04b4ed789"
onetime@^2.0.0:
version "2.0.1"
resolved "https://registry.yarnpkg.com/onetime/-/onetime-2.0.1.tgz#067428230fd67443b2794b22bba528b6867962d4"
dependencies:
mimic-fn "^1.0.0"
optimist@^0.6.1: optimist@^0.6.1:
version "0.6.1" version "0.6.1"
resolved "https://registry.yarnpkg.com/optimist/-/optimist-0.6.1.tgz#da3ea74686fa21a19a111c326e90eb15a0196686" resolved "https://registry.yarnpkg.com/optimist/-/optimist-0.6.1.tgz#da3ea74686fa21a19a111c326e90eb15a0196686"
@ -604,6 +651,15 @@ optimist@^0.6.1:
minimist "~0.0.1" minimist "~0.0.1"
wordwrap "~0.0.2" wordwrap "~0.0.2"
ora@^1.1.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/ora/-/ora-1.2.0.tgz#32fb3183500efe83f5ea89101785f0ee6060fec9"
dependencies:
chalk "^1.1.1"
cli-cursor "^2.1.0"
cli-spinners "^1.0.0"
log-symbols "^1.0.2"
os-homedir@^1.0.1: os-homedir@^1.0.1:
version "1.0.2" version "1.0.2"
resolved "https://registry.yarnpkg.com/os-homedir/-/os-homedir-1.0.2.tgz#ffbc4988336e0e833de0c168c7ef152121aa7fb3" resolved "https://registry.yarnpkg.com/os-homedir/-/os-homedir-1.0.2.tgz#ffbc4988336e0e833de0c168c7ef152121aa7fb3"
@ -697,6 +753,13 @@ restore-cursor@^1.0.1:
exit-hook "^1.0.0" exit-hook "^1.0.0"
onetime "^1.0.0" onetime "^1.0.0"
restore-cursor@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-2.0.0.tgz#9f7ee287f82fd326d4fd162923d62129eee0dfaf"
dependencies:
onetime "^2.0.0"
signal-exit "^3.0.2"
right-align@^0.1.1: right-align@^0.1.1:
version "0.1.3" version "0.1.3"
resolved "https://registry.yarnpkg.com/right-align/-/right-align-0.1.3.tgz#61339b722fe6a3515689210d24e14c96148613ef" resolved "https://registry.yarnpkg.com/right-align/-/right-align-0.1.3.tgz#61339b722fe6a3515689210d24e14c96148613ef"
@ -714,11 +777,15 @@ rx@^4.1.0:
resolved "https://registry.yarnpkg.com/rx/-/rx-4.1.0.tgz#a5f13ff79ef3b740fe30aa803fb09f98805d4782" resolved "https://registry.yarnpkg.com/rx/-/rx-4.1.0.tgz#a5f13ff79ef3b740fe30aa803fb09f98805d4782"
rxjs@^5.3.0: rxjs@^5.3.0:
version "5.3.1" version "5.4.0"
resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-5.3.1.tgz#9ecc9e722247e4f4490d30a878577a3740fd0cb7" resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-5.4.0.tgz#a7db14ab157f9d7aac6a56e655e7a3860d39bf26"
dependencies: dependencies:
symbol-observable "^1.0.1" symbol-observable "^1.0.1"
safe-buffer@^5.0.1:
version "5.0.1"
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.0.1.tgz#d263ca54696cd8a306b5ca6551e92de57918fbe7"
semver@^5.3.0: semver@^5.3.0:
version "5.3.0" version "5.3.0"
resolved "https://registry.yarnpkg.com/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f" resolved "https://registry.yarnpkg.com/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f"
@ -731,6 +798,10 @@ shelljs@^0.7.7:
interpret "^1.0.0" interpret "^1.0.0"
rechoir "^0.6.2" rechoir "^0.6.2"
signal-exit@^3.0.2:
version "3.0.2"
resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d"
smartchai@^1.0.3: smartchai@^1.0.3:
version "1.0.3" version "1.0.3"
resolved "https://registry.yarnpkg.com/smartchai/-/smartchai-1.0.3.tgz#de6d010bb8b5aef24cb70b31a5f5334e8c41b72f" resolved "https://registry.yarnpkg.com/smartchai/-/smartchai-1.0.3.tgz#de6d010bb8b5aef24cb70b31a5f5334e8c41b72f"
@ -748,13 +819,21 @@ smartdelay@^1.0.1:
dependencies: dependencies:
typings-global "^1.0.14" typings-global "^1.0.14"
smartfile@^4.2.9: smartenv@^2.0.0:
version "4.2.9" version "2.0.6"
resolved "https://registry.yarnpkg.com/smartfile/-/smartfile-4.2.9.tgz#afcd1160049cbe26a86e42e842c86e8b748e69e7" resolved "https://registry.yarnpkg.com/smartenv/-/smartenv-2.0.6.tgz#b38c679b0c151b9af548f68c3a072c29d1417e8d"
dependencies: dependencies:
"@types/fs-extra" "2.x.x" lodash "^4.17.4"
smartq "^1.1.1"
typings-global "^1.0.14"
smartfile@^4.2.11:
version "4.2.11"
resolved "https://registry.yarnpkg.com/smartfile/-/smartfile-4.2.11.tgz#20bb3a1411722688135499520de2fd00985becdb"
dependencies:
"@types/fs-extra" "3.x.x"
"@types/vinyl" "^2.0.0" "@types/vinyl" "^2.0.0"
fs-extra "^3.0.0" fs-extra "^3.0.1"
glob "^7.1.1" glob "^7.1.1"
js-yaml "^3.8.3" js-yaml "^3.8.3"
require-reload "0.2.2" require-reload "0.2.2"
@ -766,14 +845,15 @@ smartfile@^4.2.9:
vinyl-file "^3.0.0" vinyl-file "^3.0.0"
smarthbs@^1.0.12: smarthbs@^1.0.12:
version "1.0.12" version "1.0.14"
resolved "https://registry.yarnpkg.com/smarthbs/-/smarthbs-1.0.12.tgz#af230f4353988c51ffb8a653d28dfa8b3a2aaa37" resolved "https://registry.yarnpkg.com/smarthbs/-/smarthbs-1.0.14.tgz#448a3f30d8c674dcc060ff8941f23c54c1e3af08"
dependencies: dependencies:
"@types/handlebars" "^4.0.32" "@types/handlebars" "^4.0.32"
"@types/lodash" "^4.14.63" "@types/lodash" "^4.14.64"
handlebars "^4.0.7" beautylog "^6.1.10"
handlebars "^4.0.8"
lodash "^4.17.4" lodash "^4.17.4"
smartfile "^4.2.9" smartfile "^4.2.11"
smartq "^1.1.1" smartq "^1.1.1"
typings-global "^1.0.16" typings-global "^1.0.16"
@ -810,6 +890,14 @@ smartrequest@^1.0.4:
smartq "^1.1.0" smartq "^1.1.0"
typings-global "^1.0.14" typings-global "^1.0.14"
smartyaml@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/smartyaml/-/smartyaml-1.0.2.tgz#34216bf30b9685448d641e82f3bc2957fc397fcf"
dependencies:
"@types/js-yaml" "^3.5.30"
js-yaml "^3.8.4"
typings-global "^1.0.16"
source-map@^0.4.4: source-map@^0.4.4:
version "0.4.4" version "0.4.4"
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.4.4.tgz#eba4f5da9c0dc999de68032d8b4f76173652036b" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.4.4.tgz#eba4f5da9c0dc999de68032d8b4f76173652036b"
@ -840,10 +928,10 @@ string-width@^1.0.1:
strip-ansi "^3.0.0" strip-ansi "^3.0.0"
string_decoder@~1.0.0: string_decoder@~1.0.0:
version "1.0.0" version "1.0.1"
resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.0.0.tgz#f06f41157b664d86069f84bdbdc9b0d8ab281667" resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.0.1.tgz#62e200f039955a6810d8df0a33ffc0f013662d98"
dependencies: dependencies:
buffer-shims "~1.0.0" safe-buffer "^5.0.1"
strip-ansi@^3.0.0: strip-ansi@^3.0.0:
version "3.0.1" version "3.0.1"
@ -878,9 +966,9 @@ symbol-observable@^1.0.1:
version "1.0.4" version "1.0.4"
resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.0.4.tgz#29bf615d4aa7121bdd898b22d4b3f9bc4e2aa03d" resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.0.4.tgz#29bf615d4aa7121bdd898b22d4b3f9bc4e2aa03d"
tapbundle@^1.0.10: tapbundle@^1.0.12:
version "1.0.10" version "1.0.12"
resolved "https://registry.yarnpkg.com/tapbundle/-/tapbundle-1.0.10.tgz#36fd40036f6b5b738cbb9b5fc400df4c4031bc26" resolved "https://registry.yarnpkg.com/tapbundle/-/tapbundle-1.0.12.tgz#71d29273aad280f5c4e15b2700430b2456a5d364"
dependencies: dependencies:
early "^2.1.1" early "^2.1.1"
leakage "^0.2.0" leakage "^0.2.0"
@ -930,8 +1018,8 @@ typings-global@^1.0.14, typings-global@^1.0.16:
shelljs "^0.7.7" shelljs "^0.7.7"
uglify-js@^2.6: uglify-js@^2.6:
version "2.8.22" version "2.8.27"
resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.8.22.tgz#d54934778a8da14903fa29a326fb24c0ab51a1a0" resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.8.27.tgz#47787f912b0f242e5b984343be8e35e95f694c9c"
dependencies: dependencies:
source-map "~0.5.1" source-map "~0.5.1"
yargs "~3.10.0" yargs "~3.10.0"