update to latest standards

This commit is contained in:
Philipp Kunz 2016-11-21 11:58:37 +01:00
parent 56d4432d31
commit af7b9c46d2
26 changed files with 262 additions and 268 deletions

59
.gitlab-ci.yml Normal file
View File

@ -0,0 +1,59 @@
image: hosttoday/ht-docker-node:npmts
stages:
- test
- release
- trigger
- pages
testLEGACY:
stage: test
script:
- npmci test legacy
tags:
- docker
allow_failure: true
testLTS:
stage: test
script:
- npmci test lts
tags:
- docker
testSTABLE:
stage: test
script:
- npmci test stable
tags:
- docker
release:
stage: release
script:
- npmci publish
only:
- tags
tags:
- docker
trigger:
stage: trigger
script:
- npmci trigger
only:
- tags
tags:
- docker
pages:
image: hosttoday/ht-docker-node:npmpage
stage: pages
script:
- npmci command npmpage --host gitlab
only:
- tags
artifacts:
expire_in: 1 week
paths:
- public

View File

@ -1,15 +0,0 @@
language: node_js
node_js:
- 4
- stable
deploy:
provider: npm
email: npm@lossless.digital
api_key:
secure: W6bKXwA7fNE+SNc4cNMkG4T6avf3JTpygukjuL++NKSc69W8aBrGgB2YFGbeIMiiORGLVqdQ6RCBg3Qk1o9Fi4i94dqS+8HjqBB7bYyz8FprtTnrcxJSIZPmEkRD5UNCAdYkDLrofeihnrojsNRLOTvM4x8hSIJpp+2W/WgdYGOzoUJK7qRMWM9TcAMBtVVrww2kVUDoDeHLWIj5w6jvlpl+rUJqmA/x3Gnom+wIVwClyy+mTnwjn9y6ICzoSmHKeL70Vun9AmgjshhVJOW51R4DYt8lkIYvT8DhwIqNOgvf2+uK2rg52pI0v86FL5XbdSCt6AwKtHZFR4J07h/bIr9J/teMrSlX0aI/J7tZnUgFAkUPKtqpvFZm/GD8/549YaG9koUQjwL5pcCUmuPl4djBy22q0NXw/bQIu59fW4KS7cS0KXBrofLCskXAc/CI+EzOX6LXnzryXLh4kDJiWNMLXOeSpdPkvAPzFj9MNYNnF6vjmhUJvoaN1TGO1oOEjIN68BfQY/4EvJDvwgVnqxihomvn95uUYB8f4EnTp2RVnbGKTlsY7J1zzwnMQrWbSRIT/XLsK2rP1oDGbSF1iLX06/sFLXbBDVYsw55jovOvF/dxlZjTJEUWvBV56s81bmKebskr9EdFCTUkP7oegexx4v6rins5WOr1Gele634=
on:
tags: true
repo: pushrocks/smartenv
notifications:
slack:
secure: f5Uss0z9RPl/QcA/DroB8loyE93aOYI6bqCkrsiUscmZtlv/TVQtT4dxqGA6uvcG6iTQDBi3Ul88dQxWkRm4IqbhY35/iMaV2dHW4FVYMAh8GQMbsfL2sALCcufxD9blw47awv3iFcwhV1EeyesscjgL0JIjduk96v/7G/6QIO2838M1lzlgtj+kRUkim8qkaEs1je3gRrhMUIjLuAdscMXyUKYFMjWo9ACSjVUl30R/ZNemb18itIja6i92GotreBgcfEMczvy58ovDC7xdJUsY8LjMI01DwY+WPRnI0tAhsuI8moBwwcdM4e3bAjKjucQRjO33O5bMWRZ6QCiYd0DnCEFyCPQLJ4GSy/tkD00n8ijLHAOSV3AH1zNbdK1EAdSPQXDvlI36KJn/2hyQLoitGHVUPr76ujJWP82ypO2tgIp3XQU0dJVCxDuHnwJO2+hjdI+gCPqxNTpjeujHx3UdkTGNRjuuf9dlZ/D08fApjYxy2fxItTqo3QjP/nrqvBXUOPP8yPHpjIT4H2t5Pr4SJjBGI6X4qhKyFj6s9rA/Xu1rL+45zu1C3uC3z+u3T9UwrbzJ/cZM6r6UQvQmUvIfBNaMlg4I/diQCDIPL+Rhop2nylY3IcHmJnk2itn7kOqj1tohCpFEml5pRuSZy4udWywkdtyBAsHWFLF7oiQ=

4
dist/index.d.ts vendored
View File

