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