update analytics

This commit is contained in:
2017-08-29 16:15:24 +02:00
parent 8c0fcdf5b7
commit b9d4953bcd
7 changed files with 110 additions and 69 deletions

20
dist/npmts.cli.js vendored
View File

@ -23,11 +23,25 @@ const NpmtsShip = require("./npmts.ship");
* Since yarn is out and there is heavy caching going on,
* pure download stats are just not reliable enough for us anymore
* Feel free to dig into the smartanalytics package, if you are interested in how it works.
* It is just an https call to Google Analytics.
* It is just an https call to our own Lossless Analytics API.
* Our privacy policy can be found here: https://lossless.gmbh/privacy.html
*/
let npmtsAnalytics = new plugins.smartanalytics.AnalyticsAccount('npmts', 'UA-64087619-5');
npmtsAnalytics.sendEvent('npm', 'exec', 'git.zone');
let npmtsAnalytics = new plugins.smartanalytics.Analytics({
apiEndPoint: 'https://pubapi-1.lossless.one/analytics',
projectId: 'gitzone',
appName: 'npmts'
});
process.nextTick(() => __awaiter(this, void 0, void 0, function* () {
// make the analytics call
npmtsAnalytics.recordEvent('npmToolExecution', {
executionMode: (yield NpmtsConfig.configPromise).mode,
tsOptions: (yield NpmtsConfig.configPromise).tsOptions,
watch: (yield NpmtsConfig.configPromise).watch,
coverageTreshold: (yield NpmtsConfig.configPromise).coverageTreshold
}).catch(err => {
plugins.beautylog.warn('Lossless Analytics API not available...');
});
}));
exports.run = () => __awaiter(this, void 0, void 0, function* () {
let done = q.defer();
plugins.beautylog.figletSync('NPMTS');

View File

@ -23,3 +23,4 @@ export interface INpmtsConfig {
};
}
export declare let run: (argvArg: any) => Promise<{}>;
export declare let configPromise: Promise<INpmtsConfig>;

View File

@ -2,9 +2,9 @@
Object.defineProperty(exports, "__esModule", { value: true });
const plugins = require("./npmts.plugins");
const paths = require("./npmts.paths");
const q = require("smartq");
const smartq = require("smartq");
exports.run = function (argvArg) {
let done = q.defer();
let done = smartq.defer();
let defaultConfig = {
argv: undefined,
coverageTreshold: 70,
@ -63,5 +63,9 @@ exports.run = function (argvArg) {
}
plugins.beautylog.ok('build options are ready!');
done.resolve(config);
configDeferred.resolve(config);
return done.promise;
};
// config deferred usage
let configDeferred = smartq.defer();
exports.configPromise = configDeferred.promise;