@ -1,5 +1,5 @@
import * as classes from "./smartenv.classes"; import * as classes from './smartenv.classes';
declare var smartenv: { declare let smartenv: {
getEnv: () => classes.Environment; getEnv: () => classes.Environment;
printEnv: () => void; printEnv: () => void;
obs: any; obs: any;

12
dist/index.js vendored
View File

@ -1,12 +1,10 @@
/// <reference path="typings/main.d.ts" />
"use strict"; "use strict";
var SmartenvEnvironment = require("./smartenv.environment"); const SmartenvEnvironment = require("./smartenv.environment");
var SmartenvObjectstorage = require("./smartenv.objectstorage"); const SmartenvObjectstorage = require("./smartenv.objectstorage");
var smartenv = { let smartenv = {
getEnv: SmartenvEnvironment.getEnv, getEnv: SmartenvEnvironment.getEnv,
printEnv: SmartenvEnvironment.printEnv, printEnv: SmartenvEnvironment.printEnv,
obs: SmartenvObjectstorage.obs obs: SmartenvObjectstorage.obs
}; //create smartenv object }; // create smartenv object
module.exports = smartenv; module.exports = smartenv;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBRUEsOERBQTZEO0FBQzdELGtFQUFpRTtBQUVqRSxJQUFJLFFBQVEsR0FBRztJQUNYLE1BQU0sRUFBRSxtQkFBbUIsQ0FBQyxNQUFNO0lBQ2xDLFFBQVEsRUFBRSxtQkFBbUIsQ0FBQyxRQUFRO0lBQ3RDLEdBQUcsRUFBRSxxQkFBcUIsQ0FBQyxHQUFHO0NBQ2pDLENBQUEsQ0FBQyx5QkFBeUI7QUFFM0IsaUJBQVMsUUFBUSxDQUFBIn0=
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLDBDQUEwQzs7QUFJMUMsSUFBWSxtQkFBbUIsV0FBTSx3QkFBd0IsQ0FBQyxDQUFBO0FBQzlELElBQVkscUJBQXFCLFdBQU0sMEJBQTBCLENBQUMsQ0FBQTtBQUVsRSxJQUFJLFFBQVEsR0FBRztJQUNYLE1BQU0sRUFBRSxtQkFBbUIsQ0FBQyxNQUFNO0lBQ2xDLFFBQVEsRUFBRSxtQkFBbUIsQ0FBQyxRQUFRO0lBQ3RDLEdBQUcsRUFBRSxxQkFBcUIsQ0FBQyxHQUFHO0NBQ2pDLENBQUMsQ0FBQyx3QkFBd0I7QUFFM0IsaUJBQVMsUUFBUSxDQUFDIiwiZmlsZSI6ImluZGV4LmpzIiwic291cmNlc0NvbnRlbnQiOlsiLy8vIDxyZWZlcmVuY2UgcGF0aD1cInR5cGluZ3MvbWFpbi5kLnRzXCIgLz5cblxuaW1wb3J0ICogYXMgcGx1Z2lucyBmcm9tIFwiLi9zbWFydGVudi5wbHVnaW5zXCI7XG5pbXBvcnQgKiBhcyBjbGFzc2VzIGZyb20gXCIuL3NtYXJ0ZW52LmNsYXNzZXNcIjtcbmltcG9ydCAqIGFzIFNtYXJ0ZW52RW52aXJvbm1lbnQgZnJvbSBcIi4vc21hcnRlbnYuZW52aXJvbm1lbnRcIjtcbmltcG9ydCAqIGFzIFNtYXJ0ZW52T2JqZWN0c3RvcmFnZSBmcm9tIFwiLi9zbWFydGVudi5vYmplY3RzdG9yYWdlXCI7XG5cbnZhciBzbWFydGVudiA9IHtcbiAgICBnZXRFbnY6IFNtYXJ0ZW52RW52aXJvbm1lbnQuZ2V0RW52LFxuICAgIHByaW50RW52OiBTbWFydGVudkVudmlyb25tZW50LnByaW50RW52LFxuICAgIG9iczogU21hcnRlbnZPYmplY3RzdG9yYWdlLm9ic1xufTsgLy9jcmVhdGUgc21hcnRlbnYgb2JqZWN0XG5cbmV4cG9ydCA9IHNtYXJ0ZW52O1xuIl19

View File

@ -1,11 +1,10 @@
/// <reference path="typings/main.d.ts" />
"use strict"; "use strict";
exports.getEnvString = function () { exports.getEnvString = function () {
if (typeof window !== "undefined") { if (typeof window !== 'undefined') {
return "browser"; return 'browser';
} }
else if (typeof process !== "undefined") { else if (typeof process !== 'undefined') {
return "node"; return 'node';
} }
}; };
exports.getUserAgentString = function () { exports.getUserAgentString = function () {
@ -17,7 +16,7 @@ exports.getUserAgentString = function () {
} }
}; };
exports.isNode = function () { exports.isNode = function () {
return exports.getEnvString() === "node"; return exports.getEnvString() === 'node';
}; };
exports.getNodeVersion = function () { exports.getNodeVersion = function () {
return process.version; return process.version;
@ -51,5 +50,4 @@ exports.isTravis = function () {
} }
; ;
}; };
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRlbnYuY2xhc3Nlcy5oZWxwZXJzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnRlbnYuY2xhc3Nlcy5oZWxwZXJzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBVyxRQUFBLFlBQVksR0FBRztJQUN0QixFQUFFLENBQUMsQ0FBQyxPQUFPLE1BQU0sS0FBSyxXQUFXLENBQUMsQ0FBQyxDQUFDO1FBQ2hDLE1BQU0sQ0FBQyxTQUFTLENBQUE7SUFDcEIsQ0FBQztJQUFDLElBQUksQ0FBQyxFQUFFLENBQUMsQ0FBQyxPQUFPLE9BQU8sS0FBSyxXQUFXLENBQUMsQ0FBQyxDQUFDO1FBQ3hDLE1BQU0sQ0FBQyxNQUFNLENBQUE7SUFDakIsQ0FBQztBQUNMLENBQUMsQ0FBQTtBQUVVLFFBQUEsa0JBQWtCLEdBQUc7SUFDNUIsRUFBRSxDQUFDLENBQUMsaUJBQVMsRUFBRSxDQUFDLENBQUMsQ0FBQztRQUNkLE1BQU0sQ0FBRSxTQUFTLENBQUMsU0FBUyxDQUFBO0lBQy9CLENBQUM7SUFBQyxJQUFJLENBQUMsQ0FBQztRQUNKLE1BQU0sQ0FBQyxTQUFTLENBQUE7SUFDcEIsQ0FBQztBQUNMLENBQUMsQ0FBQTtBQUVVLFFBQUEsTUFBTSxHQUFHO0lBQ2hCLE1BQU0sQ0FBQyxvQkFBWSxFQUFFLEtBQUssTUFBTSxDQUFBO0FBQ3BDLENBQUMsQ0FBQTtBQUVVLFFBQUEsY0FBYyxHQUFHO0lBQ3hCLE1BQU0sQ0FBQyxPQUFPLENBQUMsT0FBTyxDQUFBO0FBQzFCLENBQUMsQ0FBQTtBQUVVLFFBQUE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2VyQWdlbnQ7XG4gICAgfSBlbHNlIHtcbiAgICAgICAgcmV0dXJuIHVuZGVmaW5lZDtcbiAgICB9XG59O1xuXG5leHBvcnQgdmFyIGlzTm9kZSA9IGZ1bmN0aW9uKCk6Ym9vbGVhbiB7XG4gICAgcmV0dXJuIGdldEVudlN0cmluZygpID09PSBcIm5vZGVcIlxufTtcblxuZXhwb3J0IHZhciBnZXROb2RlVmVyc2lvbiA9IGZ1bmN0aW9uKCk6c3RyaW5nIHtcbiAgICByZXR1cm4gcHJvY2Vzcy52ZXJzaW9uO1xufTtcblxuZXhwb3J0IHZhciBpc0Jyb3dzZXIgPSBmdW5jdGlvbigpOmJvb2xlYW4ge1xuICAgIHJldHVybiAhaXNOb2RlKCk7XG59O1xuXG5leHBvcnQgdmFyIGlzQ0kgPSBmdW5jdGlvbigpe1xuICAgIGlmKHByb2Nlc3MuZW52LkNJKXtcbiAgICAgICAgcmV0dXJuIHRydWU7XG4gICAgfSBlbHNlIHtcbiAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgIH07XG59O1xuXG5leHBvcnQgdmFyIGlzQzkgPSBmdW5jdGlvbigpe1xuICAgIGlmIChwcm9jZXNzLmVudi5DOV9IT1NUTkFNRSl7XG4gICAgICAgIHJldHVybiB0cnVlO1xuICAgIH0gZWxzZSB7XG4gICAgICAgIHJldHVybiBmYWxzZTtcbiAgICB9XG59O1xuXG5leHBvcnQgdmFyIGlzVHJhdmlzID0gZnVuY3Rpb24oKXtcbiAgICBpZihwcm9jZXNzLmVudi5UUkFWSVMpe1xuICAgICAgICByZXR1cm4gdHJ1ZTtcbiAgICB9IGVsc2Uge1xuICAgICAgICByZXR1cm4gZmFsc2U7XG4gICAgfTtcbn07Il19

View File

@ -1,8 +1,7 @@
/// <reference path="typings/main.d.ts" />
"use strict"; "use strict";
var helpers = require("./smartenv.classes.helpers"); const helpers = require("./smartenv.classes.helpers");
var Environment = (function () { class Environment {
function Environment() { constructor() {
this.runtimeEnv = helpers.getEnvString(); this.runtimeEnv = helpers.getEnvString();
this.isBrowser = helpers.isBrowser(); this.isBrowser = helpers.isBrowser();
this.userAgent = helpers.getUserAgentString(); this.userAgent = helpers.getUserAgentString();
@ -13,8 +12,6 @@ var Environment = (function () {
this.isC9 = helpers.isC9(); this.isC9 = helpers.isC9();
} }
; ;
return Environment; }
}());
exports.Environment = Environment; exports.Environment = Environment;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRlbnYuY2xhc3Nlcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0ZW52LmNsYXNzZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLHNEQUFzRDtBQUV0RDtJQVNJO1FBQ0ksSUFBSSxDQUFDLFVBQVUsR0FBRyxPQUFPLENBQUMsWUFBWSxFQUFFLENBQUE7UUFDeEMsSUFBSSxDQUFDLFNBQVMsR0FBRyxPQUFPLENBQUMsU0FBUyxFQUFFLENBQUE7UUFDcEMsSUFBSSxDQUFDLFNBQVMsR0FBRyxPQUFPLENBQUMsa0JBQWtCLEVBQUUsQ0FBQTtRQUM3QyxJQUFJLENBQUMsTUFBTSxHQUFHLE9BQU8sQ0FBQyxNQUFNLEVBQUUsQ0FBQTtRQUM5QixJQUFJLENBQUMsV0FBVyxHQUFHLE9BQU8sQ0FBQyxjQUFjLEVBQUUsQ0FBQTtRQUMzQyxJQUFJLENBQUMsSUFBSSxHQUFHLE9BQU8sQ0FBQyxJQUFJLEVBQUUsQ0FBQTtRQUMxQixJQUFJLENBQUMsUUFBUSxHQUFHLE9BQU8sQ0FBQyxRQUFRLEVBQUUsQ0FBQTtRQUNsQyxJQUFJLENBQUMsSUFBSSxHQUFHLE9BQU8sQ0FBQyxJQUFJLEVBQUUsQ0FBQTtJQUM5QixDQUFDO0lBQUEsQ0FBQztDQUNMO0FBbkJELGtDQW1CQyJ9
//# sourceMappingURL=data:application/json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jbGFzcyBFbnZpcm9ubWVudCB7XG4gICAgcnVudGltZUVudjpzdHJpbmc7XG4gICAgaXNCcm93c2VyOmJvb2xlYW47XG4gICAgdXNlckFnZW50OnN0cmluZztcbiAgICBpc05vZGU6Ym9vbGVhbjtcbiAgICBub2RlVmVyc2lvbjpzdHJpbmc7XG4gICAgaXNDSTpib29sZWFuO1xuICAgIGlzVHJhdmlzOmJvb2xlYW47XG4gICAgaXNDOTpib29sZWFuO1xuICAgIGNvbnN0cnVjdG9yKCkge1xuICAgICAgICB0aGlzLnJ1bnRpbWVFbnYgPSBoZWxwZXJzLmdldEVudlN0cmluZygpO1xuICAgICAgICB0aGlzLmlzQnJvd3NlciA9IGhlbHBlcnMuaXNCcm93c2VyKCk7XG4gICAgICAgIHRoaXMudXNlckFnZW50ID0gaGVscGVycy5nZXRVc2VyQWdlbnRTdHJpbmcoKTtcbiAgICAgICAgdGhpcy5pc05vZGUgPSBoZWxwZXJzLmlzTm9kZSgpO1xuICAgICAgICB0aGlzLm5vZGVWZXJzaW9uID0gaGVscGVycy5nZXROb2RlVmVyc2lvbigpO1xuICAgICAgICB0aGlzLmlzQ0kgPSBoZWxwZXJzLmlzQ0koKTtcbiAgICAgICAgdGhpcy5pc1RyYXZpcyA9IGhlbHBlcnMuaXNUcmF2aXMoKTtcbiAgICAgICAgdGhpcy5pc0M5ID0gaGVscGVycy5pc0M5KCk7XG4gICAgfTtcbn1cbiJdfQ==

View File

@ -1,4 +1,4 @@
import classes = require("./smartenv.classes"); import * as classes from './smartenv.classes';
/** /**
* returns the environment * returns the environment
* @returns {Environment} * @returns {Environment}

View File

@ -1,8 +1,8 @@
"use strict"; "use strict";
var classes = require("./smartenv.classes"); const classes = require("./smartenv.classes");
var objectStorage = require("./smartenv.objectstorage"); const objectStorage = require("./smartenv.objectstorage");
var environment; let environment;
var envDetermined = false; let envDetermined = false;
/** /**
* returns the environment * returns the environment
* @returns {Environment} * @returns {Environment}
@ -20,16 +20,15 @@ exports.getEnv = function () {
*/ */
exports.printEnv = function () { exports.printEnv = function () {
if (this.getEnv().isNode) { if (this.getEnv().isNode) {
console.log("running on NODE"); console.log('running on NODE');
var smartenvVersion = require("../package.json").version; let smartenvVersion = require('../package.json').version;
console.log("node version is " + this.getEnv().nodeVersion + " and smartenv version is " + smartenvVersion); console.log('node version is ' + this.getEnv().nodeVersion + ' and smartenv version is ' + smartenvVersion);
} }
else { else {
console.log("running on BROWSER"); console.log('running on BROWSER');
console.log("browser is " + this.getEnv().userAgent); console.log('browser is ' + this.getEnv().userAgent);
} }
console.log("the smartenv registration store currently holds the following properties:"); console.log('the smartenv registration store currently holds the following properties:');
console.log(Object.getOwnPropertyNames(objectStorage.obs.getAll())); console.log(Object.getOwnPropertyNames(objectStorage.obs.getAll()));
}; };
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRlbnYuZW52aXJvbm1lbnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydGVudi5lbnZpcm9ubWVudC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBSUEsOENBQTZDO0FBQzdDLDBEQUF5RDtBQUd6RCxJQUFJLFdBQWdDLENBQUE7QUFDcEMsSUFBSSxhQUFhLEdBQVksS0FBSyxDQUFBO0FBRWxDOzs7R0FHRztBQUNRLFFBQUEsTUFBTSxHQUFHO0lBQ2hCLEVBQUUsQ0FBQyxDQUFDLENBQUMsYUFBYSxDQUFDLENBQUMsQ0FBQztRQUNqQixXQUFXLEdBQUcsSUFBSSxPQUFPLENBQUMsV0FBVyxFQUFFLENBQUE7UUFDdkMsYUFBYSxHQUFHLElBQUksQ0FBQSxDQUFDLG1DQUFtQztJQUM1RCxDQUFDO0lBQUEsQ0FBQztJQUNGLE1BQU0sQ0FBQyxXQUFXLENBQUE7QUFDdEIsQ0FBQyxDQUFBO0FBRUQ7O0dBRUc7QUFDUyxRQUFBLFFBQVEsR0FBRztJQUNuQ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uZXhwb3J0IHZhciAgcHJpbnRFbnYgPSBmdW5jdGlvbigpIHtcbiAgICBpZiAodGhpcy5nZXRFbnYoKS5pc05vZGUpIHtcbiAgICAgICAgY29uc29sZS5sb2coXCJydW5uaW5nIG9uIE5PREVcIik7XG4gICAgICAgIHZhciBzbWFydGVudlZlcnNpb24gPSByZXF1aXJlKFwiLi4vcGFja2FnZS5qc29uXCIpLnZlcnNpb247XG4gICAgICAgIGNvbnNvbGUubG9nKFwibm9kZSB2ZXJzaW9uIGlzIFwiICsgdGhpcy5nZXRFbnYoKS5ub2RlVmVyc2lvbiArIFwiIGFuZCBzbWFydGVudiB2ZXJzaW9uIGlzIFwiICsgc21hcnRlbnZWZXJzaW9uKTtcbiAgICB9IGVsc2Uge1xuICAgICAgICBjb25zb2xlLmxvZyhcInJ1bm5pbmcgb24gQlJPV1NFUlwiKTtcbiAgICAgICAgY29uc29sZS5sb2coXCJicm93c2VyIGlzIFwiICsgdGhpcy5nZXRFbnYoKS51c2VyQWdlbnQpO1xuICAgIH1cbiAgICBjb25zb2xlLmxvZyhcInRoZSBzbWFydGVudiByZWdpc3RyYXRpb24gc3RvcmUgY3VycmVudGx5IGhvbGRzIHRoZSBmb2xsb3dpbmcgcHJvcGVydGllczpcIik7XG4gICAgY29uc29sZS5sb2coT2JqZWN0LmdldE93blByb3BlcnR5TmFtZXMob2JqZWN0U3RvcmFnZS5vYnMuZ2V0QWxsKCkpKTtcbn07Il19

View File

@ -1,22 +1,19 @@
"use strict"; "use strict";
/// <reference path="typings/main.d.ts" /> const plugins = require("./smartenv.plugins");
var plugins = require("./smartenv.plugins");
exports.obs = { exports.obs = {
add: function (paramNameArg, objectArg) { add: function (paramNameArg = 'undefined', objectArg = 'undefined') {
if (paramNameArg === void 0) { paramNameArg = "undefined"; } if (paramNameArg === 'undefined') {
if (objectArg === void 0) { objectArg = "undefined"; } console.log('paramName is undefined');
if (paramNameArg == "undefined") {
console.log("paramName is undefined");
return; return;
} }
if (objectArg == "undefined") { if (objectArg === 'undefined') {
console.log("objectArg is undefined"); console.log('objectArg is undefined');
} }
if (typeof exports.obsItems[paramNameArg] === "undefined") { if (typeof exports.obsItems[paramNameArg] === 'undefined') {
exports.obsItems[paramNameArg] = objectArg; exports.obsItems[paramNameArg] = objectArg;
} }
else { else {
console.log("object is already present, so add operation has failed."); console.log('object is already present, so add operation has failed.');
} }
return exports.obsItems[paramNameArg]; return exports.obsItems[paramNameArg];
}, },
@ -24,11 +21,11 @@ exports.obs = {
exports.obsItems[paramNameArg] = objectArg; exports.obsItems[paramNameArg] = objectArg;
}, },
merge: function (paramNameArg, objectArg) { merge: function (paramNameArg, objectArg) {
if (!(typeof exports.obsItems[paramNameArg] === "undefined")) { if (!(typeof exports.obsItems[paramNameArg] === 'undefined')) {
exports.obsItems[paramNameArg] = plugins._.assign(exports.obsItems[paramNameArg], objectArg); exports.obsItems[paramNameArg] = plugins._.assign(exports.obsItems[paramNameArg], objectArg);
} }
else { else {
console.log("object is not present, so there is nothing to merge"); console.log('object is not present, so there is nothing to merge');
} }
}, },
get: function (keyName) { get: function (keyName) {
@ -43,5 +40,4 @@ exports.obs = {
} }
}; };
exports.obsItems = {}; exports.obsItems = {};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRlbnYub2JqZWN0c3RvcmFnZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0ZW52Lm9iamVjdHN0b3JhZ2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLDhDQUE4QztBQUNuQyxRQUFBLEdBQUcsR0FBUTtJQUNsQixHQUFHLEVBQUUsVUFBUyxZQUFZLEdBQUcsV0FBVyxFQUFDLFNBQVMsR0FBRyxXQUFXO1FBQzVELEVBQUUsQ0FBQyxDQUFDLFlBQVksS0FBSyxXQUFXLENBQUMsQ0FBQyxDQUFDO1lBQy9CLE9BQU8sQ0FBQyxHQUFHL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gICAgICAgcmV0dXJuIG9ic0l0ZW1zO1xuICAgIH1cbn07XG5leHBvcnQgdmFyIG9ic0l0ZW1zOmFueSA9IHt9OyJdfQ==

View File

@ -1,5 +1,4 @@
declare var plugins: { import 'typings-global';
Q: any; import * as Q from 'q';
_: any; import * as _ from 'lodash';
}; export { Q, _ };
export = plugins;

View File

@ -1,9 +1,7 @@
"use strict"; "use strict";
/// <reference path="typings/main.d.ts" /> require("typings-global");
var plugins = { const Q = require("q");
Q: require("q"), exports.Q = Q;
_: require("lodash") const _ = require("lodash");
}; exports._ = _;
module.exports = plugins; //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRlbnYucGx1Z2lucy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0ZW52LnBsdWdpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLDBCQUF1QjtBQUN2Qix1QkFBc0I7QUFJbEIsY0FBQztBQUhMLDRCQUEyQjtBQUl2QixjQUFDIn0=
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0ZW52LnBsdWdpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLDBDQUEwQztBQUMxQyxJQUFJLE9BQU8sR0FBRztJQUNWLENBQUMsRUFBRSxPQUFPLENBQUMsR0FBRyxDQUFDO0lBQ2YsQ0FBQyxFQUFFLE9BQU8sQ0FBQyxRQUFRLENBQUM7Q0FDdkIsQ0FBQztBQUVGLGlCQUFTLE9BQU8sQ0FBQyIsImZpbGUiOiJzbWFydGVudi5wbHVnaW5zLmpzIiwic291cmNlc0NvbnRlbnQiOlsiLy8vIDxyZWZlcmVuY2UgcGF0aD1cInR5cGluZ3MvbWFpbi5kLnRzXCIgLz5cbnZhciBwbHVnaW5zID0ge1xuICAgIFE6IHJlcXVpcmUoXCJxXCIpLFxuICAgIF86IHJlcXVpcmUoXCJsb2Rhc2hcIilcbn07XG5cbmV4cG9ydCA9IHBsdWdpbnM7Il19

View File

@ -22,11 +22,14 @@
}, },
"homepage": "https://github.com/pushrocks/smartenv", "homepage": "https://github.com/pushrocks/smartenv",
"dependencies": { "dependencies": {
"beautylog": "^4.1.2", "@types/q": "x.x.x",
"lodash": "^4.11.1", "lodash": "^4.17.2",
"q": "^1.4.1" "q": "^1.4.1",
"typings-global": "^1.0.14"
}, },
"devDependencies": { "devDependencies": {
"npmts": "^5.1.5" "@types/should": "^8.1.30",
"beautylog": "^6.0.0",
"should": "^11.1.1"
} }
} }

