chore: use latest appwrite sdk and add postinstall script to suppress version mismatch warning
This commit is contained in:
parent
908646637a
commit
efd085ee5f
@ -7,7 +7,8 @@
|
||||
"build": "next build",
|
||||
"start": "next start",
|
||||
"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"
|
||||
},
|
||||
"dependencies": {
|
||||
"@livekit/components-react": "^2.9.21",
|
||||
@ -25,7 +26,7 @@
|
||||
"@tiptap/starter-kit": "^3.21.0",
|
||||
"@types/dompurify": "^3.0.5",
|
||||
"@types/video.js": "^7.3.58",
|
||||
"appwrite": "^17.0.0",
|
||||
"appwrite": "^26.1.0",
|
||||
"axios": "^1.18.0",
|
||||
"cheerio": "^1.2.0",
|
||||
"clsx": "^2.1.1",
|
||||
@ -36,7 +37,7 @@
|
||||
"livekit-server-sdk": "^2.16.0",
|
||||
"lucide-react": "^0.577.0",
|
||||
"next": "^16.2.6",
|
||||
"node-appwrite": "^17.0.0",
|
||||
"node-appwrite": "^26.2.0",
|
||||
"react": "19.2.3",
|
||||
"react-dom": "19.2.3",
|
||||
"string-similarity": "^4.0.4",
|
||||
|
||||
43
patch_appwrite.js
Normal file
43
patch_appwrite.js
Normal file
@ -0,0 +1,43 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const filesToPatch = [
|
||||
'node_modules/node-appwrite/dist/client.mjs',
|
||||
'node_modules/node-appwrite/dist/client.js',
|
||||
'node_modules/appwrite/dist/cjs/sdk.js',
|
||||
'node_modules/appwrite/dist/esm/sdk.js'
|
||||
];
|
||||
|
||||
filesToPatch.forEach(file => {
|
||||
const filePath = path.join(__dirname, file);
|
||||
if (fs.existsSync(filePath)) {
|
||||
let content = fs.readFileSync(filePath, 'utf8');
|
||||
// We want to replace the console.warn that outputs the warning.
|
||||
// The exact code in client is: warnings.split(';').forEach((warning) => console.warn('Warning: ' + warning));
|
||||
const target = "warnings.split(';').forEach((warning) => console.warn('Warning: ' + warning));";
|
||||
const replacement = "warnings.split(';').forEach((warning) => { if (!warning.includes('built for Appwrite')) console.warn('Warning: ' + warning); });";
|
||||
|
||||
// Also try the compiled JS versions which might have different formatting
|
||||
const target2 = 'warnings.split(";").forEach((warning) => console.warn("Warning: " + warning));';
|
||||
const replacement2 = 'warnings.split(";").forEach((warning) => { if (!warning.includes("built for Appwrite")) console.warn("Warning: " + warning); });';
|
||||
|
||||
if (content.includes(target)) {
|
||||
content = content.replace(target, replacement);
|
||||
fs.writeFileSync(filePath, content, 'utf8');
|
||||
console.log(`Patched ${file}`);
|
||||
} else if (content.includes(target2)) {
|
||||
content = content.replace(target2, replacement2);
|
||||
fs.writeFileSync(filePath, content, 'utf8');
|
||||
console.log(`Patched ${file}`);
|
||||
} else {
|
||||
// For minified files or different formats, use regex
|
||||
const regex = /warnings\.split\(['"]\;['"]\)\.forEach\(\([^)]*\)\s*=>\s*console\.warn\(['"]Warning:\s*['"]\s*\+\s*warning\)\)/g;
|
||||
const match = content.match(regex);
|
||||
if (match) {
|
||||
content = content.replace(regex, "warnings.split(';').forEach((warning) => { if (!warning.includes('built for Appwrite')) console.warn('Warning: ' + warning); })");
|
||||
fs.writeFileSync(filePath, content, 'utf8');
|
||||
console.log(`Patched ${file} via regex`);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
Loading…
Reference in New Issue
Block a user