-
-
Notifications
You must be signed in to change notification settings - Fork 197
feat: drop support for macOS Sierra and below #3982
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
declare const enum SystemWarningsSeverity { | ||
medium = "medium", | ||
high = "high" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,15 +35,17 @@ export class SysInfo implements ISysInfo { | |
} | ||
|
||
@exported("sysInfo") | ||
public async getSystemWarnings(): Promise<string[]> { | ||
const warnings: string[] = []; | ||
public async getSystemWarnings(): Promise<ISystemWarning[]> { | ||
const warnings: ISystemWarning[] = []; | ||
const macOSWarningMessage = await this.getMacOSWarningMessage(); | ||
if (macOSWarningMessage) { | ||
macOSWarningMessage.toString = function() { return this.message; }; | ||
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.
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. This will not work - the current class does not have |
||
warnings.push(macOSWarningMessage); | ||
} | ||
|
||
const nodeWarning = getNodeWarning(); | ||
if (nodeWarning) { | ||
nodeWarning.toString = function() { return this.message; }; | ||
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.
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. This will not work - the current class does not have |
||
warnings.push(nodeWarning); | ||
} | ||
|
||
|
@@ -57,10 +59,13 @@ export class SysInfo implements ISysInfo { | |
return jsonContent && jsonContent.engines && jsonContent.engines.node; | ||
} | ||
|
||
public async getMacOSWarningMessage(): Promise<string> { | ||
public async getMacOSWarningMessage(): Promise<ISystemWarning> { | ||
const macOSVersion = await this.$hostInfo.getMacOSVersion(); | ||
if (macOSVersion && macOSVersion < MacOSVersions.HighSierra) { | ||
return format(MacOSDeprecationStringFormat, macOSVersion); | ||
return { | ||
message: format(MacOSDeprecationStringFormat, macOSVersion), | ||
severity: SystemWarningsSeverity.high | ||
}; | ||
} | ||
|
||
return null; | ||
|
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.
Why we need
.toString
method? Can we just usewarning.message
?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.
Forgot to mention this in the PR description - the
toString
is required for a minimal backwards compatibility. With the old code, you were able to use the result ofgetSystemWarnings()
and join it with EOL for example and print it. In case we do not have thetoString
implementation here, the join operation will use the default toString, which returns[Object object]
.