View File

@ -1,6 +0,0 @@
<head>
<script async src="browserified/index.js"></script>
</head>
<body>
</body>

View File

@ -1,2 +0,0 @@
var smartenv = require("./index.js");
smartenv.printEnv();

6
test/test.d.ts vendored
View File

@ -1,3 +1,3 @@
declare var smartenv: any; declare let smartenv: any;
declare var beautylog: any; declare let beautylog: any;
declare var key2: string; declare let key2: string;

View File

@ -1,21 +1,20 @@
/// <reference path="../ts/typings/main.d.ts" /> let smartenv = require('../dist/index.js');
var smartenv = require("../dist/index.js"); let beautylog = require('beautylog');
var beautylog = require("beautylog");
smartenv.printEnv(); smartenv.printEnv();
//test smartenv.obs.add // test smartenv.obs.add
smartenv.obs.add("myTestObject", { key1: "Peter" }); smartenv.obs.add('myTestObject', { key1: 'Peter' });
smartenv.obs.add("myTestObject", { key1: "Klaus" }); //now trying to add a second smartenv.obs.add('myTestObject', { key1: 'Klaus' }); //now trying to add a second
smartenv.printEnv(); smartenv.printEnv();
beautylog.log(smartenv.obs.get("myTestObject").key1); // this should be Peter beautylog.log(smartenv.obs.get('myTestObject').key1); // this should be Peter
//test smartenv.obs.replace // test smartenv.obs.replace
smartenv.obs.replace("myTestObject", { key1: "Klaus" }); smartenv.obs.replace('myTestObject', { key1: 'Klaus' });
beautylog.log(smartenv.obs.get("myTestObject").key1); // this should be Klaus beautylog.log(smartenv.obs.get('myTestObject').key1); // this should be Klaus
//test smartenv.obs.merge // test smartenv.obs.merge
smartenv.obs.merge("myTestObject", { key2: "Peter" }); smartenv.obs.merge('myTestObject', { key2: 'Peter' });
beautylog.log(smartenv.obs.get("myTestObject").key1 + smartenv.obs.get("myTestObject").key2); // this should be KlausPeter beautylog.log(smartenv.obs.get('myTestObject').key1 + smartenv.obs.get('myTestObject').key2);
var key2 = "hello"; // this should be KlausPeter
smartenv.obs.get("myTestObject").key2 = key2; let key2 = 'hello';
beautylog.log(smartenv.obs.get("myTestObject").key2); smartenv.obs.get('myTestObject').key2 = key2;
beautylog.success("Success!"); beautylog.log(smartenv.obs.get('myTestObject').key2);
beautylog.success('Success!');
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsZ0RBQWdEO0FBQ2hELElBQUksUUFBUSxHQUFHLE9BQU8sQ0FBQyxrQkFBa0IsQ0FBQyxDQUFDO0FBQzNDLElBQUksU0FBUyxHQUFHLE9BQU8sQ0FBQyxXQUFXLENBQUMsQ0FBQztBQUNyQyxRQUFRLENBQUMsUUFBUSxFQUFFLENBQUM7QUFFcEIsdUJBQXVCO0FBQ3ZCLFFBQVEsQ0FBQyxHQUFHLENBQUMsR0FBRyxDQUFDLGNBQWMsRUFBQyxFQUFDLElBQUksRUFBQyxPQUFPLEVBQUMsQ0FBQyxDQUFDO0FBQ2hELFFBQVEsQ0FBQyxHQUFHLENBQUMsR0FBRyxDQUFDLGNBQWMsRUFBQyxFQUFDLElBQUksRUFBQyxPQUFPLEVBQUMsQ0FBQyxDQUFDLENBQUMsNEJBQTRCO0FBQzdFLFFBQVEsQ0FBQyxRQUFRLEVBQUUsQ0FBQztBQUNwQixTQUFTLENBQUMsR0FBRyxDQUFDLFFBQVEsQ0FBQyxHQUFHLENBQUMsR0FBRyxDQUFDLGNBQWMsQ0FBQyxDQUFDLEl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UFBUSxDQUFDLEdBQUcsQ0FBQyxHQUFHLENBQUMsY0FBYyxDQUFDLENBQUMsSUFBSSxDQUFDLENBQUEsQ0FBQyx1QkFBdUI7QUFFNUUsMEJBQTBCO0FBQzFCLFFBQVEsQ0FBQyxHQUFHLENBQUMsS0FBSyxDQUFDLGNBQWMsRUFBQyxFQUFDLElBQUksRUFBQyxPQUFPLEVBQUMsQ0FBQyxDQUFBO0FBQ2pELFNBQVMsQ0FBQyxHQUFHLENBQUMsUUFBUSxDQUFDLEdBQUcsQ0FBQyxHQUFHLENBQUMsY0FBYyxDQUFDLENBQUMsSUFBSSxHQUFHLFFBQVEsQ0FBQyxHQUFHLENBQUMsR0FBRyxDQUFDLGNBQWMsQ0FBQyxDQUFDLElBQUksQ0FBQyxDQUFBO0FBQzVGLDRCQUE0QjtBQUU1QixJQUFJLElBQUksR0FBRyxPQUFPLENBQUE7QUFDbEIsUUFBUSxDQUFDLEdBQUcsQ0FBQyxHQUFHLENBQUMsY0FBYyxDQUFDLENBQUMsSUFBSSxHQUFHLElBQUksQ0FBQTtBQUM1QyxTQUFTLENBQUMsR0FBRyxDQUFDLFFBQVEsQ0FBQyxHQUFHLENBQUMsR0FBRyxDQUFDLGNBQWMsQ0FBQyxDQUFDLElBQUksQ0FBQyxDQUFBO0FBRXBELFNBQVMsQ0FBQyxPQUFPLENBQUMsVUFBVSxDQUFDLENBQUEifQ==

View File

@ -1,24 +1,24 @@
/// <reference path="../ts/typings/main.d.ts" /> import * as smartenv from '../dist/index.js'
var smartenv = require("../dist/index.js"); import * as beautylog from 'beautylog'
var beautylog = require("beautylog"); smartenv.printEnv()
smartenv.printEnv();
//test smartenv.obs.add // test smartenv.obs.add
smartenv.obs.add("myTestObject",{key1:"Peter"}); smartenv.obs.add('myTestObject',{key1:'Peter'})
smartenv.obs.add("myTestObject",{key1:"Klaus"}); //now trying to add a second smartenv.obs.add('myTestObject',{key1:'Klaus'}) //now trying to add a second
smartenv.printEnv(); smartenv.printEnv()
beautylog.log(smartenv.obs.get("myTestObject").key1); // this should be Peter beautylog.log(smartenv.obs.get('myTestObject').key1) // this should be Peter
//test smartenv.obs.replace // test smartenv.obs.replace
smartenv.obs.replace("myTestObject",{key1:"Klaus"}); smartenv.obs.replace('myTestObject',{key1:'Klaus'})
beautylog.log(smartenv.obs.get("myTestObject").key1); // this should be Klaus beautylog.log(smartenv.obs.get('myTestObject').key1) // this should be Klaus
//test smartenv.obs.merge // test smartenv.obs.merge
smartenv.obs.merge("myTestObject",{key2:"Peter"}); smartenv.obs.merge('myTestObject',{key2:'Peter'})
beautylog.log(smartenv.obs.get("myTestObject").key1 + smartenv.obs.get("myTestObject").key2); // this should be KlausPeter beautylog.log(smartenv.obs.get('myTestObject').key1 + smartenv.obs.get('myTestObject').key2)
// this should be KlausPeter
var key2 = "hello"; let key2 = 'hello'
smartenv.obs.get("myTestObject").key2 = key2; smartenv.obs.get('myTestObject').key2 = key2
beautylog.log(smartenv.obs.get("myTestObject").key2); beautylog.log(smartenv.obs.get('myTestObject').key2)
beautylog.success("Success!"); beautylog.success('Success!')

