Skip to content

Commit aed850e

Browse files
authored
Merge pull request #54 from NativeScript/buhov/analytics
Google Analytics and Telerik Analytics monitoring of the extension
2 parents 08ed1c8 + f62d0bc commit aed850e

35 files changed

+811
-265
lines changed

.vscode/launch.json

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
{
2+
"version": "0.1.0",
3+
"configurations": [
4+
{
5+
"name": "launch as server",
6+
"type": "node",
7+
"request": "launch",
8+
"program": "${workspaceRoot}/out/debug-adapter/webKitDebug.js",
9+
"runtimeArgs": ["--nolazy"],
10+
"args": [ "--server=4712" ],
11+
"stopOnEntry": false,
12+
"sourceMaps": true,
13+
"outDir": "${workspaceRoot}/out",
14+
"cwd": "${workspaceRoot}"
15+
},
16+
{
17+
"name": "launch in extension host",
18+
"type": "extensionHost",
19+
"request": "launch",
20+
// Path to VSCode executable
21+
"runtimeExecutable": "${execPath}",
22+
"args": [
23+
"--extensionDevelopmentPath=${workspaceRoot}"
24+
],
25+
"stopOnEntry": true,
26+
"sourceMaps": true,
27+
"outDir": "${workspaceRoot}/out",
28+
"cwd": "${workspaceRoot}"
29+
},
30+
{
31+
"name": "run tests on mac",
32+
"type": "node",
33+
"request": "launch",
34+
"program": "${workspaceRoot}/node_modules/mocha/bin/_mocha",
35+
"runtimeArgs": [ "--nolazy" ],
36+
"args": [
37+
"--opts", "${workspaceRoot}/src/tests/config/mocha.opts",
38+
"--config", "${workspaceRoot}/src/tests/config/mac.json",
39+
"${workspaceRoot}/out/tests/"
40+
],
41+
"stopOnEntry": false,
42+
"sourceMaps": true,
43+
"outDir": "${workspaceRoot}/out",
44+
"cwd": "${workspaceRoot}"
45+
},
46+
{
47+
"name": "run tests on win",
48+
"type": "node",
49+
"request": "launch",
50+
"program": "${workspaceRoot}/node_modules/mocha/bin/_mocha",
51+
"runtimeArgs": [ "--nolazy" ],
52+
"args": [
53+
"--opts", "${workspaceRoot}/src/tests/config/mocha.opts",
54+
"--config", "${workspaceRoot}/src/tests/config/win.json",
55+
"${workspaceRoot}/out/tests/"
56+
],
57+
"stopOnEntry": false,
58+
"sourceMaps": true,
59+
"outDir": "${workspaceRoot}/out",
60+
"cwd": "${workspaceRoot}"
61+
},
62+
{
63+
"name": "run tests (custom)",
64+
"type": "node",
65+
"request": "launch",
66+
"program": "${workspaceRoot}/node_modules/mocha/bin/_mocha",
67+
"runtimeArgs": [ "--nolazy" ],
68+
"args": [
69+
"--opts", "${workspaceRoot}/src/tests/config/mocha.opts",
70+
"--config", "${workspaceRoot}/src/tests/config/custom.json",
71+
"${workspaceRoot}/out/tests/"
72+
],
73+
"stopOnEntry": false,
74+
"sourceMaps": true,
75+
"outDir": "${workspaceRoot}/out",
76+
"cwd": "${workspaceRoot}"
77+
}
78+
]
79+
}

.vscode/settings.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"editor.insertSpaces": true,
3+
"files.trimTrailingWhitespace": true,
4+
"files.exclude": {
5+
".git": true,
6+
"bin": true,
7+
"node_modules": false
8+
},
9+
"search.exclude": {
10+
".git": true,
11+
"node_modules": true,
12+
"bin": true,
13+
"out": true
14+
}
15+
}

.vscode/tasks.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"version": "0.1.0",
3+
"windows": {
4+
"command": ".\\node_modules\\.bin\\tsc"
5+
},
6+
"command": "./node_modules/.bin/tsc",
7+
"isShellCommand": true,
8+
"args": ["-p", "./src"],
9+
"problemMatcher": "$tsc"
10+
}

