diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f2d2ff7..1128296 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,56 +1,83 @@ -image: hosttoday/ht-docker-node:npmts +# gitzone standard +image: hosttoday/ht-docker-node:npmci + +cache: + paths: + - .yarn/ + key: "$CI_BUILD_STAGE" stages: +- mirror - test - release - trigger - pages +mirror: + stage: mirror + script: + - npmci git mirror + tags: + - docker + testLEGACY: stage: test script: - - npmci test legacy + - npmci node install legacy + - npmci npm install + - npmci npm test + coverage: /\d+.?\d+?\%\s*coverage/ tags: - - docker + - docker allow_failure: true testLTS: stage: test script: - - npmci test lts + - npmci node install lts + - npmci npm install + - npmci npm test + coverage: /\d+.?\d+?\%\s*coverage/ tags: - - docker + - docker testSTABLE: stage: test script: - - npmci test stable + - npmci node install stable + - npmci npm install + - npmci npm test + coverage: /\d+.?\d+?\%\s*coverage/ tags: - - docker + - docker release: stage: release script: - - npmci publish + - npmci npm prepare + - npmci npm publish only: - - tags + - tags tags: - - docker + - docker trigger: stage: trigger script: - - npmci trigger + - npmci trigger only: - - tags + - tags tags: - - docker + - docker pages: - image: hosttoday/ht-docker-node:npmpage + image: hosttoday/ht-docker-node:npmci stage: pages script: - - npmci command npmpage --host gitlab + - npmci command yarn global add npmpage + - npmci command npmpage + tags: + - docker only: - tags artifacts: diff --git a/dist/index.d.ts b/dist/index.d.ts index fa52aa1..7853089 100644 --- a/dist/index.d.ts +++ b/dist/index.d.ts @@ -1,7 +1,8 @@ import * as docker from './smartstring.docker'; import * as indent from './smartstring.indent'; +import * as normalize from './smartstring.normalize'; import * as typescript from './smartstring.typescript'; -export { docker, typescript, indent }; +export { docker, typescript, normalize, indent }; export { Base64, base64 } from './smartstring.base64'; export { Domain } from './smartstring.domain'; export { GitRepo } from './smartstring.git'; diff --git a/dist/index.js b/dist/index.js index ac10927..5a4a07a 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1,8 +1,11 @@ "use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); const docker = require("./smartstring.docker"); exports.docker = docker; const indent = require("./smartstring.indent"); exports.indent = indent; +const normalize = require("./smartstring.normalize"); +exports.normalize = normalize; const typescript = require("./smartstring.typescript"); exports.typescript = typescript; var smartstring_base64_1 = require("./smartstring.base64"); @@ -12,4 +15,4 @@ var smartstring_domain_1 = require("./smartstring.domain"); exports.Domain = smartstring_domain_1.Domain; var smartstring_git_1 = require("./smartstring.git"); exports.GitRepo = smartstring_git_1.GitRepo; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsK0NBQThDO0FBSzFDLHdCQUFNO0FBSlYsK0NBQThDO0FBTTFDLHdCQUFNO0FBTFYsdURBQXNEO0FBSWxELGdDQUFVO0FBSWQsMkRBQXFEO0FBQTVDLHNDQUFBLE1BQU0sQ0FBQTtBQUFFLHNDQUFBLE1BQU0sQ0FBQTtBQUN2QiwyREFBNkM7QUFBcEMsc0NBQUEsTUFBTSxDQUFBO0FBQ2YscURBQTJDO0FBQWxDLG9DQUFBLE9BQU8sQ0FBQSJ9 \ No newline at end of file +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLCtDQUE4QztBQU01Qyx3QkFBTTtBQUxSLCtDQUE4QztBQVE1Qyx3QkFBTTtBQVBSLHFEQUFvRDtBQU1sRCw4QkFBUztBQUxYLHVEQUFzRDtBQUlwRCxnQ0FBVTtBQUtaLDJEQUFxRDtBQUE1QyxzQ0FBQSxNQUFNLENBQUE7QUFBRSxzQ0FBQSxNQUFNLENBQUE7QUFDdkIsMkRBQTZDO0FBQXBDLHNDQUFBLE1BQU0sQ0FBQTtBQUNmLHFEQUEyQztBQUFsQyxvQ0FBQSxPQUFPLENBQUEifQ== \ No newline at end of file diff --git a/dist/smartstring.base64.js b/dist/smartstring.base64.js index 5a878b4..5fe78af 100644 --- a/dist/smartstring.base64.js +++ b/dist/smartstring.base64.js @@ -1,4 +1,5 @@ "use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); const plugins = require("./smartstring.plugins"); /** * handle base64 strings @@ -6,7 +7,7 @@ const plugins = require("./smartstring.plugins"); class Base64 { constructor(inputStringArg, typeArg) { switch (typeArg) { - case 'string': + case 'string':// easiest case this.refString = inputStringArg; break; case 'base64': @@ -56,4 +57,4 @@ exports.base64 = { return plugins.jsBase64.decode(stringArg); } }; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRzdHJpbmcuYmFzZTY0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnRzdHJpbmcuYmFzZTY0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxpREFBZ0Q7QUFPaEQ7O0dBRUc7QUFDSDtJQUVJLFlBQVksY0FBYyxFQUFFLE9BQXFCO1FBQzdDLE1BQU0sQ0FBQyxDQUFDLE9BQU8sQ0FBQyxDQUFDLENBQUM7WUFDZCxLQUFLLFFBQVE7Z0JBQ1QsSUFBSSxDQUFDLFNBQVMsR0FBRyxjQUFjLENBQUE7Z0JBQy9CLEtBQUssQ0FBQTtZQUNULEtBQUssUUFBUTtnQkFDVCxJQUFJLENBQUMsU0FBUyxHQUFHLGNBQU0sQ0FBQyxNQUFNLENBQUMsY0FBYyxDQUFDLENBQUE7Z0JBQzlDLEtBQUssQ0FBQTtZQUNULEtBQUssV0FBVztnQkFDWixJQUFJLENBQUMsU0FBUyxHQUFHLGNBQU0sQ0FBQyxNQUFNLENBQUMsY0FBYyxDQUFDLENBQUE7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0FBQyxNQUFNLENBQUMsU0FBUyxDQUFDLENBQUE7SUFDM0MsQ0FBQztJQUVEOztPQUVHO0lBQ0gsU0FBUyxFQUFFLENBQUMsU0FBaUI7UUFDM0IsTUFBTSxDQUFDLE9BQU8sQ0FBQyxRQUFRLENBQUMsU0FBUyxDQUFDLFNBQVMsQ0FBQyxDQUFBO0lBQzlDLENBQUM7SUFFRDs7T0FFRztJQUNILE1BQU0sRUFBRSxDQUFDLFNBQWlCO1FBQ3hCLE1BQU0sQ0FBQyxPQUFPLENBQUMsUUFBUSxDQUFDLE1BQU0sQ0FBQyxTQUFTLENBQUMsQ0FBQTtJQUMzQyxDQUFDO0NBQ0YsQ0FBQSJ9 \ No newline at end of file diff --git a/dist/smartstring.docker.js b/dist/smartstring.docker.js index a5255f9..7794559 100644 --- a/dist/smartstring.docker.js +++ b/dist/smartstring.docker.js @@ -1,4 +1,5 @@ "use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); /** * converts an erray of env strings from docker remote api to an usable object. * @param envArrayArg @@ -12,8 +13,7 @@ exports.makeEnvObject = function (envArrayArg) { let regexMatches = regexString.exec(envArrayArg[envKey]); returnObject[regexMatches[1]] = regexMatches[2]; } - ; } return returnObject; }; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRzdHJpbmcuZG9ja2VyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnRzdHJpbmcuZG9ja2VyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFFQTs7OztHQUlHO0FBQ1EsUUFBQSxhQUFhLEdBQUcsVUFBVSxXQUFxQjtJQUN0RCxJQUFJLFlBQVksR0FBRyxFQUFFLENBQUE7SUFDckIsSUFBSSxXQUFXLEdBQUcsV0FBVyxDQUFBO0lBQzdCLEVBQUUsQ0FBQyxDQUFDLE9BQU8sV0FBVyxLQUFLLFdBQVcsQ0FBQyxDQUFDLENBQUM7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3ZELENBQUM7SUFDSCxDQUFDO0lBQ0QsTUFBTSxDQUFDLFlBQVksQ0FBQTtBQUNyQixDQUFDLENBQUEifQ== \ No newline at end of file diff --git a/dist/smartstring.domain.js b/dist/smartstring.domain.js index 491f7a0..33bff2e 100644 --- a/dist/smartstring.domain.js +++ b/dist/smartstring.domain.js @@ -1,4 +1,5 @@ "use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); class Domain { constructor(domainStringArg) { let regexMatches = domainRegex(domainStringArg); @@ -49,4 +50,4 @@ let protocolRegex = function (stringArg) { return undefined; } }; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRzdHJpbmcuZG9tYWluLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnRzdHJpbmcuZG9tYWluLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFFQTtJQWFJLFlBQVksZUFBc0I7UUFDOUIsSUFBSSxZQUFZLEdBQUcsV0FBVyxDQUFDLGVBQWUsQ0FBQyxDQUFDO1FBQ2hELElBQUksQ0FBQyxRQUFRLEdBQUcsRUFBRSxDQUFBO1FBQ2xCLEdBQUcsQ0FBQyxDQUFDLElBQUksQ0FBQyxHQUFHLENBQUMsRUFBRSxDQUFDLElBQUksQ0FBQyxFQUFFLENBQUMsRUFBRSxFQUFFLENBQUM7WUFDMUIsRUFBRSxDQUFDLENBQUMsWUFBWSxDQUFDLENBQUMsR0FBRyxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUM7Z0JBQ3RCLElBQUksVUFBVSxHQUFHLFlBQVksQ0FBQyxDQUFDLEdBQUcsQ0FBQyxDQUFDLENBQUE7Z0JBQ3BDLElBQUksQ0FBQyxPQUFPLEdBQUcsQ0FBQyxDQUFDLFFBQVEsRUFBRSxDQUFDLEdBQUcsVUFBVSxDQUFBO2dCQUN6QyxFQUFFLENBQUMsQ0FBQyxJQUFJLENBQUMsUUFBUS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--git a/dist/smartstring.git.js b/dist/smartstring.git.js index a7ee1fe..a036de5 100644 --- a/dist/smartstring.git.js +++ b/dist/smartstring.git.js @@ -1,4 +1,5 @@ "use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); /* ---------------------------------------------- * * ------------------ classes ------------------- * * ---------------------------------------------- */ @@ -42,4 +43,4 @@ let gitLink = function (hostArg, userArg, repoArg, tokenArg = '', linkTypeArg) { } return returnString; }; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRzdHJpbmcuZ2l0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnRzdHJpbmcuZ2l0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFFQTs7b0RBRW9EO0FBQ3BEO0lBT0ksWUFBWSxTQUFpQixFQUFDLFFBQWlCO1FBQzNDLElBQUksWUFBWSxHQUFHLFFBQVEsQ0FBQyxTQUFTLENBQUMsQ0FBQTtRQUN0QyxJQUFJLENBQUMsSUFBSSxHQUFHLFlBQVksQ0FBQyxDQUFDLENBQUMsQ0FBQTtRQUMzQixJQUFJLENBQUMsSUFBSSxHQUFHLFlBQVksQ0FBQyxDQUFDLENBQUMsQ0FBQTtRQUMzQixJQUFJLENBQUMsSUFBSSxHQUFHLFlBQVksQ0FBQyxDQUFDLENBQUMsQ0FBQTtRQUMzQixJQUFJLENBQUMsV0FBVyxHQUFHLFFBQVEsQ0FBQTtRQUMzQixJQUFJLENBQUMsTUFBTSxHQUFHLE9BQU8sQ0FBQyxJQUFJLENBQUMsSUFBSSxFQUFDLElBQUksQ0FBQyxJQUFJLEVBQUMsSUFBSSxDQUFDLElBQUksRUFBQyxJQUFJLENBQUMsV0FBVyxFQUFFLEtBQUssQ0FBQyxDQUFBO1FBQzVFLElBQUksQ0FBQyxRQUFRLEdBQUcsT0FBTyxDQUFDLElBQUksQ0FBQyxJQUFJLEVBQUMsSUFBSSxDQUFDL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QztJQUNELE1BQU0sQ0FBQyxZQUFZLENBQUE7QUFDckIsQ0FBQyxDQUFBIn0= \ No newline at end of file diff --git a/dist/smartstring.indent.d.ts b/dist/smartstring.indent.d.ts index b73f8ca..f4a5f69 100644 --- a/dist/smartstring.indent.d.ts +++ b/dist/smartstring.indent.d.ts @@ -1,3 +1,13 @@ +/** + * indent an array + * @param stringArg + * @param spaceAmount + */ export declare let indent: (stringArg: string, spaceAmount: number) => string; +/** + * indents a string with prefix + * @param stringArg + * @param prefixArg + */ export declare let indentWithPrefix: (stringArg: string, prefixArg: string) => string; export declare let normalize: (stringArg: string) => string; diff --git a/dist/smartstring.indent.js b/dist/smartstring.indent.js index 3b0875a..1a13f9f 100644 --- a/dist/smartstring.indent.js +++ b/dist/smartstring.indent.js @@ -1,15 +1,28 @@ "use strict"; -let splitString = (stringArg) => { +Object.defineProperty(exports, "__esModule", { value: true }); +/** + * splits a string into an array + * @param stringArg + */ +let splitStringAtLineBreak = (stringArg) => { let resultArray = stringArg.split('\n'); return cleanStringArray(resultArray); }; -let joinString = (stringArrayArg) => { +/** + * joins a string together again + * @param stringArrayArg + */ +let joinStringWithLineBreaks = (stringArrayArg) => { let resultString = ''; for (let line of stringArrayArg) { - resultString = resultString + line + '\n'; + resultString = resultString + line + '\n'; // add new line at end } return resultString; }; +/** + * cleans first and last line in case they are empty + * @param stringArrayArg + */ let cleanStringArray = (stringArrayArg) => { let testRegex = /^[\s]*$/; if (testRegex.test(stringArrayArg[0])) { @@ -18,27 +31,39 @@ let cleanStringArray = (stringArrayArg) => { if (testRegex.test(stringArrayArg[stringArrayArg.length - 1])) { stringArrayArg.pop(); } - ; return stringArrayArg; }; +/** + * indent an array + * @param stringArg + * @param spaceAmount + */ exports.indent = (stringArg, spaceAmount) => { - let resultString; + let localStringArray = splitStringAtLineBreak(stringArg); + for (let stringArg of localStringArray) { + stringArg = ' '.repeat(spaceAmount) + stringArg; + } + let resultString = joinStringWithLineBreaks(localStringArray); return resultString; }; +/** + * indents a string with prefix + * @param stringArg + * @param prefixArg + */ exports.indentWithPrefix = (stringArg, prefixArg) => { let resultString; - let stringArray = splitString(stringArg); + let stringArray = splitStringAtLineBreak(stringArg); let resultArray = []; for (let stringItem of stringArray) { resultArray.push(prefixArg + stringItem); } - ; - resultString = joinString(resultArray); + resultString = joinStringWithLineBreaks(resultArray); return resultString; }; exports.normalize = (stringArg) => { let resultString; - let splitStringArray = splitString(stringArg); + let splitStringArray = splitStringAtLineBreak(stringArg); let minCommonLeftOffset; let deIndentRegex = /^(\s*)/; let emptyLineRegex = /^(\s*)$/; @@ -54,8 +79,7 @@ exports.normalize = (stringArg) => { for (let stringItem of splitStringArray) { resultSplitStringArray.push(stringItem.substr(minCommonLeftOffset)); } - ; - resultString = joinString(resultSplitStringArray); + resultString = joinStringWithLineBreaks(resultSplitStringArray); return resultString; }; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRzdHJpbmcuaW5kZW50LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnRzdHJpbmcuaW5kZW50LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFFQSxJQUFJLFdBQVcsR0FBRyxDQUFDLFNBQWlCO0lBQ2hDLElBQUksV0FBVyxHQUFHLFNBQVMsQ0FBQyxLQUFLLENBQUMsSUFBSSxDQUFDLENBQUE7SUFDdkMsTUFBTSxDQUFDLGdCQUFnQixDQUFDLFdBQVcsQ0FBQyxDQUFBO0FBQ3hDLENBQUMsQ0FBQztBQUVGLElBQUksVUFBVSxHQUFHLENBQUMsY0FBd0I7SUFDdEMsSUFBSSxZQUFZLEdBQVcsRUFBRSxDQUFBO0lBQzdCLEdBQUcsQ0FBQyxDQUFDLElBQUksSUFBSSxJQUFJLGNBQWMsQ0FBQyxDQUFBLENBQUM7UUFDN0IsWUFBWSxHQUFHLFlBQVksR0FBRyxJQUFJLEdBQUcsSUFBSSxDQUFB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QVUsSUFBSSxnQkFBZ0IsQ0FBQyxDQUFDLENBQUM7UUFDeEMsc0JBQXNCLENBQUMsSUFBSSxDQUFDLFVBQVUsQ0FBQyxNQUFNLENBQUMsbUJBQW1CLENBQUMsQ0FBQyxDQUFBO0lBQ3JFLENBQUM7SUFDRCxZQUFZLEdBQUcsd0JBQXdCLENBQUMsc0JBQXNCLENBQUMsQ0FBQTtJQUMvRCxNQUFNLENBQUMsWUFBWSxDQUFBO0FBQ3JCLENBQUMsQ0FBQSJ9 \ No newline at end of file diff --git a/dist/smartstring.normalize.d.ts b/dist/smartstring.normalize.d.ts new file mode 100644 index 0000000..dbdec3e --- /dev/null +++ b/dist/smartstring.normalize.d.ts @@ -0,0 +1,12 @@ +/** + * replaces all occurences of something in a string + * @param stringArg + * @param searchRegExp + * @param replacementString + */ +export declare let replaceAll: (stringArg: string, searchRegExp: any, replacementString: string) => string; +/** + * normalizes a string + * @param stringArg + */ +export declare let standard: (stringArg: string) => string; diff --git a/dist/smartstring.normalize.js b/dist/smartstring.normalize.js new file mode 100644 index 0000000..b007d8f --- /dev/null +++ b/dist/smartstring.normalize.js @@ -0,0 +1,23 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const plugins = require("./smartstring.plugins"); +/** + * replaces all occurences of something in a string + * @param stringArg + * @param searchRegExp + * @param replacementString + */ +exports.replaceAll = (stringArg, searchRegExp, replacementString) => { + return stringArg.replace(new RegExp(searchRegExp, 'g'), replacementString); +}; +/** + * normalizes a string + * @param stringArg + */ +exports.standard = (stringArg) => { + let fix1 = plugins.stripIndent(stringArg); // fix indention + let fix2 = plugins.normalizeNewline(fix1); // fix newlines + let fix3 = exports.replaceAll(fix2, /\t/, ' '); // fix tabs + return fix3; +}; +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRzdHJpbmcubm9ybWFsaXplLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnRzdHJpbmcubm9ybWFsaXplLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsaURBQWdEO0FBRWhEOzs7OztHQUtHO0FBQ1EsUUFBQSxVQUFVLEdBQUcsQ0FBQyxTQUFpQixFQUFFLFlBQWlCLEVBQUUsaUJBQXlCO0lBQ3RGLE1BQU0sQ0FBQyxTQUFTLENBQUMsT0FBTyxDQUFDLElBQUksTUFBTSxDQUFDLFlBQVksRUFBRSxHQUFHLENBQUMsRUFBRSxpQkFBaUIsQ0FBQyxDQUFBO0FBQzVFLENBQUMsQ0FBQTtBQUVEOzs7R0FHRztBQUNRLFFBQUEsUUFBUSxHQUFHLENBQUMsU0FBaUI7SUFDdEMsSUFBSSxJQUFJLEdBQUcsT0FBTyxDQUFDLFdBQVcsQ0FBQyxTQUFTLENBQUMsQ0FBQSxDQUFDLGdCQUFnQjtJQUMxRCxJQUFJLElBQUksR0FBRyxPQUFPLENBQUMsZ0JBQWdCLENBQUMsSUFBSSxDQUFDLENBQUEsQ0FBQyxlQUFlO0lBQ3pELElBQUksSUFBSSxHQUFHLGtCQUFVLENBQUMsSUFBSSxFQUFFLElBQUksRUFBRSxHQUFHLENBQUMsQ0FBQSxDQUFDLFdBQVc7SUFDbEQsTUFBTSxDQUFDLElBQUksQ0FBQTtBQUNiLENBQUMsQ0FBQSJ9 \ No newline at end of file diff --git a/dist/smartstring.plugins.d.ts b/dist/smartstring.plugins.d.ts index 69a1e23..81b868c 100644 --- a/dist/smartstring.plugins.d.ts +++ b/dist/smartstring.plugins.d.ts @@ -1,2 +1,4 @@ import 'typings-global'; export declare let jsBase64: any; +export declare let stripIndent: any; +export declare let normalizeNewline: any; diff --git a/dist/smartstring.plugins.js b/dist/smartstring.plugins.js index e82cd1d..e6b30df 100644 --- a/dist/smartstring.plugins.js +++ b/dist/smartstring.plugins.js @@ -1,4 +1,7 @@ "use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); require("typings-global"); exports.jsBase64 = require('js-base64').Base64; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRzdHJpbmcucGx1Z2lucy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0c3RyaW5nLnBsdWdpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLDBCQUF1QjtBQUNaLFFBQUEsUUFBUSxHQUFHLE9BQU8sQ0FBQyxXQUFXLENBQUMsQ0FBQyxNQUFNLENBQUEifQ== \ No newline at end of file +exports.stripIndent = require('strip-indent'); +exports.normalizeNewline = require('normalize-newline'); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRzdHJpbmcucGx1Z2lucy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0c3RyaW5nLnBsdWdpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSwwQkFBdUI7QUFDWixRQUFBLFFBQVEsR0FBRyxPQUFPLENBQUMsV0FBVyxDQUFDLENBQUMsTUFBTSxDQUFBO0FBRXRDLFFBQUEsV0FBVyxHQUFHLE9BQU8sQ0FBQyxjQUFjLENBQUMsQ0FBQTtBQUNyQyxRQUFBLGdCQUFnQixHQUFHLE9BQU8sQ0FBQyxtQkFBbUIsQ0FBQyxDQUFBIn0= \ No newline at end of file diff --git a/dist/smartstring.typescript.js b/dist/smartstring.typescript.js index 5453232..531b5f0 100644 --- a/dist/smartstring.typescript.js +++ b/dist/smartstring.typescript.js @@ -1,3 +1,4 @@ "use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); exports.regexReferencePath = /\/\/\/\s*\s*[\\n]?/; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRzdHJpbmcudHlwZXNjcmlwdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0c3RyaW5nLnR5cGVzY3JpcHQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUVXLFFBQUEsa0JBQWtCLEdBQUcsOERBQThELENBQUEifQ== \ No newline at end of file +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRzdHJpbmcudHlwZXNjcmlwdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0c3RyaW5nLnR5cGVzY3JpcHQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFFVyxRQUFBLGtCQUFrQixHQUFHLDhEQUE4RCxDQUFBIn0= \ No newline at end of file diff --git a/package.json b/package.json index f1ed9c8..6c1b423 100644 --- a/package.json +++ b/package.json @@ -22,13 +22,13 @@ }, "homepage": "https://gitlab.com/pushrocks/smartstring#readme", "devDependencies": { - "beautylog": "^6.1.1", - "npmts-g": "^6.0.0", - "smartchai": "^1.0.3", - "typings-test": "^1.0.3" + "beautylog": "^6.1.10", + "tapbundle": "^1.1.1" }, "dependencies": { - "js-base64": "^2.1.9", - "typings-global": "^1.0.14" + "js-base64": "^2.3.2", + "normalize-newline": "^3.0.0", + "strip-indent": "^2.0.0", + "typings-global": "^1.0.20" } } diff --git a/test/test.base64.ts b/test/test.base64.ts new file mode 100644 index 0000000..f78a1e8 --- /dev/null +++ b/test/test.base64.ts @@ -0,0 +1,16 @@ +import * as smartstring from '../ts/index' +import { tap, expect } from 'tapbundle' + +// Base64 +let testBase64: smartstring.Base64 +tap.test('expect create a valid instance of Base64', async () => { + testBase64 = new smartstring.Base64('somestring', 'string') + expect(testBase64).be.instanceOf(smartstring.Base64) +}) +tap.test('expect read output a file as base64 and base64uri', async () => { + expect(testBase64.base64String).not.equal(testBase64.base64UriString) + let testBase64_2 = new smartstring.Base64(testBase64.base64UriString, 'base64uri') + expect(testBase64_2.simpleString).equal(testBase64.simpleString) +}) + +tap.start() diff --git a/test/test.d.ts b/test/test.d.ts deleted file mode 100644 index 2fd432a..0000000 --- a/test/test.d.ts +++ /dev/null @@ -1 +0,0 @@ -import 'typings-test'; diff --git a/test/test.docker.ts b/test/test.docker.ts new file mode 100644 index 0000000..1a8e132 --- /dev/null +++ b/test/test.docker.ts @@ -0,0 +1,12 @@ +import * as smartstring from '../ts/index' +import { tap, expect } from 'tapbundle' + +// Docker +tap.test('expect create a Env Object', async () => { + let envStringArray = [ 'VIRTUAL_HOST=sub.domain.tld', 'DEFAULT_HOST=some.domain.com' ] + let envObject: any = smartstring.docker.makeEnvObject(envStringArray) + expect(envObject.VIRTUAL_HOST).to.equal('sub.domain.tld') + expect(envObject.DEFAULT_HOST).to.equal('some.domain.com') +}) + +tap.start() diff --git a/test/test.domain.ts b/test/test.domain.ts new file mode 100644 index 0000000..d8c75f4 --- /dev/null +++ b/test/test.domain.ts @@ -0,0 +1,32 @@ +import * as smartstring from '../ts/index' +import { tap, expect } from 'tapbundle' + +// Domain +let testDomain: smartstring.Domain +let testDomain2: smartstring.Domain +tap.test('expect create a new Domain object', async () => { + testDomain = new smartstring.Domain('https://level3D.level2D.level1D') + expect(testDomain).be.instanceof(smartstring.Domain) + console.log(testDomain) +}) +tap.test('expect have a .topLevel', async () => { + expect(testDomain.topLevel).equal('level1D') +}) +tap.test('expect have a .level2', async () => { + expect(testDomain.level2).equal('level2D') +}) +tap.test('expect have a .level3', async () => { + expect(testDomain.level3).equal('level3D') +}) +tap.test('expect have the correct dns zone name', async () => { + expect(testDomain.zoneName).equal('level2D.level1D') +}) +tap.test('expect have the correct protocol', async () => { + expect(testDomain.protocol).equal('https') +}) +tap.test('testDomain2 expect be a basic domain', async () => { + testDomain2 = new smartstring.Domain('bleu.de') + console.log(testDomain2) +}) + +tap.start() diff --git a/test/test.git.ts b/test/test.git.ts new file mode 100644 index 0000000..0ba3e09 --- /dev/null +++ b/test/test.git.ts @@ -0,0 +1,26 @@ +import * as smartstring from '../ts/index' +import { tap, expect } from 'tapbundle' + +// git +let testGit: smartstring.GitRepo +tap.test('expect create a new Git class GitRepo', async () => { + testGit = new smartstring.GitRepo('git+https://github.com/pushrocks/smartstring.git') + expect(testGit).be.instanceof(smartstring.GitRepo) +}) +tap.test('expect return a .host', async () => { + expect(testGit.host).equal('github.com') +}) +tap.test('expect return a .user', async () => { + expect(testGit.user).equal('pushrocks') +}) +tap.test('expect return a .repo', async () => { + expect(testGit.repo).equal('smartstring') +}) +tap.test('expect return a .httpsUrl', async () => { + expect(testGit.httpsUrl).equal('https://github.com/pushrocks/smartstring.git') +}) +tap.test('expect return a .sshUrl', async () => { + expect(testGit.sshUrl).equal('git@github.com:pushrocks/smartstring.git') +}) + +tap.start() diff --git a/test/test.indent.ts b/test/test.indent.ts new file mode 100644 index 0000000..b59b151 --- /dev/null +++ b/test/test.indent.ts @@ -0,0 +1,28 @@ +import * as smartstring from '../ts/index' +import { tap, expect } from 'tapbundle' + +// indent +let testString = ` +base + expect be indented + some more + +base + indented +` + +// normalize +tap.test('expect normalize a string', async () => { + testString = smartstring.indent.normalize(testString) + console.log(testString) + let zoneNameArg = 'test1' + let destinationIpArg = '111' +}) + +// indent with prefix +tap.test('expect indent', async () => { + testString = smartstring.indent.indentWithPrefix(testString, '>> ') + console.log(testString) +}) + +tap.start() diff --git a/test/test.js b/test/test.js deleted file mode 100644 index bc48f06..0000000 --- a/test/test.js +++ /dev/null @@ -1,112 +0,0 @@ -"use strict"; -require("typings-test"); -const smartstring = require("../dist/index"); -const smartchai_1 = require("smartchai"); -describe('smartstring', function () { - describe('.Base64 class', function () { - let testBase64; - it('expect create a valid instance of Base64', function () { - testBase64 = new smartstring.Base64('somestring', 'string'); - smartchai_1.expect(testBase64).be.instanceOf(smartstring.Base64); - }); - it('expect read output a file as base64 and base64uri', function () { - smartchai_1.expect(testBase64.base64String).not.equal(testBase64.base64UriString); - let testBase64_2 = new smartstring.Base64(testBase64.base64UriString, 'base64uri'); - smartchai_1.expect(testBase64_2.simpleString).equal(testBase64.simpleString); - }); - }); - describe('.Domain class', function () { - let testDomain; - let testDomain2; - it('expect create a new Domain object', function () { - testDomain = new smartstring.Domain('https://level3D.level2D.level1D'); - smartchai_1.expect(testDomain).be.instanceof(smartstring.Domain); - console.log(testDomain); - }); - it('expect have a .topLevel', function () { - smartchai_1.expect(testDomain.topLevel).equal('level1D'); - }); - it('expect have a .level2', function () { - smartchai_1.expect(testDomain.level2).equal('level2D'); - }); - it('expect have a .level3', function () { - smartchai_1.expect(testDomain.level3).equal('level3D'); - }); - it('expect have the correct dns zone name', function () { - smartchai_1.expect(testDomain.zoneName).equal('level2D.level1D'); - }); - it('expect have the correct protocol', function () { - smartchai_1.expect(testDomain.protocol).equal('https'); - }); - it('testDomain2 expect be a basic domain', function () { - testDomain2 = new smartstring.Domain('bleu.de'); - console.log(testDomain2); - }); - }); - describe('.Git class', function () { - let testGit; - it('expect create a new Git class GitRepo', function () { - testGit = new smartstring.GitRepo('git+https://github.com/pushrocks/smartstring.git'); - smartchai_1.expect(testGit).be.instanceof(smartstring.GitRepo); - }); - it('expect return a .host', function () { - smartchai_1.expect(testGit.host).equal('github.com'); - }); - it('expect return a .user', function () { - smartchai_1.expect(testGit.user).equal('pushrocks'); - }); - it('expect return a .repo', function () { - smartchai_1.expect(testGit.repo).equal('smartstring'); - }); - it('expect return a .httpsUrl', function () { - smartchai_1.expect(testGit.httpsUrl).equal('https://github.com/pushrocks/smartstring.git'); - }); - it('expect return a .sshUrl', function () { - smartchai_1.expect(testGit.sshUrl).equal('git@github.com:pushrocks/smartstring.git'); - }); - }); - describe('.docker', function () { - describe('.makeEnvObject', function () { - it('expect create a Env Object', function () { - let envStringArray = ['VIRTUAL_HOST=sub.domain.tld', 'DEFAULT_HOST=some.domain.com']; - let envObject = smartstring.docker.makeEnvObject(envStringArray); - smartchai_1.expect(envObject.VIRTUAL_HOST).to.equal('sub.domain.tld'); - smartchai_1.expect(envObject.DEFAULT_HOST).to.equal('some.domain.com'); - }); - }); - }); - describe('.indent', function () { - let testString = ` - base - expect be indented - some more - - base - indented - `; - describe('.normalize()', function () { - it('expect normalize a string', function () { - testString = smartstring.indent.normalize(testString); - console.log(testString); - let zoneNameArg = 'test1'; - let destinationIpArg = '111'; - }); - }); - describe('.indentWithPrefix', function () { - it('expect indent', function () { - testString = smartstring.indent.indentWithPrefix(testString, '>> '); - console.log(testString); - }); - }); - }); - describe('.typescript', function () { - describe('.referenceRegex', function () { - it('expect match reference paths', function () { - smartchai_1.expect(smartstring.typescript.regexReferencePath.test('/// ')).to.be.true; - smartchai_1.expect(smartstring.typescript.regexReferencePath.test("/// ")).to.be.true; - smartchai_1.expect(smartstring.typescript.regexReferencePath.test('/// ')).to.be.false; - }); - }); - }); -}); -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLHdCQUFxQjtBQUNyQiw2Q0FBNEM7QUFDNUMseUNBQWtDO0FBRWxDLFFBQVEsQ0FBQyxhQUFhLEVBQUU7SUFDdEIsUUFBUSxDQUFDLGVBQWUsRUFBRTtRQUN4QixJQUFJLFVBQThCLENBQUE7UUFDbEMsRUFBRSxDQUFDLDBDQUEwQyxFQUFFO1lBQzdDLFVBQVUsR0FBRyxJQUFJLFdBQVcsQ0FBQyxNQUFNLENBQUMsWUFBWSxFQUFFLFFBQVEsQ0FBQyxDQUFBO1lBQzNELGtCQUFNLENBQUMsVUFBVSxDQUFDLENBQUMsRUFBRSxDQUFDLFVBQVUsQ0FBQyxXQUFXLENBQUMsTUFBTSxDQUFDLENBQUE7UUFDdEQsQ0FBQyxDQUFDLENBQUE7UUFDRixFQUFFLENBQUMsbURBQW1ELEVBQUU7WUFDdEQsa0JBQU0sQ0FBQyxVQUFVLENBQUMsWUFBWSxDQUFDLENBQUMsR0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QUNGLFFBQVEsQ0FBQyxhQUFhLEVBQUU7UUFDdEIsUUFBUSxDQUFDLGlCQUFpQixFQUFFO1lBQzFCLEVBQUUsQ0FBQyw4QkFBOEIsRUFBRTtnQkFDakMsa0JBQU0sQ0FDSixXQUFXLENBQUMsVUFBVSxDQUFDLGtCQUFrQixDQUFDLElBQUksQ0FBQyw2QkFBNkIsQ0FBQyxDQUM5RSxDQUFDLEVBQUUsQ0FBQyxFQUFFLENBQUMsSUFBSSxDQUFBO2dCQUNaLGtCQUFNLENBQ0osV0FBVyxDQUFDLFVBQVUsQ0FBQyxrQkFBa0IsQ0FBQyxJQUFJLENBQUMsMkJBQTJCLENBQUMsQ0FDNUUsQ0FBQyxFQUFFLENBQUMsRUFBRSxDQUFDLElBQUksQ0FBQTtnQkFDWixrQkFBTSxDQUNKLFdBQVcsQ0FBQyxVQUFVLENBQUMsa0JBQWtCLENBQUMsSUFBSSxDQUFDLDRCQUE0QixDQUFDLENBQzdFLENBQUMsRUFBRSxDQUFDLEVBQUUsQ0FBQyxLQUFLLENBQUE7WUFDZixDQUFDLENBQUMsQ0FBQTtRQUNKLENBQUMsQ0FBQyxDQUFBO0lBQ0osQ0FBQyxDQUFDLENBQUE7QUFDSixDQUFDLENBQUMsQ0FBQSJ9 \ No newline at end of file diff --git a/test/test.ts b/test/test.ts deleted file mode 100644 index 11d7ac2..0000000 --- a/test/test.ts +++ /dev/null @@ -1,118 +0,0 @@ -import 'typings-test' -import * as smartstring from '../dist/index' -import { expect } from 'smartchai' - -describe('smartstring', function () { - describe('.Base64 class', function () { - let testBase64: smartstring.Base64 - it('expect create a valid instance of Base64', function () { - testBase64 = new smartstring.Base64('somestring', 'string') - expect(testBase64).be.instanceOf(smartstring.Base64) - }) - it('expect read output a file as base64 and base64uri', function () { - expect(testBase64.base64String).not.equal(testBase64.base64UriString) - let testBase64_2 = new smartstring.Base64(testBase64.base64UriString, 'base64uri') - expect(testBase64_2.simpleString).equal(testBase64.simpleString) - }) - }) - describe('.Domain class', function () { - let testDomain: smartstring.Domain - let testDomain2: smartstring.Domain - it('expect create a new Domain object', function () { - testDomain = new smartstring.Domain('https://level3D.level2D.level1D') - expect(testDomain).be.instanceof(smartstring.Domain) - console.log(testDomain) - }) - it('expect have a .topLevel', function () { - expect(testDomain.topLevel).equal('level1D') - }) - it('expect have a .level2', function () { - expect(testDomain.level2).equal('level2D') - }) - it('expect have a .level3', function () { - expect(testDomain.level3).equal('level3D') - }) - it('expect have the correct dns zone name', function () { - expect(testDomain.zoneName).equal('level2D.level1D') - }) - it('expect have the correct protocol', function () { - expect(testDomain.protocol).equal('https') - }) - it('testDomain2 expect be a basic domain', function () { - testDomain2 = new smartstring.Domain('bleu.de') - console.log(testDomain2) - }) - }) - describe('.Git class', function () { - let testGit: smartstring.GitRepo - it('expect create a new Git class GitRepo', function () { - testGit = new smartstring.GitRepo('git+https://github.com/pushrocks/smartstring.git') - expect(testGit).be.instanceof(smartstring.GitRepo) - }) - it('expect return a .host', function () { - expect(testGit.host).equal('github.com') - }) - it('expect return a .user', function () { - expect(testGit.user).equal('pushrocks') - }) - it('expect return a .repo', function () { - expect(testGit.repo).equal('smartstring') - }) - it('expect return a .httpsUrl', function () { - expect(testGit.httpsUrl).equal('https://github.com/pushrocks/smartstring.git') - }) - it('expect return a .sshUrl', function () { - expect(testGit.sshUrl).equal('git@github.com:pushrocks/smartstring.git') - }) - }) - describe('.docker', function () { - describe('.makeEnvObject', function () { - it('expect create a Env Object', function () { - let envStringArray = [ 'VIRTUAL_HOST=sub.domain.tld', 'DEFAULT_HOST=some.domain.com' ] - let envObject: any = smartstring.docker.makeEnvObject(envStringArray) - expect(envObject.VIRTUAL_HOST).to.equal('sub.domain.tld') - expect(envObject.DEFAULT_HOST).to.equal('some.domain.com') - }) - }) - }) - describe('.indent', function () { - let testString = ` - base - expect be indented - some more - - base - indented - ` - describe('.normalize()', function () { - it('expect normalize a string', function () { - testString = smartstring.indent.normalize(testString) - console.log(testString) - let zoneNameArg = 'test1' - let destinationIpArg = '111' - }) - }) - - describe('.indentWithPrefix', function () { - it('expect indent', function () { - testString = smartstring.indent.indentWithPrefix(testString, '>> ') - console.log(testString) - }) - }) - }) - describe('.typescript', function () { - describe('.referenceRegex', function () { - it('expect match reference paths', function () { - expect( - smartstring.typescript.regexReferencePath.test('/// ') - ).to.be.true - expect( - smartstring.typescript.regexReferencePath.test("/// ") - ).to.be.true - expect( - smartstring.typescript.regexReferencePath.test('/// ') - ).to.be.false - }) - }) - }) -}) diff --git a/test/test.typescript.ts b/test/test.typescript.ts new file mode 100644 index 0000000..e0fcafe --- /dev/null +++ b/test/test.typescript.ts @@ -0,0 +1,22 @@ +import * as smartstring from '../ts/index' +import { tap, expect } from 'tapbundle' + +// typscript +tap.test('expect match reference paths', async () => { + // tslint:disable-next-line:no-unused-expression + expect( + smartstring.typescript.regexReferencePath.test('/// ') + ).to.be.true + + // tslint:disable-next-line:no-unused-expression + expect( + smartstring.typescript.regexReferencePath.test("/// ") + ).to.be.true + + // tslint:disable-next-line:no-unused-expression + expect( + smartstring.typescript.regexReferencePath.test('/// ') + ).to.be.false +}) + +tap.start() diff --git a/ts/index.ts b/ts/index.ts index 9ab7759..058e075 100644 --- a/ts/index.ts +++ b/ts/index.ts @@ -1,11 +1,13 @@ import * as docker from './smartstring.docker' import * as indent from './smartstring.indent' +import * as normalize from './smartstring.normalize' import * as typescript from './smartstring.typescript' export { - docker, - typescript, - indent + docker, + typescript, + normalize, + indent } export { Base64, base64 } from './smartstring.base64' diff --git a/ts/smartstring.base64.ts b/ts/smartstring.base64.ts index fc79767..673fa1b 100644 --- a/ts/smartstring.base64.ts +++ b/ts/smartstring.base64.ts @@ -9,61 +9,61 @@ export type TBase64Input = 'string' | 'base64' | 'base64uri' * handle base64 strings */ export class Base64 { - private refString: string - constructor(inputStringArg, typeArg: TBase64Input) { - switch (typeArg) { - case 'string': // easiest case - this.refString = inputStringArg - break - case 'base64': - this.refString = base64.decode(inputStringArg) - break - case 'base64uri': - this.refString = base64.decode(inputStringArg) - } + private refString: string + constructor(inputStringArg, typeArg: TBase64Input) { + switch (typeArg) { + case 'string': // easiest case + this.refString = inputStringArg + break + case 'base64': + this.refString = base64.decode(inputStringArg) + break + case 'base64uri': + this.refString = base64.decode(inputStringArg) } + } - /** - * the simple string (unencoded) - */ - get simpleString() { - return this.refString - } + /** + * the simple string (unencoded) + */ + get simpleString () { + return this.refString + } - /** - * the base64 encoded version of the original string - */ - get base64String() { - return base64.encode(this.refString) - } + /** + * the base64 encoded version of the original string + */ + get base64String () { + return base64.encode(this.refString) + } - /** - * the base64uri encoded version of the original string - */ - get base64UriString() { - return base64.encodeUri(this.refString) - } + /** + * the base64uri encoded version of the original string + */ + get base64UriString () { + return base64.encodeUri(this.refString) + } } export let base64 = { - /** - * encodes the string - */ - encode: (stringArg: string) => { - return plugins.jsBase64.encode(stringArg) - }, + /** + * encodes the string + */ + encode: (stringArg: string) => { + return plugins.jsBase64.encode(stringArg) + }, - /** - * encodes a stringArg to base64 uri style - */ - encodeUri: (stringArg: string) => { - return plugins.jsBase64.encodeURI(stringArg) - }, + /** + * encodes a stringArg to base64 uri style + */ + encodeUri: (stringArg: string) => { + return plugins.jsBase64.encodeURI(stringArg) + }, - /** - * decodes a base64 encoded string - */ - decode: (stringArg: string) => { - return plugins.jsBase64.decode(stringArg) - } + /** + * decodes a base64 encoded string + */ + decode: (stringArg: string) => { + return plugins.jsBase64.decode(stringArg) + } } diff --git a/ts/smartstring.docker.ts b/ts/smartstring.docker.ts index 44104c3..37021df 100644 --- a/ts/smartstring.docker.ts +++ b/ts/smartstring.docker.ts @@ -6,13 +6,13 @@ import * as plugins from './smartstring.plugins' * @returns {} */ export let makeEnvObject = function (envArrayArg: string[]) { - let returnObject = {} - let regexString = /(.*)=(.*)/ - if (typeof envArrayArg !== 'undefined') { - for (let envKey in envArrayArg) { - let regexMatches = regexString.exec(envArrayArg[envKey]) - returnObject[regexMatches[1]] = regexMatches[2] - }; + let returnObject = {} + let regexString = /(.*)=(.*)/ + if (typeof envArrayArg !== 'undefined') { + for (let envKey in envArrayArg) { + let regexMatches = regexString.exec(envArrayArg[ envKey ]) + returnObject[ regexMatches[ 1 ] ] = regexMatches[ 2 ] } - return returnObject + } + return returnObject } diff --git a/ts/smartstring.domain.ts b/ts/smartstring.domain.ts index a2c2699..d1fd5d8 100644 --- a/ts/smartstring.domain.ts +++ b/ts/smartstring.domain.ts @@ -1,62 +1,62 @@ import * as plugins from './smartstring.plugins'; export class Domain { - fullName: string - level1: string - level2: string - level3: string - level4: string - level5: string - protocol: string - zoneName: string - // aliases - topLevel: string - domainName - subDomain - constructor(domainStringArg:string){ - let regexMatches = domainRegex(domainStringArg); - this.fullName = '' - for (let i = 1; i <= 5; i++) { - if (regexMatches[i - 1]) { - let localMatch = regexMatches[i - 1] - this['level' + i.toString()] = localMatch - if (this.fullName === ''){ - this.fullName = localMatch - } else { - this.fullName = localMatch + '.' + this.fullName - } - } else { - this['level' + i.toString()] = undefined - }; - }; - this.protocol = protocolRegex(domainStringArg) - this.zoneName = this.level2 + '.' + this.level1 + fullName: string + level1: string + level2: string + level3: string + level4: string + level5: string + protocol: string + zoneName: string + // aliases + topLevel: string + domainName + subDomain + constructor(domainStringArg: string) { + let regexMatches = domainRegex(domainStringArg); + this.fullName = '' + for (let i = 1; i <= 5; i++) { + if (regexMatches[ i - 1 ]) { + let localMatch = regexMatches[ i - 1 ] + this[ 'level' + i.toString() ] = localMatch + if (this.fullName === '') { + this.fullName = localMatch + } else { + this.fullName = localMatch + '.' + this.fullName + } + } else { + this[ 'level' + i.toString() ] = undefined + }; + }; + this.protocol = protocolRegex(domainStringArg) + this.zoneName = this.level2 + '.' + this.level1 - // aliases - this.topLevel = this.level1 - this.domainName = this.level2 - this.subDomain = this.level3 - } + // aliases + this.topLevel = this.level1 + this.domainName = this.level2 + this.subDomain = this.level3 + } } -let domainRegex = function(stringArg:string){ - let regexString = /([a-zA-Z0-9\-\_]*)\.{0,1}([a-zA-Z0-9\-\_]*)\.{0,1}([a-zA-Z0-9\-\_]*)\.{0,1}([a-zA-Z0-9\-\_]*)\.{0,1}([a-zA-Z0-9\-\_]*)\.{0,1}$/ - let regexMatches = regexString.exec(stringArg) - regexMatches.reverse() //make sure we build the domain from toplevel to subdomain (reversed order) - regexMatches.pop() // pop the last element, which is, since we reversed the Array, the full String of matched elements - let regexMatchesFiltered = regexMatches.filter(function(stringArg:string){ - return(stringArg !== '') - }); - return regexMatchesFiltered +let domainRegex = function (stringArg: string) { + let regexString = /([a-zA-Z0-9\-\_]*)\.{0,1}([a-zA-Z0-9\-\_]*)\.{0,1}([a-zA-Z0-9\-\_]*)\.{0,1}([a-zA-Z0-9\-\_]*)\.{0,1}([a-zA-Z0-9\-\_]*)\.{0,1}$/ + let regexMatches = regexString.exec(stringArg) + regexMatches.reverse() //make sure we build the domain from toplevel to subdomain (reversed order) + regexMatches.pop() // pop the last element, which is, since we reversed the Array, the full String of matched elements + let regexMatchesFiltered = regexMatches.filter(function (stringArg: string) { + return (stringArg !== '') + }); + return regexMatchesFiltered }; -let protocolRegex = function(stringArg:string){ - let regexString = /^([a-zA-Z0-9]*):\/\// - let regexMatches = regexString.exec(stringArg) - if(regexMatches) { - return regexMatches[1] - } else { - return undefined - } +let protocolRegex = function (stringArg: string) { + let regexString = /^([a-zA-Z0-9]*):\/\// + let regexMatches = regexString.exec(stringArg) + if (regexMatches) { + return regexMatches[ 1 ] + } else { + return undefined + } } diff --git a/ts/smartstring.git.ts b/ts/smartstring.git.ts index 9757de3..19442f8 100644 --- a/ts/smartstring.git.ts +++ b/ts/smartstring.git.ts @@ -4,49 +4,49 @@ import * as plugins from './smartstring.plugins' * ------------------ classes ------------------- * * ---------------------------------------------- */ export class GitRepo { - host: string - user: string - repo: string - accessToken: string - sshUrl: string - httpsUrl: string - constructor(stringArg: string,tokenArg?: string) { - let regexMatches = gitRegex(stringArg) - this.host = regexMatches[1] - this.user = regexMatches[2] - this.repo = regexMatches[3] - this.accessToken = tokenArg - this.sshUrl = gitLink(this.host,this.user,this.repo,this.accessToken, 'ssh') - this.httpsUrl = gitLink(this.host,this.user,this.repo,this.accessToken, 'https') - } + host: string + user: string + repo: string + accessToken: string + sshUrl: string + httpsUrl: string + constructor (stringArg: string, tokenArg?: string) { + let regexMatches = gitRegex(stringArg) + this.host = regexMatches[ 1 ] + this.user = regexMatches[ 2 ] + this.repo = regexMatches[ 3 ] + this.accessToken = tokenArg + this.sshUrl = gitLink(this.host, this.user, this.repo, this.accessToken, 'ssh') + this.httpsUrl = gitLink(this.host, this.user, this.repo, this.accessToken, 'https') + } } /* ---------------------------------------------- * * ------------------ helpers ------------------- * * ---------------------------------------------- */ -let gitRegex = function(stringArg:string){ - let regexString = /([a-zA-Z0-9\-\.]*)(?:\/|\:)([a-zA-Z0-9\-\.]*)(?:\/)([a-zA-Z0-9\-\.]*)(?:\.git)/ - let regexMatches = regexString.exec(stringArg) - return regexMatches +let gitRegex = function (stringArg: string) { + let regexString = /([a-zA-Z0-9\-\.]*)(?:\/|\:)([a-zA-Z0-9\-\.]*)(?:\/)([a-zA-Z0-9\-\.]*)(?:\.git)/ + let regexMatches = regexString.exec(stringArg) + return regexMatches } -let gitLink = function(hostArg: string, userArg: string, repoArg: string, tokenArg: string = '', linkTypeArg): string{ - let returnString - if (tokenArg !== '') { - tokenArg = tokenArg + '@' - } - switch (linkTypeArg) { - case 'https': - returnString = 'https://' + - tokenArg + hostArg + '/' + userArg + '/' + repoArg + '.git' - break - case 'ssh': - returnString = 'git@' + - hostArg + ':' + userArg + '/' + repoArg + '.git'; - break - default: - console.error('Link Type ' + linkTypeArg + ' not known') - break - } - return returnString +let gitLink = function (hostArg: string, userArg: string, repoArg: string, tokenArg: string = '', linkTypeArg): string { + let returnString + if (tokenArg !== '') { + tokenArg = tokenArg + '@' + } + switch (linkTypeArg) { + case 'https': + returnString = 'https://' + + tokenArg + hostArg + '/' + userArg + '/' + repoArg + '.git' + break + case 'ssh': + returnString = 'git@' + + hostArg + ':' + userArg + '/' + repoArg + '.git' + break + default: + console.error('Link Type ' + linkTypeArg + ' not known') + break + } + return returnString } diff --git a/ts/smartstring.indent.ts b/ts/smartstring.indent.ts index a795a8d..f44f6df 100644 --- a/ts/smartstring.indent.ts +++ b/ts/smartstring.indent.ts @@ -1,64 +1,90 @@ import * as plugins from './smartstring.plugins' -let splitString = (stringArg: string): string[] => { - let resultArray = stringArg.split('\n') - return cleanStringArray(resultArray) -}; - -let joinString = (stringArrayArg: string[]): string => { - let resultString: string = '' - for (let line of stringArrayArg){ - resultString = resultString + line + '\n' - } - return resultString +/** + * splits a string into an array + * @param stringArg + */ +let splitStringAtLineBreak = (stringArg: string): string[] => { + let resultArray = stringArg.split('\n') + return cleanStringArray(resultArray) } +/** + * joins a string together again + * @param stringArrayArg + */ +let joinStringWithLineBreaks = (stringArrayArg: string[]): string => { + let resultString: string = '' + for (let line of stringArrayArg) { + resultString = resultString + line + '\n' // add new line at end + } + return resultString +} + +/** + * cleans first and last line in case they are empty + * @param stringArrayArg + */ let cleanStringArray = (stringArrayArg: string[]): string[] => { - let testRegex = /^[\s]*$/ - if (testRegex.test(stringArrayArg[0])) { - stringArrayArg.shift() - } - if (testRegex.test(stringArrayArg[stringArrayArg.length - 1])) { - stringArrayArg.pop() - }; - return stringArrayArg + let testRegex = /^[\s]*$/ + if (testRegex.test(stringArrayArg[ 0 ])) { + stringArrayArg.shift() + } + if (testRegex.test(stringArrayArg[ stringArrayArg.length - 1 ])) { + stringArrayArg.pop() + } + return stringArrayArg } +/** + * indent an array + * @param stringArg + * @param spaceAmount + */ export let indent = (stringArg: string, spaceAmount: number): string => { - let resultString: string - return resultString + let localStringArray = splitStringAtLineBreak(stringArg) + for (let stringArg of localStringArray) { + stringArg = ' '.repeat(spaceAmount) + stringArg + } + let resultString = joinStringWithLineBreaks(localStringArray) + return resultString } -export let indentWithPrefix = (stringArg: string,prefixArg: string): string => { - let resultString: string - let stringArray = splitString(stringArg) - let resultArray: string[] = [] - for (let stringItem of stringArray){ - resultArray.push(prefixArg + stringItem) - }; - resultString = joinString(resultArray) - return resultString +/** + * indents a string with prefix + * @param stringArg + * @param prefixArg + */ +export let indentWithPrefix = (stringArg: string, prefixArg: string): string => { + let resultString: string + let stringArray = splitStringAtLineBreak(stringArg) + let resultArray: string[] = [] + for (let stringItem of stringArray) { + resultArray.push(prefixArg + stringItem) + } + resultString = joinStringWithLineBreaks(resultArray) + return resultString } export let normalize = (stringArg: string): string => { - let resultString: string - let splitStringArray: string[] = splitString(stringArg) - let minCommonLeftOffset: number - let deIndentRegex = /^(\s*)/ - let emptyLineRegex = /^(\s*)$/ - for (let stringItem of splitStringArray){ - let offsetString = deIndentRegex.exec(stringItem)[1] - if ( - (typeof minCommonLeftOffset === 'undefined' || offsetString.length < minCommonLeftOffset) - && !emptyLineRegex.test(stringItem) - ) { - minCommonLeftOffset = offsetString.length - } - }; - let resultSplitStringArray = [] - for (let stringItem of splitStringArray) { - resultSplitStringArray.push(stringItem.substr(minCommonLeftOffset)) - }; - resultString = joinString(resultSplitStringArray) - return resultString + let resultString: string + let splitStringArray: string[] = splitStringAtLineBreak(stringArg) + let minCommonLeftOffset: number + let deIndentRegex = /^(\s*)/ + let emptyLineRegex = /^(\s*)$/ + for (let stringItem of splitStringArray) { + let offsetString = deIndentRegex.exec(stringItem)[ 1 ] + if ( + (typeof minCommonLeftOffset === 'undefined' || offsetString.length < minCommonLeftOffset) + && !emptyLineRegex.test(stringItem) + ) { + minCommonLeftOffset = offsetString.length + } + }; + let resultSplitStringArray = [] + for (let stringItem of splitStringArray) { + resultSplitStringArray.push(stringItem.substr(minCommonLeftOffset)) + } + resultString = joinStringWithLineBreaks(resultSplitStringArray) + return resultString } diff --git a/ts/smartstring.normalize.ts b/ts/smartstring.normalize.ts new file mode 100644 index 0000000..1f6233f --- /dev/null +++ b/ts/smartstring.normalize.ts @@ -0,0 +1,22 @@ +import * as plugins from './smartstring.plugins' + +/** + * replaces all occurences of something in a string + * @param stringArg + * @param searchRegExp + * @param replacementString + */ +export let replaceAll = (stringArg: string, searchRegExp: any, replacementString: string) => { + return stringArg.replace(new RegExp(searchRegExp, 'g'), replacementString) +} + +/** + * normalizes a string + * @param stringArg + */ +export let standard = (stringArg: string): string => { + let fix1 = plugins.stripIndent(stringArg) // fix indention + let fix2 = plugins.normalizeNewline(fix1) // fix newlines + let fix3 = replaceAll(fix2, /\t/, ' ') // fix tabs + return fix3 +} diff --git a/ts/smartstring.plugins.ts b/ts/smartstring.plugins.ts index ace8409..a3acf2d 100644 --- a/ts/smartstring.plugins.ts +++ b/ts/smartstring.plugins.ts @@ -1,2 +1,5 @@ import 'typings-global' export let jsBase64 = require('js-base64').Base64 + +export let stripIndent = require('strip-indent') +export let normalizeNewline = require('normalize-newline') diff --git a/yarn.lock b/yarn.lock index bc49946..3e7d1ff 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10,41 +10,53 @@ "@types/promises-a-plus" "*" "@types/chai-string@^1.1.30": - version "1.1.30" - resolved "https://registry.yarnpkg.com/@types/chai-string/-/chai-string-1.1.30.tgz#4d8744b31a5a2295fc01c981ed1e2d4c8a070f0a" + version "1.1.31" + resolved "https://registry.yarnpkg.com/@types/chai-string/-/chai-string-1.1.31.tgz#a22f75d713f69da8c5cf34f8bc808a62cd249405" dependencies: "@types/chai" "*" -"@types/chai@*", "@types/chai@^3.4.35": - version "3.4.35" - resolved "https://registry.yarnpkg.com/@types/chai/-/chai-3.4.35.tgz#e8d65f83492d2944f816fc620741821c28a8c900" +"@types/chai@*": + version "4.0.4" + resolved "https://registry.yarnpkg.com/@types/chai/-/chai-4.0.4.tgz#fe86315d9a66827feeb16f73bc954688ec950e18" -"@types/lodash@4.x.x": - version "4.14.52" - resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.52.tgz#de5c7ab14da1289733233c9b0ec6f9e377db90f5" +"@types/chai@^3.4.35": + version "3.5.2" + resolved "https://registry.yarnpkg.com/@types/chai/-/chai-3.5.2.tgz#c11cd2817d3a401b7ba0f5a420f35c56139b1c1e" -"@types/mocha@^2.2.31": - version "2.2.39" - resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-2.2.39.tgz#f68d63db8b69c38e9558b4073525cf96c4f7a829" +"@types/glob@*": + version "5.0.33" + resolved "https://registry.yarnpkg.com/@types/glob/-/glob-5.0.33.tgz#3dff7c6ce09d65abe919c7961dc3dee016f36ad7" + dependencies: + "@types/minimatch" "*" + "@types/node" "*" + +"@types/lodash@^4.14.55": + version "4.14.77" + resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.77.tgz#0bc699413e84d6ed5d927ca30ea0f0a890b42d75" + +"@types/minimatch@*": + version "3.0.1" + resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.1.tgz#b683eb60be358304ef146f5775db4c0e3696a550" "@types/node@*": - version "7.0.5" - resolved "https://registry.yarnpkg.com/@types/node/-/node-7.0.5.tgz#96a0f0a618b7b606f1ec547403c00650210bfbb7" + version "8.0.32" + resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.32.tgz#869a716538b6eec65ab3893f183d557be3cda206" "@types/promises-a-plus@*": version "0.0.27" resolved "https://registry.yarnpkg.com/@types/promises-a-plus/-/promises-a-plus-0.0.27.tgz#c64651134614c84b8f5d7114ce8901d36a609780" -"@types/q@0.x.x": - version "0.0.32" - resolved "https://registry.yarnpkg.com/@types/q/-/q-0.0.32.tgz#bd284e57c84f1325da702babfc82a5328190c0c5" - -"@types/shelljs@^0.3.33": - version "0.3.33" - resolved "https://registry.yarnpkg.com/@types/shelljs/-/shelljs-0.3.33.tgz#df613bddb88225ed09ce5c835f620dcaaf155e6b" +"@types/shelljs@^0.7.4": + version "0.7.4" + resolved "https://registry.yarnpkg.com/@types/shelljs/-/shelljs-0.7.4.tgz#137b5f31306eaff4de120ffe5b9d74b297809cfc" dependencies: + "@types/glob" "*" "@types/node" "*" +"@types/which@^1.0.28": + version "1.0.28" + resolved "https://registry.yarnpkg.com/@types/which/-/which-1.0.28.tgz#016e387629b8817bed653fe32eab5d11279c8df6" + ansi-256-colors@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/ansi-256-colors/-/ansi-256-colors-1.1.0.tgz#910de50efcc7c09e3d82f2f87abd6b700c18818a" @@ -61,35 +73,39 @@ assertion-error@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/assertion-error/-/assertion-error-1.0.2.tgz#13ca515d86206da0bac66e834dd397d87581094c" -balanced-match@^0.4.1: - version "0.4.2" - resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-0.4.2.tgz#cb3f3e3c732dc0f01ee70b403f302e61d7709838" +balanced-match@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" -beautycolor@^1.0.5: - version "1.0.7" - resolved "https://registry.yarnpkg.com/beautycolor/-/beautycolor-1.0.7.tgz#a4715738ac4c8221371e9cbeb5a6cc6d11ecbf7c" +beautycolor@^1.0.7: + version "1.0.11" + resolved "https://registry.yarnpkg.com/beautycolor/-/beautycolor-1.0.11.tgz#71c5568d5a7ed5c144d3a54f753ad1b08862aea5" dependencies: ansi-256-colors "^1.1.0" typings-global "^1.0.14" -beautylog@^6.1.1: - version "6.1.1" - resolved "https://registry.yarnpkg.com/beautylog/-/beautylog-6.1.1.tgz#2a83603ad7e2a0a09701ac63d7d3064a588dc779" +beautylog@^6.1.10: + version "6.1.10" + resolved "https://registry.yarnpkg.com/beautylog/-/beautylog-6.1.10.tgz#9c27e566937684cb689f9372d98cfa5415d50b72" dependencies: - "@types/lodash" "4.x.x" - beautycolor "^1.0.5" + "@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.0.4" + smartq "^1.1.1" typings-global "^1.0.14" -brace-expansion@^1.0.0: - version "1.1.6" - resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.6.tgz#7197d7eaa9b87e648390ea61fc66c84427420df9" +bindings@^1.2.1: + version "1.3.0" + resolved "https://registry.yarnpkg.com/bindings/-/bindings-1.3.0.tgz#b346f6ecf6a95f5a815c5839fc7cdb22502f1ed7" + +brace-expansion@^1.1.7: + version "1.1.8" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.8.tgz#c07b211c7c952ec1f8efd51a77ef0d1d3990a292" dependencies: - balanced-match "^0.4.1" + balanced-match "^1.0.0" concat-map "0.0.1" chai-as-promised@^6.0.0: @@ -99,8 +115,8 @@ chai-as-promised@^6.0.0: check-error "^1.0.2" chai-string@^1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/chai-string/-/chai-string-1.3.0.tgz#df6139f294391b1035be5606f60a843b3a5041e7" + version "1.4.0" + resolved "https://registry.yarnpkg.com/chai-string/-/chai-string-1.4.0.tgz#359140c051d36a4e4b1a5fc6b910152f438a8d49" chai@^3.5.0: version "3.5.0" @@ -131,8 +147,8 @@ cli-cursor@^2.1.0: 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" + version "1.0.1" + resolved "https://registry.yarnpkg.com/cli-spinners/-/cli-spinners-1.0.1.tgz#2675321c100f195b02877ac499e9911fa34b9783" concat-map@0.0.1: version "0.0.1" @@ -144,6 +160,43 @@ deep-eql@^0.1.3: dependencies: type-detect "0.1.1" +define-properties@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.2.tgz#83a73f2fea569898fb737193c8f873caf6d45c94" + dependencies: + foreach "^2.0.5" + object-keys "^1.0.8" + +early@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/early/-/early-2.1.1.tgz#841e23254ea5dc54d8afaeee82f5ab65c00ee23c" + dependencies: + beautycolor "^1.0.7" + smartq "^1.1.1" + typings-global "^1.0.16" + +es-abstract@^1.5.1: + version "1.9.0" + resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.9.0.tgz#690829a07cae36b222e7fd9b75c0d0573eb25227" + dependencies: + es-to-primitive "^1.1.1" + function-bind "^1.1.1" + has "^1.0.1" + is-callable "^1.1.3" + is-regex "^1.0.4" + +es-to-primitive@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/es-to-primitive/-/es-to-primitive-1.1.1.tgz#45355248a88979034b6792e19bb81f2b7975dd0d" + dependencies: + is-callable "^1.1.1" + is-date-object "^1.0.1" + is-symbol "^1.0.1" + +es6-error@^4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/es6-error/-/es6-error-4.0.2.tgz#eec5c726eacef51b7f6b73c20db6e1b13b069c98" + escape-string-regexp@^1.0.2: version "1.0.5" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" @@ -152,18 +205,26 @@ figlet@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/figlet/-/figlet-1.2.0.tgz#6c46537378fab649146b5a6143dda019b430b410" +foreach@^2.0.5: + version "2.0.5" + resolved "https://registry.yarnpkg.com/foreach/-/foreach-2.0.5.tgz#0bee005018aeb260d0a3af3ae658dd0136ec1b99" + fs.realpath@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" +function-bind@^1.0.2, function-bind@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" + glob@^7.0.0: - version "7.1.1" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.1.tgz#805211df04faaf1c63a3600306cdf5ade50b2ec8" + version "7.1.2" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15" dependencies: fs.realpath "^1.0.0" inflight "^1.0.4" inherits "2" - minimatch "^3.0.2" + minimatch "^3.0.4" once "^1.3.0" path-is-absolute "^1.0.0" @@ -173,6 +234,12 @@ has-ansi@^2.0.0: dependencies: ansi-regex "^2.0.0" +has@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/has/-/has-1.0.1.tgz#8461733f538b0837c9361e39a9ab9e9704dc2f28" + dependencies: + function-bind "^1.0.2" + inflight@^1.0.4: version "1.0.6" resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" @@ -185,14 +252,50 @@ inherits@2: resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" interpret@^1.0.0: + version "1.0.4" + resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.0.4.tgz#820cdd588b868ffb191a809506d6c9c8f212b1b0" + +is-callable@^1.1.1, is-callable@^1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.1.3.tgz#86eb75392805ddc33af71c92a0eedf74ee7604b2" + +is-date-object@^1.0.1: version "1.0.1" - resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.0.1.tgz#d579fb7f693b858004947af39fa0db49f795602c" + resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.0.1.tgz#9aa20eb6aeebbff77fbd33e74ca01b33581d3a16" -js-base64@^2.1.9: - version "2.1.9" - resolved "https://registry.yarnpkg.com/js-base64/-/js-base64-2.1.9.tgz#f0e80ae039a4bd654b5f281fc93f04a914a7fcce" +is-regex@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.0.4.tgz#5517489b547091b0930e095654ced25ee97e9491" + dependencies: + has "^1.0.1" -lodash@^4.17.2, lodash@^4.17.4: +is-symbol@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.1.tgz#3cc59f00025194b6ab2e38dbae6689256b660572" + +isexe@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" + +js-base64@^2.3.2: + version "2.3.2" + resolved "https://registry.yarnpkg.com/js-base64/-/js-base64-2.3.2.tgz#a79a923666372b580f8e27f51845c6f7e8fbfbaf" + +leakage@^0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/leakage/-/leakage-0.3.0.tgz#15d698abdc76bbc6439601f4f3020e77e2d50c39" + dependencies: + es6-error "^4.0.2" + left-pad "^1.1.3" + memwatch-next "^0.3.0" + minimist "^1.2.0" + pretty-bytes "^4.0.2" + +left-pad@^1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/left-pad/-/left-pad-1.1.3.tgz#612f61c033f3a9e08e939f1caebeea41b6f3199a" + +lodash@^4.17.4: version "4.17.4" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae" @@ -202,24 +305,45 @@ log-symbols@^1.0.2: dependencies: chalk "^1.0.0" +memwatch-next@^0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/memwatch-next/-/memwatch-next-0.3.0.tgz#2111050f9a906e0aa2d72a4ec0f0089c78726f8f" + dependencies: + bindings "^1.2.1" + nan "^2.3.2" + mimic-fn@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.1.0.tgz#e667783d92e89dbd342818b5230b9d62a672ad18" -minimatch@^3.0.2: - version "3.0.3" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.3.tgz#2a4e4090b96b2db06a9d7df01055a62a77c9b774" +minimatch@^3.0.4: + version "3.0.4" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" dependencies: - brace-expansion "^1.0.0" + brace-expansion "^1.1.7" -npmts-g@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/npmts-g/-/npmts-g-6.0.0.tgz#491fd50f110967f1b68f14237e7ea5157bf4ddb3" +minimist@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" + +nan@^2.3.2: + version "2.7.0" + resolved "https://registry.yarnpkg.com/nan/-/nan-2.7.0.tgz#d95bf721ec877e08db276ed3fc6eb78f9083ad46" + +normalize-newline@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/normalize-newline/-/normalize-newline-3.0.0.tgz#1cbea804aba436001f83938ab21ec039d69ae9d3" + +object-keys@^1.0.8: + version "1.0.11" + resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.0.11.tgz#c54601778ad560f1142ce0e01bcca8b56d13426d" + +object.getownpropertydescriptors@^2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.0.3.tgz#8758c846f5b407adab0f236e0986f14b051caa16" dependencies: - "@types/shelljs" "^0.3.33" - semver "^5.3.0" - shelljs "^0.7.5" - typings-global "^1.0.14" + define-properties "^1.1.2" + es-abstract "^1.5.1" once@^1.3.0: version "1.4.0" @@ -228,14 +352,14 @@ once@^1.3.0: wrappy "1" onetime@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/onetime/-/onetime-2.0.0.tgz#52aa8110e52fc5126ffc667bd8ec21c2ed209ce6" + version "2.0.1" + resolved "https://registry.yarnpkg.com/onetime/-/onetime-2.0.1.tgz#067428230fd67443b2794b22bba528b6867962d4" dependencies: mimic-fn "^1.0.0" ora@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/ora/-/ora-1.1.0.tgz#69aaa4a209630e43b142c5f7ff41820da87e2faf" + version "1.3.0" + resolved "https://registry.yarnpkg.com/ora/-/ora-1.3.0.tgz#80078dd2b92a934af66a3ad72a5b910694ede51a" dependencies: chalk "^1.1.1" cli-cursor "^2.1.0" @@ -246,9 +370,13 @@ path-is-absolute@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" -q@^1.4.1: - version "1.4.1" - resolved "https://registry.yarnpkg.com/q/-/q-1.4.1.tgz#55705bcd93c5f3673530c2c2cbc0c2b3addc286e" +path-parse@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.5.tgz#3c1adf871ea9cd6c9431b6ea2bd74a0ff055c4c1" + +pretty-bytes@^4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/pretty-bytes/-/pretty-bytes-4.0.2.tgz#b2bf82e7350d65c6c33aa95aaa5a4f6327f61cd9" rechoir@^0.6.2: version "0.6.2" @@ -257,8 +385,10 @@ rechoir@^0.6.2: resolve "^1.1.6" resolve@^1.1.6: - version "1.2.0" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.2.0.tgz#9589c3f2f6149d1417a40becc1663db6ec6bc26c" + version "1.4.0" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.4.0.tgz#a75be01c53da25d934a98ebd0e4c4a7312f92a86" + dependencies: + path-parse "^1.0.5" restore-cursor@^2.0.0: version "2.0.0" @@ -268,12 +398,12 @@ restore-cursor@^2.0.0: signal-exit "^3.0.2" semver@^5.3.0: - version "5.3.0" - resolved "https://registry.yarnpkg.com/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f" + version "5.4.1" + resolved "https://registry.yarnpkg.com/semver/-/semver-5.4.1.tgz#e059c09d8571f0540823733433505d3a2f00b18e" -shelljs@^0.7.4, shelljs@^0.7.5: - version "0.7.6" - resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.7.6.tgz#379cccfb56b91c8601e4793356eb5382924de9ad" +shelljs@^0.7.8: + version "0.7.8" + resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.7.8.tgz#decbcf874b0d1e5fb72e14b164a9683048e9acb3" dependencies: glob "^7.0.0" interpret "^1.0.0" @@ -294,21 +424,38 @@ smartchai@^1.0.3: chai-as-promised "^6.0.0" chai-string "^1.3.0" -smartenv@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/smartenv/-/smartenv-2.0.0.tgz#ede4e2044efcf9bec318388bb1dab53024ee3d16" +smartdelay@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/smartdelay/-/smartdelay-1.0.3.tgz#5fd44dad77262d110702f0293efa80c072cfb579" dependencies: - "@types/q" "0.x.x" - lodash "^4.17.2" - q "^1.4.1" + smartq "^1.1.1" + typings-global "^1.0.16" + +smartenv@^2.0.0: + version "2.0.6" + resolved "https://registry.yarnpkg.com/smartenv/-/smartenv-2.0.6.tgz#b38c679b0c151b9af548f68c3a072c29d1417e8d" + dependencies: + lodash "^4.17.4" + smartq "^1.1.1" typings-global "^1.0.14" -smartq@^1.0.4: - version "1.1.1" - resolved "https://registry.yarnpkg.com/smartq/-/smartq-1.1.1.tgz#efb358705260d41ae18aef7ffd815f7b6fe17dd3" +smartq@^1.1.1, smartq@^1.1.6: + version "1.1.6" + resolved "https://registry.yarnpkg.com/smartq/-/smartq-1.1.6.tgz#0c1ff4336d95e95b4f1fdd8ccd7e2c5a323b8412" dependencies: - typed-promisify "^0.3.0" - typings-global "^1.0.14" + typings-global "^1.0.19" + util.promisify "^1.0.0" + +smartshell@^1.0.6: + version "1.0.18" + resolved "https://registry.yarnpkg.com/smartshell/-/smartshell-1.0.18.tgz#b84ccc65cedf3a875bf676cec78ee07f4b4aa9e5" + dependencies: + "@types/shelljs" "^0.7.4" + "@types/which" "^1.0.28" + shelljs "^0.7.8" + smartq "^1.1.6" + typings-global "^1.0.20" + which "^1.3.0" strip-ansi@^3.0.0: version "3.0.1" @@ -316,10 +463,25 @@ strip-ansi@^3.0.0: dependencies: ansi-regex "^2.0.0" +strip-indent@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/strip-indent/-/strip-indent-2.0.0.tgz#5ef8db295d01e6ed6cbf7aab96998d7822527b68" + supports-color@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" +tapbundle@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/tapbundle/-/tapbundle-1.1.1.tgz#ec4172c0e82a77b1f6133fef2606311ede28a62d" + dependencies: + early "^2.1.1" + leakage "^0.3.0" + smartchai "^1.0.3" + smartdelay "^1.0.3" + smartq "^1.1.1" + typings-global "^1.0.19" + type-detect@0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-0.1.1.tgz#0ba5ec2a885640e470ea4e8505971900dac58822" @@ -328,23 +490,25 @@ type-detect@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-1.0.0.tgz#762217cc06db258ec48908a1298e8b95121e8ea2" -typed-promisify@^0.3.0: - version "0.3.0" - resolved "https://registry.yarnpkg.com/typed-promisify/-/typed-promisify-0.3.0.tgz#1ba0af5e444c87d8047406f18ce49092a1191853" - -typings-global@*, typings-global@^1.0.14: - version "1.0.14" - resolved "https://registry.yarnpkg.com/typings-global/-/typings-global-1.0.14.tgz#ab682720a03d6b9278869fb5c30c30d7dc61d12c" +typings-global@^1.0.14, typings-global@^1.0.16, typings-global@^1.0.19, typings-global@^1.0.20: + version "1.0.20" + resolved "https://registry.yarnpkg.com/typings-global/-/typings-global-1.0.20.tgz#3da769c54db538247c5d877d1d9e97eb2ec981ff" dependencies: semver "^5.3.0" - shelljs "^0.7.4" + smartshell "^1.0.6" -typings-test@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/typings-test/-/typings-test-1.0.3.tgz#fbab895eb3f0c44842e73db059f65946b971e369" +util.promisify@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/util.promisify/-/util.promisify-1.0.0.tgz#440f7165a459c9a16dc145eb8e72f35687097030" dependencies: - "@types/mocha" "^2.2.31" - typings-global "*" + define-properties "^1.1.2" + object.getownpropertydescriptors "^2.0.3" + +which@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/which/-/which-1.3.0.tgz#ff04bdfc010ee547d780bec38e1ac1c2777d253a" + dependencies: + isexe "^2.0.0" wrappy@1: version "1.0.2"