View File

@ -1,21 +0,0 @@
/// <reference path="typings/tsd.d.ts" />
var plugins = {
beautylog: require("beautylog")("os"),
gulp: require("gulp"),
gulpBrowser: require("gulp-browser"),
easyserve: require("easyserve")
};
plugins.gulp.task('compileBrowserJS', function() {
var stream = plugins.gulp.src('test/browser/index.js')
.pipe(plugins.gulpBrowser.browserify())
.pipe(plugins.gulp.dest("test/browser/browserified/"));
return stream;
});
plugins.gulp.task('default',['compileBrowserJS'], function() {
plugins.beautylog.success('browserJS has been browserified');
plugins.easyserve("test/browser/");
});
plugins.gulp.start.apply(plugins.gulp, ['default']);

View File

@ -1,14 +1,12 @@
/// <reference path="typings/main.d.ts" /> import * as plugins from './smartenv.plugins'
import * as classes from './smartenv.classes'
import * as SmartenvEnvironment from './smartenv.environment'
import * as SmartenvObjectstorage from './smartenv.objectstorage'
import * as plugins from "./smartenv.plugins"; let smartenv = {
import * as classes from "./smartenv.classes";
import * as SmartenvEnvironment from "./smartenv.environment";
import * as SmartenvObjectstorage from "./smartenv.objectstorage";
var smartenv = {
getEnv: SmartenvEnvironment.getEnv, getEnv: SmartenvEnvironment.getEnv,
printEnv: SmartenvEnvironment.printEnv, printEnv: SmartenvEnvironment.printEnv,
obs: SmartenvObjectstorage.obs obs: SmartenvObjectstorage.obs
}; //create smartenv object } // create smartenv object
export = smartenv; export = smartenv

View File

@ -1,53 +1,51 @@
/// <reference path="typings/main.d.ts" /> export var getEnvString = function(): string {
if (typeof window !== 'undefined') {
export var getEnvString = function():string { return 'browser'
if (typeof window !== "undefined") { } else if (typeof process !== 'undefined') {
return "browser"; return 'node'
} else if (typeof process !== "undefined") {
return "node";
} }
}; }
export var getUserAgentString = function():string{ export var getUserAgentString = function(): string{
if(isBrowser()){ if (isBrowser()) {
return navigator.userAgent; return navigator.userAgent
} else { } else {
return undefined; return undefined
} }
}; }
export var isNode = function():boolean { export var isNode = function(): boolean {
return getEnvString() === "node" return getEnvString() === 'node'
}; }
export var getNodeVersion = function():string { export var getNodeVersion = function(): string {
return process.version; return process.version
}; }
export var isBrowser = function():boolean { export var isBrowser = function(): boolean {
return !isNode(); return !isNode()
}; }
export var isCI = function(){ export var isCI = function(){
if(process.env.CI){ if (process.env.CI) {
return true; return true
} else { } else {
return false; return false
}; };
}; }
export var isC9 = function(){ export var isC9 = function(){
if (process.env.C9_HOSTNAME){ if (process.env.C9_HOSTNAME) {
return true; return true
} else { } else {
return false; return false
} }
}; }
export var isTravis = function(){ export var isTravis = function(){
if(process.env.TRAVIS){ if (process.env.TRAVIS) {
return true; return true
} else { } else {
return false; return false
}; };
}; }

