Skip to content
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

fix: should not appear deprecated warning #20

Merged
merged 1 commit into from Aug 5, 2022
Merged

fix: should not appear deprecated warning #20

merged 1 commit into from Aug 5, 2022

Conversation

ycs77
Copy link
Contributor

@ycs77 ycs77 commented Aug 5, 2022

Description

I used the Patreon provider for SponsorKit, not adding any GitHub tokens (no SPONSORKIT_LOGIN and SPONSORKIT_GITHUB_LOGIN), but show the warning on build time:

[sponsorkit] env.SPONSORKIT_LOGIN is deprecated, use env.SPONSORKIT_GITHUB_LOGIN instead

Because the getDeprecatedEnv('SPONSORKIT_LOGIN', 'SPONSORKIT_GITHUB_LOGIN') using const value = process.env[name] to get the global variable, the global variable is a string or undefined, if the variable is not found is return the undefined. But it is not equal to null, so the deprecation warning appears when the variable is equal to undefined.

https://github.com/antfu/sponsorkit/blob/0c285ea3dd80fed581ab228b9d021ab83554908a/src/env.ts#L4-L9

So this PR resolved the issue.

@antfu antfu merged commit 2bf7691 into antfu-collective:main Aug 5, 2022
@ycs77 ycs77 deleted the fix-should-not-appear-deprecated-warning branch August 6, 2022 00:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants