added extra check to prevent multiple installation of the same typing, added version field to telemetry event (#12258)

* added extra check to prevent multiple installation of the same typing, added version field to telemetry event

* use ts.version
This commit is contained in:
Vladimir Matveev
2016-11-15 10:59:55 -08:00
committed by GitHub
parent 0a3afb5d7f
commit 6846ea3f88
6 changed files with 14 additions and 5 deletions
+3
View File
@@ -3,6 +3,9 @@
/* @internal */
namespace ts {
export const version = "2.0.9";
/**
* Ternary values are defined such that
* x & y is False if either x or y is False.
-2
View File
@@ -5,8 +5,6 @@
namespace ts {
/** The version of the TypeScript compiler release */
export const version = "2.0.9";
const emptyArray: any[] = [];
export function findConfigFile(searchPath: string, fileExists: (fileName: string) => boolean, configName = "tsconfig.json"): string {
+5
View File
@@ -1968,6 +1968,11 @@ namespace ts.server.protocol {
* true if install request succeeded, otherwise - false
*/
installSuccess: boolean;
/**
* version of typings installer
*/
typingsInstallerVersion: string;
}
export interface NavBarResponse extends Response {
+2 -1
View File
@@ -266,7 +266,8 @@ namespace ts.server {
telemetryEventName: "typingsInstalled",
payload: {
installedPackages: response.packagesToInstall.join(","),
installSuccess: response.installSuccess
installSuccess: response.installSuccess,
typingsInstallerVersion: response.typingsInstallerVersion
}
};
const eventName: protocol.TelemetryEventName = "telemetry";
+1
View File
@@ -63,6 +63,7 @@ declare namespace ts.server {
readonly packagesToInstall: ReadonlyArray<string>;
readonly kind: EventInstall;
readonly installSuccess: boolean;
readonly typingsInstallerVersion: string;
}
export interface InstallTypingHost extends JsTyping.TypingResolutionHost {
@@ -230,7 +230,7 @@ namespace ts.server.typingsInstaller {
}
const result: string[] = [];
for (const typing of typingsToInstall) {
if (this.missingTypingsSet[typing]) {
if (this.missingTypingsSet[typing] || this.packageNameToTypingLocation[typing]) {
continue;
}
const validationResult = validatePackageName(typing);
@@ -308,7 +308,8 @@ namespace ts.server.typingsInstaller {
this.sendResponse(<TypingsInstallEvent>{
kind: EventInstall,
packagesToInstall: scopedTypings,
installSuccess: ok
installSuccess: ok,
typingsInstallerVersion: ts.version // qualified explicitly to prevent occasional shadowing
});
}