From 9244deac13c6afcd8a76f945de931a7d504cf4a5 Mon Sep 17 00:00:00 2001 From: Fred Bricon Date: Tue, 8 Jun 2021 16:13:34 +0200 Subject: [PATCH] Remove dependency to vscode-commons Signed-off-by: Fred Bricon --- README.md | 2 +- USAGE_DATA.md | 4 +-- package-lock.json | 87 ++++++++++++----------------------------------- package.json | 11 +++--- src/extension.ts | 2 +- src/telemetry.ts | 8 +++-- 6 files changed, 38 insertions(+), 76 deletions(-) diff --git a/README.md b/README.md index 33f8d9b7..5ee3c8cd 100644 --- a/README.md +++ b/README.md @@ -114,7 +114,7 @@ The following settings are supported: With your approval, the vscode-xml extension collects anonymous [usage data](USAGE_DATA.md) and sends it to Red Hat servers to help improve our products and services. Read our [privacy statement](https://developers.redhat.com/article/tool-data-collection) to learn more. -This extension respects the `redhat.telemetry.enabled` setting, which you can learn more about at https://github.com/redhat-developer/vscode-commons#how-to-disable-telemetry-reporting +This extension respects the `redhat.telemetry.enabled` setting, which you can learn more about at https://github.com/redhat-developer/vscode-redhat-telemetry#how-to-disable-telemetry-reporting ## LemMinX Binary diff --git a/USAGE_DATA.md b/USAGE_DATA.md index fb54c1e3..7eb1c329 100644 --- a/USAGE_DATA.md +++ b/USAGE_DATA.md @@ -1,6 +1,6 @@ # Data collection -vscode-xml has opt-in telemetry collection, provided by [vscode-commons](https://github.com/redhat-developer/vscode-commons). +vscode-xml has opt-in telemetry collection, provided by [vscode-redhat-telemetry](https://github.com/redhat-developer/vscode-redhat-telemetry). ## What's included in the vscode-xml telemetry data @@ -21,7 +21,7 @@ vscode-xml has opt-in telemetry collection, provided by [vscode-commons](https:/ ## What's included in the general telemetry data Please see the -[vscode-commons data collection information](https://github.com/redhat-developer/vscode-commons/blob/master/USAGE_DATA.md#other-extensions) +[vscode-redhat-telemetry data collection information](https://github.com/redhat-developer/vscode-redhat-telemetry/blob/HEAD/USAGE_DATA.md#usage-data-being-collected-by-red-hat-extensions) for information on what data it collects. ## How to opt in or out diff --git a/package-lock.json b/package-lock.json index e7be9e46..4337a492 100644 --- a/package-lock.json +++ b/package-lock.json @@ -37,9 +37,9 @@ "dev": true }, "@redhat-developer/vscode-redhat-telemetry": { - "version": "0.0.13", - "resolved": "https://registry.npmjs.org/@redhat-developer/vscode-redhat-telemetry/-/vscode-redhat-telemetry-0.0.13.tgz", - "integrity": "sha512-y5fuaG+ca3b2zmKZD5YBiDJ0lbJc4ctJ5+xbO5vKTNRuTpPAvNz9UkDe7ZSNMxss5l7wcIlepi+L9l9+eRkGaQ==", + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/@redhat-developer/vscode-redhat-telemetry/-/vscode-redhat-telemetry-0.1.1.tgz", + "integrity": "sha512-uMJNiFNUXCYy/4KZaX+Ctueq+KXIWyS5Cfv2wqHNNzpV9+EhPLHUJoZKbCMY/P+IlgqTWYfpDkghZHiq5ChvEA==", "requires": { "@types/analytics-node": "^3.1.4", "analytics-node": "^3.5.0", @@ -155,7 +155,7 @@ }, "@types/yauzl": { "version": "2.9.1", - "resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.9.1.tgz", + "resolved": "https://repository.engineering.redhat.com/nexus/repository/registry.npmjs.org/@types/yauzl/-/yauzl-2.9.1.tgz", "integrity": "sha512-A1b8SU4D10uoPjwb0lnHmmu8wZhR9d+9o2PKBQT2jU5YPTKsxac6M2qGAdY7VcL+dHHhARVUDmeg0rOrcd9EjA==", "dev": true, "requires": { @@ -387,7 +387,7 @@ }, "ajv-keywords": { "version": "3.5.2", - "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz", + "resolved": "https://repository.engineering.redhat.com/nexus/repository/registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz", "integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==", "dev": true }, @@ -853,7 +853,7 @@ }, "buffer-crc32": { "version": "0.2.13", - "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", + "resolved": "https://repository.engineering.redhat.com/nexus/repository/registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", "integrity": "sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI=" }, "buffer-equal": { @@ -1167,15 +1167,14 @@ "dev": true }, "countries-and-timezones": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/countries-and-timezones/-/countries-and-timezones-2.3.1.tgz", - "integrity": "sha512-GYgwjwF2FBezIeJVOeHtQVavQY9E2CdG7LjQIrriuC8BPGxaQht0i+QAd1adgvXK7U28xJ1o2yCK6DLS1Avmsw==" + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/countries-and-timezones/-/countries-and-timezones-2.4.0.tgz", + "integrity": "sha512-h6k9zgw99k8fjon5cO94k8Aslyj0fM+S4hfTyJ6sbSjyOO9lu5/wcOXLrhc1cGUoHCrnx56WYSNEasSKqSGlJw==" }, "cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", - "dev": true, "requires": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", @@ -1186,7 +1185,6 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "dev": true, "requires": { "isexe": "^2.0.0" } @@ -1532,44 +1530,6 @@ "onetime": "^5.1.0", "signal-exit": "^3.0.2", "strip-final-newline": "^2.0.0" - }, - "dependencies": { - "cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", - "requires": { - "path-key": "^3.1.0", - "shebang-command": "^2.0.0", - "which": "^2.0.1" - } - }, - "path-key": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", - "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==" - }, - "shebang-command": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", - "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", - "requires": { - "shebang-regex": "^3.0.0" - } - }, - "shebang-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", - "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==" - }, - "which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "requires": { - "isexe": "^2.0.0" - } - } } }, "expand-brackets": { @@ -1744,13 +1704,13 @@ }, "fast-deep-equal": { "version": "3.1.3", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "resolved": "https://repository.engineering.redhat.com/nexus/repository/registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", "dev": true }, "fast-json-stable-stringify": { "version": "2.1.0", - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "resolved": "https://repository.engineering.redhat.com/nexus/repository/registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", "dev": true }, @@ -1768,7 +1728,7 @@ }, "fd-slicer": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", + "resolved": "https://repository.engineering.redhat.com/nexus/repository/registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", "integrity": "sha1-JcfInLH5B3+IkbvmHY85Dq4lbx4=", "requires": { "pend": "~1.2.0" @@ -1876,9 +1836,9 @@ } }, "follow-redirects": { - "version": "1.13.2", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.13.2.tgz", - "integrity": "sha512-6mPTgLxYm3r6Bkkg0vNM0HTjfGrOEtsfbhagQvbxDEsEkpNhw582upBaoRZylzen6krEmxXJgt9Ju6HiI4O7BA==" + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.1.tgz", + "integrity": "sha512-HWqDgT7ZEkqRzBvc2s64vSZ/hfOceEol3ac/7tKwzuvEyWx3/4UegXh5oBOIotkGsObyk3xznnSRVADBgWSQVg==" }, "for-in": { "version": "1.0.2", @@ -2999,7 +2959,7 @@ }, "mkdirp": { "version": "0.5.5", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", + "resolved": "https://repository.engineering.redhat.com/nexus/repository/registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", "dev": true, "requires": { @@ -3066,7 +3026,7 @@ }, "neo-async": { "version": "2.6.2", - "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", + "resolved": "https://repository.engineering.redhat.com/nexus/repository/registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", "dev": true }, @@ -3365,8 +3325,7 @@ "path-key": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", - "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", - "dev": true + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==" }, "path-parse": { "version": "1.0.6", @@ -3402,7 +3361,7 @@ }, "pend": { "version": "1.2.0", - "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", + "resolved": "https://repository.engineering.redhat.com/nexus/repository/registry.npmjs.org/pend/-/pend-1.2.0.tgz", "integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=" }, "picomatch": { @@ -3827,7 +3786,6 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", - "dev": true, "requires": { "shebang-regex": "^3.0.0" } @@ -3835,8 +3793,7 @@ "shebang-regex": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", - "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", - "dev": true + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==" }, "signal-exit": { "version": "3.0.3", @@ -3983,7 +3940,7 @@ }, "source-map-support": { "version": "0.5.19", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.19.tgz", + "resolved": "https://repository.engineering.redhat.com/nexus/repository/registry.npmjs.org/source-map-support/-/source-map-support-0.5.19.tgz", "integrity": "sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw==", "dev": true, "requires": { @@ -5007,7 +4964,7 @@ }, "yauzl": { "version": "2.10.0", - "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz", + "resolved": "https://repository.engineering.redhat.com/nexus/repository/registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz", "integrity": "sha1-x+sXyT4RLLEIb6bY5R+wZnt5pfk=", "requires": { "buffer-crc32": "~0.2.3", diff --git a/package.json b/package.json index 4ae48e0d..1dab38ff 100644 --- a/package.json +++ b/package.json @@ -55,9 +55,6 @@ "Formatters", "Snippets" ], - "extensionDependencies": [ - "redhat.vscode-commons" - ], "devDependencies": { "@types/fs-extra": "^8.0.0", "@types/node": "^10.14.16", @@ -77,7 +74,7 @@ "webpack-cli": "^4.6.0" }, "dependencies": { - "@redhat-developer/vscode-redhat-telemetry": "0.0.13", + "@redhat-developer/vscode-redhat-telemetry": "0.1.1", "expand-home-dir": "^0.0.3", "find-java-home": "1.1.0", "fs-extra": "^8.1.0", @@ -91,6 +88,12 @@ "type": "object", "title": "XML", "properties": { + "redhat.telemetry.enabled": { + "type": "boolean", + "default": null, + "markdownDescription": "Enable usage data and errors to be sent to Red Hat servers. Read our [privacy statement](https://developers.redhat.com/article/tool-data-collection).", + "scope": "window" + }, "xml.java.home": { "type": [ "string", diff --git a/src/extension.ts b/src/extension.ts index dd399b47..2e59b070 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -29,7 +29,7 @@ let languageClient: LanguageClient; export async function activate(context: ExtensionContext): Promise { - await Telemetry.startTelemetry(); + await Telemetry.startTelemetry(context); Telemetry.sendTelemetry(Telemetry.SETTINGS_EVT, { preferBinary: (getXMLConfiguration()['server']['preferBinary'] as boolean) }); diff --git a/src/telemetry.ts b/src/telemetry.ts index 618382d1..7b4fe420 100644 --- a/src/telemetry.ts +++ b/src/telemetry.ts @@ -1,4 +1,5 @@ -import { getTelemetryService, TelemetryService } from "@redhat-developer/vscode-redhat-telemetry/lib"; +import { TelemetryService, getRedHatService } from "@redhat-developer/vscode-redhat-telemetry"; +import { ExtensionContext } from "vscode"; /** * Wrap vscode-redhat-telemetry to suit vscode-xml @@ -23,11 +24,12 @@ export namespace Telemetry { * @returns when the telemetry service has been started * @throws Error if the telemetry service has already been started */ - export async function startTelemetry(): Promise { + export async function startTelemetry(context: ExtensionContext): Promise { if (!!_telemetryManager) { throw new Error("The telemetry service for vscode-xml has already been started") } - _telemetryManager = await getTelemetryService("redhat.vscode-xml"); + const redhatService =await getRedHatService(context); + _telemetryManager = await redhatService.getTelemetryService(); return _telemetryManager.sendStartupEvent(); }