Skip to content

fix: add Node 18 deprecation notice #1506

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

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,31 @@ export const createClient = <
): SupabaseClient<Database, SchemaName, Schema> => {
return new SupabaseClient<Database, SchemaName, Schema>(supabaseUrl, supabaseKey, options)
}

// Check for Node.js <= 18 deprecation
function shouldShowDeprecationWarning(): boolean {
if (
typeof window !== 'undefined' ||
typeof process === 'undefined' ||
process.version === undefined ||
process.version === null
) {
return false
}

const versionMatch = process.version.match(/^v(\d+)\./)
if (!versionMatch) {
return false
}

const majorVersion = parseInt(versionMatch[1], 10)
return majorVersion <= 18
}

if (shouldShowDeprecationWarning()) {
console.warn(
`⚠️ Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. ` +
`Please upgrade to Node.js 20 or later. ` +
`For more information, visit: https://github.com/orgs/supabase/discussions/37217`
)
}
Loading