View File

@ -1,23 +1,22 @@
/// <reference path="typings/main.d.ts" /> import helpers = require('./smartenv.classes.helpers')
import helpers = require("./smartenv.classes.helpers");
export class Environment { export class Environment {
runtimeEnv:string; runtimeEnv: string
isBrowser:boolean; isBrowser: boolean
userAgent:string; userAgent: string
isNode:boolean; isNode: boolean
nodeVersion:string; nodeVersion: string
isCI:boolean; isCI: boolean
isTravis:boolean; isTravis: boolean
isC9:boolean; isC9: boolean
constructor() { constructor() {
this.runtimeEnv = helpers.getEnvString(); this.runtimeEnv = helpers.getEnvString()
this.isBrowser = helpers.isBrowser(); this.isBrowser = helpers.isBrowser()
this.userAgent = helpers.getUserAgentString(); this.userAgent = helpers.getUserAgentString()
this.isNode = helpers.isNode(); this.isNode = helpers.isNode()
this.nodeVersion = helpers.getNodeVersion(); this.nodeVersion = helpers.getNodeVersion()
this.isCI = helpers.isCI(); this.isCI = helpers.isCI()
this.isTravis = helpers.isTravis(); this.isTravis = helpers.isTravis()
this.isC9 = helpers.isC9(); this.isC9 = helpers.isC9()
}; };
} }