package.json

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,34 +25,48 @@
2525
],
2626
"license": "SEE LICENSE IN LICENSE.txt",
2727
"dependencies": {
28+
"node-ipc": "^7.0.0",
2829
"source-map": "^0.5.3",
29-
"vscode-debugprotocol": "^1.7.0",
30-
"vscode-debugadapter": "^1.7.0"
30+
"xmlhttprequest": "https://github.com/telerik/node-XMLHttpRequest/tarball/master",
31+
"universal-analytics": "^0.3.11",
32+
"vscode-debugadapter": "^1.7.0",
33+
"vscode-debugprotocol": "^1.7.0"
3134
},
3235
"devDependencies": {
3336
"mocha": "^2.4.5",
3437
"tslint": "^3.5.0",
3538
"typescript": "^1.8.2",
36-
"typings": "^0.7.9",
39+
"typings": "^1.0.4",
3740
"vsce": "^1.0.0",
3841
"vscode": "^0.11.x",
3942
"vscode-debugadapter-testsupport": "^1.7.0"
4043
},
4144
"scripts": {
4245
"postinstall": "node ./node_modules/vscode/bin/install && cd src && typings install",
4346
"clean": "git clean -fdx",
44-
"build": "tsc -p ./src",
47+
"build": "tsc -p ./src && cp ./src/services/analytics/EqatecMonitor.min.js ./out/services/analytics/EqatecMonitor.min.js",
4548
"package": "vsce package",
4649
"launch-as-server": "node --nolazy ./out/webkit/webKitDebug.js --server=4712",
4750
"test-mac": "mocha --opts ./src/tests/config/mocha.opts --config ../../src/tests/config/mac.json ./out/tests",
4851
"test-win": "mocha --opts ./src/tests/config/mocha.opts --config ../../src/tests/config/win.json ./out/tests",
4952
"test-custom": "mocha --opts ./src/tests/config/mocha.opts --config ../../src/tests/config/custom.json ./out/tests"
5053
},
51-
"main": "./out/nativescript/nsMain",
54+
"main": "./out/main",
5255
"activationEvents": [
5356
"*"
5457
],
5558
"contributes": {
59+
"configuration": {
60+
"type": "object",
61+
"title": "NativeScript Extension Configurations",
62+
"properties": {
63+
"nativescript.analytics.enabled": {
64+
"type": "boolean",
65+
"default": true,
66+
"description": "Enables the extension tracking."
67+
}
68+
}
69+
},
5670
"commands": [
5771
{
5872
"command": "nativescript.runIos",
@@ -87,7 +101,7 @@
87101
"typescript"
88102
]
89103
},
90-
"program": "./out/webkit/webKitDebug.js",
104+
"program": "./out/debug-adapter/webKitDebug.js",
91105
"runtime": "node",
92106
"initialConfigurations": [
93107
{

src/.vscode/launch.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"name": "launch as server",
66
"type": "node",
77
"request": "launch",
8-
"program": "${workspaceRoot}/../out/webkit/webKitDebug.js",
8+
"program": "${workspaceRoot}/../out/debug-adapter/webKitDebug.js",
99
"runtimeArgs": ["--nolazy"],
1010
"args": [ "--server=4712" ],
1111
"stopOnEntry": true,
@@ -20,7 +20,7 @@
2020
// Path to VSCode executable
2121
"runtimeExecutable": "${execPath}",
2222
"args": [
23-
"--extensionDevelopmentPath=${workspaceRoot}"
23+
"--extensionDevelopmentPath=${workspaceRoot}/.."
2424
],
2525
"stopOnEntry": false,
2626
"sourceMaps": true,

src/common/Version.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
export class Version {
2+
public static parse(versionStr: string): number[] {
3+
if (versionStr === null) {
4+
return null;
5+
}
6+
let version: number[] = versionStr.split('.').map<number>((str, index, array) => parseInt(str));
7+
for(let i = version.length; i < 3; i++) {
8+
version.push(0);
9+
}
10+
return version;
11+
}
12+
13+
public static stringify(version: number[]): string {
14+
return `${version[0]}.${version[1]}.${version[2]}`;
15+
}
16+
17+
public static compareBySubminor(v1, v2): number {
18+
return (v1[0] - v2[0] != 0) ? (v1[0] - v2[0]) : (v1[1] - v2[1] != 0) ? v1[1] - v2[1] : v1[2] - v2[2];
19+
}
20+
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
* Copyright (C) Microsoft Corporation. All rights reserved.
33
*--------------------------------------------------------*/
44

5-
import * as utils from '../webkit/utilities';
5+
import * as utils from '../utilities';
66
import {DebugProtocol} from 'vscode-debugprotocol';
7-
import {IDebugTransformer, IDebugAdapter} from '../webkit/WebKitAdapterInterfaces';
7+
import {IDebugTransformer, IDebugAdapter} from '../WebKitAdapterInterfaces';
88

99
export type EventHandler = (event: DebugProtocol.Event) => void;
1010

src/adapter/lineNumberTransformer.ts renamed to src/debug-adapter/adapter/lineNumberTransformer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*--------------------------------------------------------*/
44

55
import {DebugProtocol} from 'vscode-debugprotocol';
6-
import {IDebugTransformer, ISetBreakpointsResponseBody, IStackTraceResponseBody} from '../webkit/WebKitAdapterInterfaces';
6+
import {IDebugTransformer, ISetBreakpointsResponseBody, IStackTraceResponseBody} from '../WebKitAdapterInterfaces';
77

88
/**
99
* Converts from 1 based lines on the client side to 0 based lines on the target side

src/adapter/pathTransformer.ts renamed to src/debug-adapter/adapter/pathTransformer.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
* Copyright (C) Microsoft Corporation. All rights reserved.
33
*--------------------------------------------------------*/
44

5-
import * as utils from '../webkit/utilities';
5+
import * as utils from '../utilities';
66
import {DebugProtocol} from 'vscode-debugprotocol';
77
import * as path from 'path';
8-
import {ISetBreakpointsArgs, IDebugTransformer, ILaunchRequestArgs, IAttachRequestArgs, IStackTraceResponseBody} from '../webkit/WebKitAdapterInterfaces';
8+
import {ISetBreakpointsArgs, IDebugTransformer, ILaunchRequestArgs, IAttachRequestArgs, IStackTraceResponseBody} from '../WebKitAdapterInterfaces';
99

1010
interface IPendingBreakpoint {
1111
resolve: () => void;

src/adapter/sourceMaps/pathUtilities.ts renamed to src/debug-adapter/adapter/sourceMaps/pathUtilities.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import * as Path from 'path';
88
import * as URL from 'url';
99

10-
import * as utils from '../../webkit/utilities';
10+
import * as utils from '../../utilities';
1111

1212
export function getPathRoot(p: string) {
1313
if (p) {

0 commit comments

Comments
 (0)