fix: change postinstall to prebuild for patch_appwrite.js and add monkey patches to appwrite clients
This commit is contained in:
parent
efd085ee5f
commit
ade675e0d8
@ -8,7 +8,7 @@
|
|||||||
"start": "next start",
|
"start": "next start",
|
||||||
"lint": "eslint",
|
"lint": "eslint",
|
||||||
"check-config": "node --env-file=.env.local check_config.js",
|
"check-config": "node --env-file=.env.local check_config.js",
|
||||||
"postinstall": "node patch_appwrite.js"
|
"prebuild": "node patch_appwrite.js"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@livekit/components-react": "^2.9.21",
|
"@livekit/components-react": "^2.9.21",
|
||||||
|
|||||||
@ -1,6 +1,18 @@
|
|||||||
import { Client, Account, Databases } from 'node-appwrite';
|
import { Client, Account, Databases } from 'node-appwrite';
|
||||||
import { cookies } from 'next/headers';
|
import { cookies } from 'next/headers';
|
||||||
|
|
||||||
|
// Patch console.warn to suppress Appwrite version mismatch warning
|
||||||
|
if (typeof console !== 'undefined' && !(console as any)._appwritePatchedServer) {
|
||||||
|
const originalWarn = console.warn;
|
||||||
|
console.warn = (...args) => {
|
||||||
|
if (args[0] && typeof args[0] === 'string' && args[0].includes('The current SDK is built for Appwrite')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
originalWarn(...args);
|
||||||
|
};
|
||||||
|
(console as any)._appwritePatchedServer = true;
|
||||||
|
}
|
||||||
|
|
||||||
const ENDPOINT = process.env.NEXT_PUBLIC_APPWRITE_ENDPOINT || 'https://appwrite.almeira.com.co/v1';
|
const ENDPOINT = process.env.NEXT_PUBLIC_APPWRITE_ENDPOINT || 'https://appwrite.almeira.com.co/v1';
|
||||||
const PROJECT_ID = process.env.NEXT_PUBLIC_APPWRITE_PROJECT_ID || '69b84df5003bd8957c5c';
|
const PROJECT_ID = process.env.NEXT_PUBLIC_APPWRITE_PROJECT_ID || '69b84df5003bd8957c5c';
|
||||||
const COOKIE_NAME = `a_session_${PROJECT_ID.toLowerCase()}`;
|
const COOKIE_NAME = `a_session_${PROJECT_ID.toLowerCase()}`;
|
||||||
|
|||||||
@ -1,5 +1,17 @@
|
|||||||
import { Client, Databases, Storage, Query, Account } from 'appwrite';
|
import { Client, Databases, Storage, Query, Account } from 'appwrite';
|
||||||
|
|
||||||
|
// Patch console.warn to suppress Appwrite version mismatch warning
|
||||||
|
if (typeof console !== 'undefined' && !(console as any)._appwritePatchedClient) {
|
||||||
|
const originalWarn = console.warn;
|
||||||
|
console.warn = (...args) => {
|
||||||
|
if (args[0] && typeof args[0] === 'string' && args[0].includes('The current SDK is built for Appwrite')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
originalWarn(...args);
|
||||||
|
};
|
||||||
|
(console as any)._appwritePatchedClient = true;
|
||||||
|
}
|
||||||
|
|
||||||
const client = new Client();
|
const client = new Client();
|
||||||
|
|
||||||
export const endpoint = process.env.NEXT_PUBLIC_APPWRITE_ENDPOINT || 'https://appwrite.almeira.com.co/v1';
|
export const endpoint = process.env.NEXT_PUBLIC_APPWRITE_ENDPOINT || 'https://appwrite.almeira.com.co/v1';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user