@@ -0,0 +1,36 @@
|
||||
import fs from 'node:fs/promises';
|
||||
import path from 'node:path';
|
||||
|
||||
const args = process.argv.slice(2);
|
||||
const discordRoot = args.includes('--discord-root')
|
||||
? args[args.indexOf('--discord-root') + 1]
|
||||
: path.join(process.cwd(), 'node_modules', 'discord.js');
|
||||
const out = args.includes('--out') ? args[args.indexOf('--out') + 1] : path.join(process.cwd(), 'patches');
|
||||
|
||||
if (!discordRoot || !out) {
|
||||
console.error('Usage: node scripts/generate-patches.mjs [--discord-root <path>] [--out <path>]');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const manifest = {
|
||||
generatedAt: new Date().toISOString(),
|
||||
discordRoot,
|
||||
patches: [
|
||||
{
|
||||
id: 'runtime-loader-hook',
|
||||
description: 'Placeholder patch for injected runtime websocket/fetch adapters.',
|
||||
target: 'packages/ws/src/ws/WebSocketShard.ts',
|
||||
strategy: 'future-overlay'
|
||||
},
|
||||
{
|
||||
id: 'rest-transport-bridge',
|
||||
description: 'Placeholder patch for undici/Bare transport bridge if needed.',
|
||||
target: 'packages/rest/src/index.ts',
|
||||
strategy: 'future-overlay'
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
await fs.mkdir(out, { recursive: true });
|
||||
await fs.writeFile(path.join(out, 'patch-manifest.json'), JSON.stringify(manifest, null, 2));
|
||||
console.log('Generated patch manifest at', path.join(out, 'patch-manifest.json'));
|
||||
Reference in New Issue
Block a user