-
Notifications
You must be signed in to change notification settings - Fork 13.4k
add 'installSuccess' flag to telemetry, cache misses if npm install fails #12163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -215,7 +215,7 @@ namespace ts.server.typingsInstaller { | |
| this.knownCachesSet[cacheLocation] = true; | ||
| } | ||
|
|
||
| private filterAndMapToScopedName(typingsToInstall: string[]) { | ||
| private filterTypings(typingsToInstall: string[]) { | ||
| if (typingsToInstall.length === 0) { | ||
| return typingsToInstall; | ||
| } | ||
|
|
@@ -227,7 +227,7 @@ namespace ts.server.typingsInstaller { | |
| const validationResult = validatePackageName(typing); | ||
| if (validationResult === PackageNameValidationResult.Ok) { | ||
| if (typing in this.typesRegistry) { | ||
| result.push(`@types/${typing}`); | ||
| result.push(typing); | ||
| } | ||
| else { | ||
| if (this.log.isEnabled()) { | ||
|
|
@@ -280,7 +280,8 @@ namespace ts.server.typingsInstaller { | |
| if (this.log.isEnabled()) { | ||
| this.log.writeLine(`Installing typings ${JSON.stringify(typingsToInstall)}`); | ||
| } | ||
| const scopedTypings = this.filterAndMapToScopedName(typingsToInstall); | ||
| const filteredTypings = this.filterTypings(typingsToInstall); | ||
| const scopedTypings = filteredTypings.map(x => `@types/${x}`); | ||
| if (scopedTypings.length === 0) { | ||
| if (this.log.isEnabled()) { | ||
| this.log.writeLine(`All typings are known to be missing or invalid - no need to go any further`); | ||
|
|
@@ -297,11 +298,18 @@ namespace ts.server.typingsInstaller { | |
| if (this.telemetryEnabled) { | ||
| this.sendResponse(<TypingsInstallEvent>{ | ||
| kind: EventInstall, | ||
| packagesToInstall: scopedTypings | ||
| packagesToInstall: scopedTypings, | ||
| installSuccess: ok | ||
| }); | ||
| } | ||
|
|
||
| if (!ok) { | ||
| if (this.log.isEnabled()) { | ||
| this.log.writeLine(`install request failed, marking packages as missing to prevent repeated requests: ${JSON.stringify(filteredTypings)}`); | ||
| } | ||
| for (const typing of filteredTypings) { | ||
| this.missingTypingsSet[typing] = true; | ||
| } | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's interesting that we mark all the packages as missing. I assume that the npm install command could fail because one package failed, but the rest installed correctly? Or does NPM install in an "all-or-nothing" fashion?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it is all or nothing |
||
| return; | ||
| } | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume we've confirmed that "npm install" returns a non-0 error code across platforms/versions if a package fails to install (and always returns 0 on success, not like "1" if it succeeded with extra info).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, that is correct