View File

@ -1,14 +1,13 @@
/// <reference path="typings/main.d.ts" />
/** /**
* Deals with the environment the current JS script is running in. * Deals with the environment the current JS script is running in.
*/ */
import plugins = require("./smartenv.plugins"); import * as plugins from './smartenv.plugins'
import classes = require("./smartenv.classes"); import * as classes from './smartenv.classes'
import objectStorage = require("./smartenv.objectstorage"); import * as objectStorage from './smartenv.objectstorage'
var environment:classes.Environment; let environment: classes.Environment
var envDetermined:boolean = false; let envDetermined: boolean = false
/** /**
* returns the environment * returns the environment
@ -16,24 +15,24 @@ var envDetermined:boolean = false;
*/ */
export var getEnv = function(){ export var getEnv = function(){
if (!envDetermined) { if (!envDetermined) {
environment = new classes.Environment(); environment = new classes.Environment()
envDetermined = true; // ensure code above only runs once envDetermined = true // ensure code above only runs once
}; };
return environment; return environment
}; }
/** /**
* prints the environment to console * prints the environment to console
*/ */
export var printEnv = function() { export var printEnv = function() {
if (this.getEnv().isNode) { if (this.getEnv().isNode) {
console.log("running on NODE"); console.log('running on NODE')
var smartenvVersion = require("../package.json").version; let smartenvVersion = require('../package.json').version
console.log("node version is " + this.getEnv().nodeVersion + " and smartenv version is " + smartenvVersion); console.log('node version is ' + this.getEnv().nodeVersion + ' and smartenv version is ' + smartenvVersion)
} else { } else {
console.log("running on BROWSER"); console.log('running on BROWSER')
console.log("browser is " + this.getEnv().userAgent); console.log('browser is ' + this.getEnv().userAgent)
} }
console.log("the smartenv registration store currently holds the following properties:"); console.log('the smartenv registration store currently holds the following properties:')
console.log(Object.getOwnPropertyNames(objectStorage.obs.getAll())); console.log(Object.getOwnPropertyNames(objectStorage.obs.getAll()))
}; }

