From 148fbe2a05e78d44b2f77aef3b912cd7bb83c0f5 Mon Sep 17 00:00:00 2001 From: Holger Stitz Date: Tue, 16 Jul 2019 11:42:20 +0200 Subject: [PATCH 01/10] Move matomo files from ordino_public --- src/index.ts | 15 +--- src/matomo.ts | 159 +++++++++++++++++++++++++++++++++++++++++ tdp_matomo/__init__.py | 4 +- tdp_matomo/config.json | 7 +- 4 files changed, 169 insertions(+), 16 deletions(-) create mode 100644 src/matomo.ts diff --git a/src/index.ts b/src/index.ts index 7ee18ff..b6fc554 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,14 +1 @@ - -import {mixin} from 'phovea_core/src'; - -export interface IHelloOptions { - name?: string; -} - -export function hello(options?: IHelloOptions) { - //merge with default options - options = mixin({ - name: 'World' - }, options); - return `Hello ${options.name}`; -} +export * from './matomo'; diff --git a/src/matomo.ts b/src/matomo.ts new file mode 100644 index 0000000..8d05457 --- /dev/null +++ b/src/matomo.ts @@ -0,0 +1,159 @@ +import {on} from 'phovea_core/src/event'; +import {GLOBAL_EVENT_USER_LOGGED_IN, IUser, GLOBAL_EVENT_USER_LOGGED_OUT} from 'phovea_core/src/security'; +import Ordino from 'ordino/src/Ordino'; +import {SESSION_KEY_NEW_ENTRY_POINT} from 'ordino/src/internal/constants'; +import * as session from 'phovea_core/src/session'; +import {ProvenanceGraph, ActionNode} from 'phovea_core/src/provenance'; +import {getAPIJSON} from 'phovea_core/src/ajax'; +import parseRange from 'phovea_core/src/range/parser'; + +/** + * Trackable Matomo event + */ +interface IMatomoEvent { + category: string; + action: string; + name?: (node: ActionNode) => string | string; + value?: (node: ActionNode) => number | number; +} + +/** + * Map of trackable actions + * key = phovea extension id + */ +const trackableActions = new Map(); + +// custom event +trackableActions.set('runChain', {category:'provenance', action: 'runChain'}); + +// from tdp_core\src\internal\cmds.ts +trackableActions.set('tdpInitSession', {category:'session', action: 'init'}); +trackableActions.set('tdpSetParameter', {category:'view', action: 'setParameter'}); + +// from tdp_core\src\lineup\internal\scorecmds.ts +trackableActions.set('tdpAddScore', {category:'score', action: 'add'}); +trackableActions.set('tdpRemoveScore', {category:'score', action: 'remove'}); + +// from ordino\src\internal\cmds.ts +trackableActions.set('targidCreateView', {category:'view', action: 'create'}); +trackableActions.set('targidRemoveView', {category:'view', action: 'remove'}); +trackableActions.set('targidReplaceView', {category:'view', action: 'replace'}); +trackableActions.set('targidSetSelection', {category:'view', action: 'setSelection', value: (node) => parseRange(node.parameter.range).dim(0).length}); + +// from tdp_core\src\lineup\internal\cmds.ts +trackableActions.set('lineupSetRankingSortCriteria', {category:'lineup', action: 'setRankingSortCriteria'}); +trackableActions.set('lineupSetSortCriteria', {category:'lineup', action: 'setRankingSortCriteria'}); +trackableActions.set('lineupSetGroupCriteria', {category:'lineup', action: 'setGroupCriteria'}); +trackableActions.set('lineupAddRanking', {category:'lineup', action: 'addRanking'}); +trackableActions.set('lineupSetColumn', {category:'lineup', action: 'setColumn'}); +trackableActions.set('lineupAddColumn', {category:'lineup', action: 'addColumn'}); +trackableActions.set('lineupMoveColumn', {category:'lineup', action: 'moveColumn'}); + +// assume `_pag` is already declared +(window)._paq = (window)._paq || []; +declare const _paq: any[][]; + +interface IPhoveaMatomoConfig { + /** + * URL to Matomo backend with with a trailing slash + * Use `null` to disables the tracking + */ + url?: string; + + /** + * ID of the Matomo site (generated when creating a page) + */ + site: string; +} + +const matomo = { + trackEvent(category: string, action: string, name?: string, value?: number) { + const t: any[] = ['trackEvent', category, action]; + if (typeof name === 'string') { + t.push(name); + } + if (typeof value === 'number') { + t.push(value); + } + _paq.push(t); + }, + login(user: string) { + _paq.push(['setUserId', user]); + // _paq.push(['requireConsent']); TODO user consent form with opt out + _paq.push(['trackPageView']); + _paq.push(['enableLinkTracking']); + // enable correct measuring of the site since it is a single page site + _paq.push(['enableHeartBeatTimer']); + }, + logout() { + _paq.push(['resetUserId']); + _paq.push(['trackPageView']); + } +}; + +function trackGraph(graph: ProvenanceGraph) { + graph.on('execute', (_, node: ActionNode) => { + if(!Array.from(trackableActions.keys()).includes(node.getAttr('f_id'))) { + return; + } + const event = trackableActions.get(node.getAttr('f_id')); + matomo.trackEvent( + event.category, + event.action, + (typeof event.name === 'function') ? event.name(node) : node.name, + (typeof event.value === 'function') ? event.value(node) : null + ); + }); + graph.on('run_chain', (_, nodes: ActionNode[]) => { + const event = trackableActions.get('runChain'); + matomo.trackEvent(event.category, event.action, 'Run actions in chain', nodes.length); + }); +} + +function initMamoto(config: IPhoveaMatomoConfig): boolean { + if (!config.url) { + return false; + } + _paq.push(['setTrackerUrl', `${config.url}matomo.php`]); + _paq.push(['setSiteId', config.site]); + + const s = document.createElement('script'); + s.type = 'text/javascript'; + s.async = true; + s.defer = true; + s.src = `${config.url}matomo.js`; + const base = document.getElementsByTagName('script')[0]; + base.insertAdjacentElement('beforebegin', s); + return true; +} + +export function trackApp(ordino: Ordino): Promise { + const matomoConfig = getAPIJSON('/tdp/config/matomo'); + + ordino.on(Ordino.EVENT_OPEN_START_MENU, () => matomo.trackEvent('startMenu', 'open', 'Open start menu')); + + const sessionInit: {view: string, options: any} = session.retrieve(SESSION_KEY_NEW_ENTRY_POINT); + + on(GLOBAL_EVENT_USER_LOGGED_IN, (_, user: IUser) => { + matomo.login(user.name); + ordino.graph.then((graph) => { + if (graph.isEmpty && !sessionInit) { + matomo.trackEvent('session', 'new', 'New Session'); + } else if (sessionInit) { + // matomo.trackEvent('session', 'init', `Initialize ${sessionInit.view}`);//, JSON.stringify(sessionInit.options)); + } else { + matomo.trackEvent('session', 'continue', `${graph.desc.id} at state ${ordino.clueManager.storedState || Math.max(...graph.states.map((s) => s.id))}`); + } + + matomoConfig.then((config: IPhoveaMatomoConfig) => { + trackGraph(graph); + }); + }); + }); + + on(GLOBAL_EVENT_USER_LOGGED_OUT, () => { + matomo.logout(); + }); + + return matomoConfig.then((config: IPhoveaMatomoConfig) => initMamoto(config)); +} diff --git a/tdp_matomo/__init__.py b/tdp_matomo/__init__.py index ab455e0..86c0558 100644 --- a/tdp_matomo/__init__.py +++ b/tdp_matomo/__init__.py @@ -11,7 +11,9 @@ def phovea(registry): :param registry: """ # generator-phovea:begin - + registry.append('tdp-config-safe-keys', 'matomo', '', { + 'configKey': 'tdp_matomo.matomo' + }) # generator-phovea:end pass diff --git a/tdp_matomo/config.json b/tdp_matomo/config.json index 0967ef4..3b13b59 100644 --- a/tdp_matomo/config.json +++ b/tdp_matomo/config.json @@ -1 +1,6 @@ -{} +{ + "matomo": { + "url": "", // matomo url with a trailing slash + "site": "1" + } +} From 5a3eb3481e1d4dcacba3108a3452944dbbf9da0b Mon Sep 17 00:00:00 2001 From: Holger Stitz Date: Tue, 16 Jul 2019 11:43:28 +0200 Subject: [PATCH 02/10] Accept any ATDPApplication for trackApp() --- src/matomo.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/matomo.ts b/src/matomo.ts index 8d05457..3588226 100644 --- a/src/matomo.ts +++ b/src/matomo.ts @@ -6,6 +6,7 @@ import * as session from 'phovea_core/src/session'; import {ProvenanceGraph, ActionNode} from 'phovea_core/src/provenance'; import {getAPIJSON} from 'phovea_core/src/ajax'; import parseRange from 'phovea_core/src/range/parser'; +import ATDPApplication from 'tdp_core/src/ATDPApplication'; /** * Trackable Matomo event @@ -127,22 +128,22 @@ function initMamoto(config: IPhoveaMatomoConfig): boolean { return true; } -export function trackApp(ordino: Ordino): Promise { +export function trackApp(tdpApp: ATDPApplication): Promise { const matomoConfig = getAPIJSON('/tdp/config/matomo'); - ordino.on(Ordino.EVENT_OPEN_START_MENU, () => matomo.trackEvent('startMenu', 'open', 'Open start menu')); + tdpApp.on(Ordino.EVENT_OPEN_START_MENU, () => matomo.trackEvent('startMenu', 'open', 'Open start menu')); const sessionInit: {view: string, options: any} = session.retrieve(SESSION_KEY_NEW_ENTRY_POINT); on(GLOBAL_EVENT_USER_LOGGED_IN, (_, user: IUser) => { matomo.login(user.name); - ordino.graph.then((graph) => { + tdpApp.graph.then((graph) => { if (graph.isEmpty && !sessionInit) { matomo.trackEvent('session', 'new', 'New Session'); } else if (sessionInit) { // matomo.trackEvent('session', 'init', `Initialize ${sessionInit.view}`);//, JSON.stringify(sessionInit.options)); } else { - matomo.trackEvent('session', 'continue', `${graph.desc.id} at state ${ordino.clueManager.storedState || Math.max(...graph.states.map((s) => s.id))}`); + matomo.trackEvent('session', 'continue', `${graph.desc.id} at state ${tdpApp.clueManager.storedState || Math.max(...graph.states.map((s) => s.id))}`); } matomoConfig.then((config: IPhoveaMatomoConfig) => { From d6ff0f522356fb06caa646626d3620719fbc7464 Mon Sep 17 00:00:00 2001 From: Holger Stitz Date: Tue, 16 Jul 2019 11:58:22 +0200 Subject: [PATCH 03/10] Extract ordino-specific events --- src/matomo.ts | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/src/matomo.ts b/src/matomo.ts index 3588226..3c401f2 100644 --- a/src/matomo.ts +++ b/src/matomo.ts @@ -5,19 +5,32 @@ import {SESSION_KEY_NEW_ENTRY_POINT} from 'ordino/src/internal/constants'; import * as session from 'phovea_core/src/session'; import {ProvenanceGraph, ActionNode} from 'phovea_core/src/provenance'; import {getAPIJSON} from 'phovea_core/src/ajax'; -import parseRange from 'phovea_core/src/range/parser'; import ATDPApplication from 'tdp_core/src/ATDPApplication'; /** * Trackable Matomo event */ -interface IMatomoEvent { +export interface IMatomoEvent { category: string; action: string; name?: (node: ActionNode) => string | string; value?: (node: ActionNode) => number | number; } +/** + * Trackable action + */ +export interface ITrackableAction { + /** + * phovea extension id + */ + id: string; + /** + * matomo event + */ + event: IMatomoEvent; +} + /** * Map of trackable actions * key = phovea extension id @@ -35,12 +48,6 @@ trackableActions.set('tdpSetParameter', {category:'view', action: 'setParameter' trackableActions.set('tdpAddScore', {category:'score', action: 'add'}); trackableActions.set('tdpRemoveScore', {category:'score', action: 'remove'}); -// from ordino\src\internal\cmds.ts -trackableActions.set('targidCreateView', {category:'view', action: 'create'}); -trackableActions.set('targidRemoveView', {category:'view', action: 'remove'}); -trackableActions.set('targidReplaceView', {category:'view', action: 'replace'}); -trackableActions.set('targidSetSelection', {category:'view', action: 'setSelection', value: (node) => parseRange(node.parameter.range).dim(0).length}); - // from tdp_core\src\lineup\internal\cmds.ts trackableActions.set('lineupSetRankingSortCriteria', {category:'lineup', action: 'setRankingSortCriteria'}); trackableActions.set('lineupSetSortCriteria', {category:'lineup', action: 'setRankingSortCriteria'}); @@ -92,7 +99,7 @@ const matomo = { } }; -function trackGraph(graph: ProvenanceGraph) { +function trackGraph(graph: ProvenanceGraph, trackableActions: Map) { graph.on('execute', (_, node: ActionNode) => { if(!Array.from(trackableActions.keys()).includes(node.getAttr('f_id'))) { return; @@ -128,7 +135,12 @@ function initMamoto(config: IPhoveaMatomoConfig): boolean { return true; } -export function trackApp(tdpApp: ATDPApplication): Promise { +export function trackApp(tdpApp: ATDPApplication, customActions?: {id: string, event: IMatomoEvent}[]): Promise { + // merge custom actions into trackable actions + if(customActions && customActions.length > 0) { + customActions.forEach((action) => trackableActions.set(action.id, action.event)); + } + const matomoConfig = getAPIJSON('/tdp/config/matomo'); tdpApp.on(Ordino.EVENT_OPEN_START_MENU, () => matomo.trackEvent('startMenu', 'open', 'Open start menu')); @@ -147,7 +159,7 @@ export function trackApp(tdpApp: ATDPApplication): Promise { } matomoConfig.then((config: IPhoveaMatomoConfig) => { - trackGraph(graph); + trackGraph(graph, trackableActions); }); }); }); From c5d26988a14f2cf9017c6dfa2880cf3fa3007042 Mon Sep 17 00:00:00 2001 From: Holger Stitz Date: Tue, 16 Jul 2019 14:20:00 +0200 Subject: [PATCH 04/10] Remove Ordino-specific code and imports --- src/matomo.ts | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/matomo.ts b/src/matomo.ts index 3c401f2..e301bd2 100644 --- a/src/matomo.ts +++ b/src/matomo.ts @@ -1,8 +1,5 @@ import {on} from 'phovea_core/src/event'; import {GLOBAL_EVENT_USER_LOGGED_IN, IUser, GLOBAL_EVENT_USER_LOGGED_OUT} from 'phovea_core/src/security'; -import Ordino from 'ordino/src/Ordino'; -import {SESSION_KEY_NEW_ENTRY_POINT} from 'ordino/src/internal/constants'; -import * as session from 'phovea_core/src/session'; import {ProvenanceGraph, ActionNode} from 'phovea_core/src/provenance'; import {getAPIJSON} from 'phovea_core/src/ajax'; import ATDPApplication from 'tdp_core/src/ATDPApplication'; @@ -143,17 +140,13 @@ export function trackApp(tdpApp: ATDPApplication, customActions?: {id: stri const matomoConfig = getAPIJSON('/tdp/config/matomo'); - tdpApp.on(Ordino.EVENT_OPEN_START_MENU, () => matomo.trackEvent('startMenu', 'open', 'Open start menu')); - - const sessionInit: {view: string, options: any} = session.retrieve(SESSION_KEY_NEW_ENTRY_POINT); + tdpApp.on(ATDPApplication.EVENT_OPEN_START_MENU, () => matomo.trackEvent('startMenu', 'open', 'Open start menu')); on(GLOBAL_EVENT_USER_LOGGED_IN, (_, user: IUser) => { matomo.login(user.name); tdpApp.graph.then((graph) => { - if (graph.isEmpty && !sessionInit) { + if (graph.isEmpty) { matomo.trackEvent('session', 'new', 'New Session'); - } else if (sessionInit) { - // matomo.trackEvent('session', 'init', `Initialize ${sessionInit.view}`);//, JSON.stringify(sessionInit.options)); } else { matomo.trackEvent('session', 'continue', `${graph.desc.id} at state ${tdpApp.clueManager.storedState || Math.max(...graph.states.map((s) => s.id))}`); } From 6e17f0f7342a34b2ffb8fcd86ac40904aa23592b Mon Sep 17 00:00:00 2001 From: Holger Stitz Date: Tue, 16 Jul 2019 14:57:23 +0200 Subject: [PATCH 05/10] Extract list of default actions --- src/actions.ts | 27 +++++++++++++++++++++++++++ src/matomo.ts | 27 +-------------------------- 2 files changed, 28 insertions(+), 26 deletions(-) create mode 100644 src/actions.ts diff --git a/src/actions.ts b/src/actions.ts new file mode 100644 index 0000000..e5b7a70 --- /dev/null +++ b/src/actions.ts @@ -0,0 +1,27 @@ +import {IMatomoEvent} from './matomo'; + +/** + * Map of trackable actions + * key = phovea extension id + */ +export const trackableActions = new Map(); + +// custom event +trackableActions.set('runChain', {category:'provenance', action: 'runChain'}); + +// from tdp_core\src\internal\cmds.ts +trackableActions.set('tdpInitSession', {category:'session', action: 'init'}); +trackableActions.set('tdpSetParameter', {category:'view', action: 'setParameter'}); + +// from tdp_core\src\lineup\internal\scorecmds.ts +trackableActions.set('tdpAddScore', {category:'score', action: 'add'}); +trackableActions.set('tdpRemoveScore', {category:'score', action: 'remove'}); + +// from tdp_core\src\lineup\internal\cmds.ts +trackableActions.set('lineupSetRankingSortCriteria', {category:'lineup', action: 'setRankingSortCriteria'}); +trackableActions.set('lineupSetSortCriteria', {category:'lineup', action: 'setRankingSortCriteria'}); +trackableActions.set('lineupSetGroupCriteria', {category:'lineup', action: 'setGroupCriteria'}); +trackableActions.set('lineupAddRanking', {category:'lineup', action: 'addRanking'}); +trackableActions.set('lineupSetColumn', {category:'lineup', action: 'setColumn'}); +trackableActions.set('lineupAddColumn', {category:'lineup', action: 'addColumn'}); +trackableActions.set('lineupMoveColumn', {category:'lineup', action: 'moveColumn'}); diff --git a/src/matomo.ts b/src/matomo.ts index e301bd2..859ba90 100644 --- a/src/matomo.ts +++ b/src/matomo.ts @@ -3,6 +3,7 @@ import {GLOBAL_EVENT_USER_LOGGED_IN, IUser, GLOBAL_EVENT_USER_LOGGED_OUT} from ' import {ProvenanceGraph, ActionNode} from 'phovea_core/src/provenance'; import {getAPIJSON} from 'phovea_core/src/ajax'; import ATDPApplication from 'tdp_core/src/ATDPApplication'; +import {trackableActions} from './actions'; /** * Trackable Matomo event @@ -28,32 +29,6 @@ export interface ITrackableAction { event: IMatomoEvent; } -/** - * Map of trackable actions - * key = phovea extension id - */ -const trackableActions = new Map(); - -// custom event -trackableActions.set('runChain', {category:'provenance', action: 'runChain'}); - -// from tdp_core\src\internal\cmds.ts -trackableActions.set('tdpInitSession', {category:'session', action: 'init'}); -trackableActions.set('tdpSetParameter', {category:'view', action: 'setParameter'}); - -// from tdp_core\src\lineup\internal\scorecmds.ts -trackableActions.set('tdpAddScore', {category:'score', action: 'add'}); -trackableActions.set('tdpRemoveScore', {category:'score', action: 'remove'}); - -// from tdp_core\src\lineup\internal\cmds.ts -trackableActions.set('lineupSetRankingSortCriteria', {category:'lineup', action: 'setRankingSortCriteria'}); -trackableActions.set('lineupSetSortCriteria', {category:'lineup', action: 'setRankingSortCriteria'}); -trackableActions.set('lineupSetGroupCriteria', {category:'lineup', action: 'setGroupCriteria'}); -trackableActions.set('lineupAddRanking', {category:'lineup', action: 'addRanking'}); -trackableActions.set('lineupSetColumn', {category:'lineup', action: 'setColumn'}); -trackableActions.set('lineupAddColumn', {category:'lineup', action: 'addColumn'}); -trackableActions.set('lineupMoveColumn', {category:'lineup', action: 'moveColumn'}); - // assume `_pag` is already declared (window)._paq = (window)._paq || []; declare const _paq: any[][]; From 737bddf3c9a71f80e9c2465237a8c7d9ce5785ff Mon Sep 17 00:00:00 2001 From: Holger Stitz Date: Tue, 16 Jul 2019 14:57:31 +0200 Subject: [PATCH 06/10] Add documentation --- README.md | 36 ++++++++++++++++++++++++++++++++---- src/matomo.ts | 16 ++++++++++++++++ 2 files changed, 48 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 1985ea4..0447df9 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,37 @@ -tdp_matomo [![Phovea][phovea-image]][phovea-url] [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][daviddm-image]][daviddm-url] +tdp_matomo [![Phovea][phovea-image]][phovea-url] [![NPM version][npm-image]][npm-url] [![Dependency Status][daviddm-image]][daviddm-url] ===================== -Matomo tracking for TDP applications +Matomo tracking for TDP applications based on provenance graph commands. + +Configuration +------------ + +The tracking starts when a URL to a Matomo backend is set in the `config.js`. +The site ID corresponds with the Matomo site. + +```js +{ + "matomo": { + "url": "https://matomo.my-example-domain.com/", // matomo url with a trailing slash + "site": "1" + } +} +``` + +### Provenance Commands + +The tracked default provenance commands from [tdp_core](https://github.com/datavisyn/tdp_core) are defined in [actions.ts](./src/actions.ts). + +Add a list of custom events when initializing the tracking: + +```ts +const trackableActions: ITrackableAction[] = [ + // id = phovea extension id + {id: 'targidCreateView', event: {category:'view', action: 'create'}}, +]; +trackApp(app, trackableActions); +``` + Installation ------------ @@ -38,7 +68,5 @@ This repository is part of **[Phovea](http://phovea.caleydo.org/)**, a platform [phovea-url]: https://phovea.caleydo.org [npm-image]: https://badge.fury.io/js/tdp_matomo.svg [npm-url]: https://npmjs.org/package/tdp_matomo -[travis-image]: https://travis-ci.org/datavisyn/tdp_matomo.svg?branch=master -[travis-url]: https://travis-ci.org/datavisyn/tdp_matomo [daviddm-image]: https://david-dm.org/datavisyn/tdp_matomo/status.svg [daviddm-url]: https://david-dm.org/datavisyn/tdp_matomo diff --git a/src/matomo.ts b/src/matomo.ts index 859ba90..bb344a6 100644 --- a/src/matomo.ts +++ b/src/matomo.ts @@ -107,6 +107,22 @@ function initMamoto(config: IPhoveaMatomoConfig): boolean { return true; } +/** + * Track provenance commands of any TDPApplication + * + * Add custom actions using the phovea extension id: + * + * ```ts + * // id = phovea extension id + * const trackableActions: ITrackableAction[] = [ + * {id: 'targidCreateView', event: {category:'view', action: 'create'}}, + * ]; + * trackApp(app, trackableActions); + * ``` + * + * @param tdpApp ATDPApplication + * @param customActions List of custom actions + */ export function trackApp(tdpApp: ATDPApplication, customActions?: {id: string, event: IMatomoEvent}[]): Promise { // merge custom actions into trackable actions if(customActions && customActions.length > 0) { From a07271fdb69daf14420833540e17edf1bc5b7922 Mon Sep 17 00:00:00 2001 From: Holger Stitz Date: Tue, 16 Jul 2019 15:17:02 +0200 Subject: [PATCH 07/10] Update npm dependencies --- package.json | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/package.json b/package.json index 1a25522..4155b58 100644 --- a/package.json +++ b/package.json @@ -71,41 +71,41 @@ "node": ">= 6" }, "devDependencies": { - "@types/jasmine": "2.5.41", - "awesome-typescript-loader": "3.0.3", - "cache-loader": "1.2.0", - "css-loader": "0.26.1", - "extract-text-webpack-plugin": "2.0.0-rc.3", + "@types/jasmine": "2.5.47", + "awesome-typescript-loader": "3.1.2", + "css-loader": "0.28.0", "extract-loader": "0.1.0", - "ifdef-loader": "2.0.0", - "file-loader": "0.10.0", - "fork-ts-checker-webpack-plugin": "0.2.9", - "html-loader": "0.4.4", - "imports-loader": "0.7.0", + "extract-text-webpack-plugin": "2.1.0", + "file-loader": "0.11.1", + "html-loader": "0.4.5", + "imports-loader": "0.7.1", "jasmine": "2.5.3", "json-loader": "0.5.4", - "karma": "1.4.0", + "karma": "1.5.0", "karma-chrome-launcher": "2.0.0", - "karma-firefox-launcher": "1.0.0", + "karma-firefox-launcher": "1.0.1", "karma-jasmine": "1.1.0", "karma-junit-reporter": "2.0.0", "karma-sourcemap-loader": "0.3.7", - "karma-webpack": "2.0.2", + "karma-webpack": "2.0.3", "mkdirp": "0.5.1", - "node-sass": "4.5.0", + "node-sass": "4.7.2", "null-loader": "0.1.1", "raw-loader": "0.5.1", - "sass-loader": "5.0.0", - "style-loader": "0.13.1", + "sass-loader": "6.0.7", + "style-loader": "0.16.1", + "tslib": "1.9.0", + "tslint": "5.9.1", + "typedoc": "0.11.1", + "typescript": "2.7.2", + "url-loader": "0.5.8", + "webpack": "2.3.3", + "webpack-dev-server": "2.4.2", + "cache-loader": "1.2.0", + "ifdef-loader": "2.0.0", + "fork-ts-checker-webpack-plugin": "0.4.1", "thread-loader": "1.1.2", - "ts-loader": "3.1.1", - "tslib": "1.5.0", - "tslint": "4.4.2", - "typedoc": "0.7.2", - "typescript": "2.2.0", - "url-loader": "0.5.7", - "webpack": "2.2.1", - "webpack-dev-server": "2.4.2" + "ts-loader": "4.0.1" }, "dependencies": { "tdp_core": "github:datavisyn/tdp_core#develop" From c9e60048bffd93f3f4f22321c791b0a964ddb2cc Mon Sep 17 00:00:00 2001 From: Holger Stitz Date: Tue, 16 Jul 2019 15:28:37 +0200 Subject: [PATCH 08/10] Fix test --- tests/index.test.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tests/index.test.ts b/tests/index.test.ts index 7fe669b..99fb020 100644 --- a/tests/index.test.ts +++ b/tests/index.test.ts @@ -1,10 +1,8 @@ /// -import {hello} from '../src/index'; +import {trackApp} from '../src/index'; describe('index', () => { - it('hello', () => { - expect(hello()).toEqual('Hello World'); - expect(hello({})).toEqual('Hello World'); - expect(hello({ name: 'Test' })).toEqual('Hello Test'); + it('trackApp() exists', () => { + expect(typeof trackApp).toBe('function'); }); }); From ec5fe02b15c254ecf43d1b8173c3e73d6e9f1936 Mon Sep 17 00:00:00 2001 From: Holger Stitz Date: Tue, 16 Jul 2019 15:54:01 +0200 Subject: [PATCH 09/10] Prepare release v1.0.0 --- package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 4155b58..cf47045 100644 --- a/package.json +++ b/package.json @@ -2,9 +2,9 @@ "name": "tdp_matomo", "description": "Matomo tracking for TDP applications", "homepage": "https://datavisyn.io", - "version": "1.0.0-SNAPSHOT", + "version": "1.0.0", "author": { - "name": "Datavisyn GmbH", + "name": "datavisyn GmbH", "email": "contact@datavisyn.io", "url": "https://datavisyn.io" }, @@ -108,6 +108,6 @@ "ts-loader": "4.0.1" }, "dependencies": { - "tdp_core": "github:datavisyn/tdp_core#develop" + "tdp_core": "github:datavisyn/tdp_core#semver:^5.2.0" } } From 91eec8a5f3b8af89b96c9ba248019c656dbe8210 Mon Sep 17 00:00:00 2001 From: Holger Stitz Date: Tue, 16 Jul 2019 15:56:19 +0200 Subject: [PATCH 10/10] Update circleci config.yml --- .circleci/config.yml | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 10cd1fc..6025d11 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -3,16 +3,14 @@ jobs: build: working_directory: ~/phovea docker: - - image: caleydo/phovea_circleci_python:v1.0 - tags: - - /v\d+.\d+.\d+.*/ + - image: caleydo/phovea_circleci_python:v2.0 steps: - checkout - run: command: | (!(test -f docker_packages.txt) || (cat docker_packages.txt | xargs sudo apt-get install -y)) - restore_cache: - key: deps2-{{ .Branch }}-{{ checksum "package.json" }} + key: deps3-{{ checksum "package.json" }} - run: name: install-npm-wee command: npm install @@ -21,14 +19,14 @@ jobs: command: | (grep -l '._resolved.: .\(git[^:]*\|bitbucket\):' ./node_modules/*/package.json || true) | xargs -r dirname | xargs -r rm -rf - save_cache: - key: deps2-{{ .Branch }}-{{ checksum "package.json" }} + key: deps3-{{ checksum "package.json" }} paths: - ./node_modules - run: #install all dependencies name: install-npm-wee2 command: npm install - restore_cache: - key: deps1-{{ .Branch }}-{{ checksum "requirements.txt" }}-{{ checksum "requirements_dev.txt" }} + key: deps1-{{ checksum "requirements.txt" }}-{{ checksum "requirements_dev.txt" }} - run: name: install-pip-wee command: | @@ -37,7 +35,7 @@ jobs: pip install -r requirements_dev.txt pip install -r requirements.txt - save_cache: - key: deps1-{{ .Branch }}-{{ checksum "requirements.txt" }}-{{ checksum "requirements_dev.txt" }} + key: deps1-{{ checksum "requirements.txt" }}-{{ checksum "requirements_dev.txt" }} paths: - ~/venv - run: #force update of VCS dependencies? @@ -46,10 +44,24 @@ jobs: . ~/venv/bin/activate pip install --upgrade --upgrade-strategy=only-if-needed -r requirements.txt - run: - name: dist + name: build command: | . ~/venv/bin/activate - npm run dist - - store_artifacts: - path: dist - prefix: dist + npm run build + +workflows: + version: 2 + build-branch: + jobs: + - build: + filters: + tags: + ignore: /^v.*/ + build-tag: + jobs: + - build: + filters: + branches: + ignore: /.*/ + tags: + only: /^v.*/