View File

@ -1,40 +1,39 @@
/// <reference path="typings/main.d.ts" /> import plugins = require('./smartenv.plugins')
import plugins = require("./smartenv.plugins"); export var obs: any = {
export var obs:any = { add: function(paramNameArg = 'undefined',objectArg = 'undefined') {
add: function(paramNameArg = "undefined",objectArg = "undefined") { if (paramNameArg === 'undefined') {
if (paramNameArg == "undefined"){ console.log('paramName is undefined')
console.log("paramName is undefined"); return
return;
} }
if (objectArg == "undefined"){ if (objectArg === 'undefined') {
console.log("objectArg is undefined"); console.log('objectArg is undefined')
} }
if (typeof obsItems[paramNameArg] === "undefined"){ if (typeof obsItems[paramNameArg] === 'undefined') {
obsItems[paramNameArg] = objectArg; obsItems[paramNameArg] = objectArg
} else { } else {
console.log("object is already present, so add operation has failed."); console.log('object is already present, so add operation has failed.')
} }
return obsItems[paramNameArg]; return obsItems[paramNameArg]
}, },
replace: function(paramNameArg,objectArg){ replace: function(paramNameArg,objectArg){
obsItems[paramNameArg] = objectArg; obsItems[paramNameArg] = objectArg
}, },
merge: function(paramNameArg,objectArg){ merge: function(paramNameArg,objectArg){
if(!(typeof obsItems[paramNameArg] === "undefined")){ if (!(typeof obsItems[paramNameArg] === 'undefined')) {
obsItems[paramNameArg] = plugins._.assign(obsItems[paramNameArg],objectArg); obsItems[paramNameArg] = plugins._.assign(obsItems[paramNameArg],objectArg)
} else { } else {
console.log("object is not present, so there is nothing to merge"); console.log('object is not present, so there is nothing to merge')
} }
}, },
get: function(keyName) { get: function(keyName) {
return obsItems[keyName]; return obsItems[keyName]
}, },
getAll: function () { getAll: function () {
return obsItems; return obsItems
}, },
addComplete: function(itemsArg) { addComplete: function(itemsArg) {
obsItems = plugins._.assign(obsItems,itemsArg); obsItems = plugins._.assign(obsItems,itemsArg)
return obsItems; return obsItems
} }
}; }
export var obsItems:any = {}; export var obsItems: any = {}

View File

@ -1,7 +1,8 @@
/// <reference path="typings/main.d.ts" /> import 'typings-global'
var plugins = { import * as Q from 'q'
Q: require("q"), import * as _ from 'lodash'
_: require("lodash")
};
export = plugins; export {
Q,
_
}

View File

@ -1,5 +0,0 @@
{
"ambientDependencies": {
"node": "github:DefinitelyTyped/DefinitelyTyped/node/node.d.ts"
}
}

3
tslint.json Normal file
View File

@ -0,0 +1,3 @@
{
"extends": "tslint-config-standard"
}