2.5 KiB
2.5 KiB
bare-discord-js
Run official discord.js 14.27 inside Bare with one dependency and one import.
Status
- Targets official
discord.js@^14.27.0on Bare>=1.29.4. - Bootstrap remaps Node builtins through
[email protected](bare-fetch,bare-ws,bare-sqlite, …). - REST uses the
@discordjs/restweb/fetch build; gateway useswsover Bare TLS.
Usage
CommonJS
const { Client, GatewayIntentBits, Events } = require('bare-discord-js');
const client = new Client({ intents: [GatewayIntentBits.Guilds] });
client.once(Events.ClientReady, (readyClient) => {
console.log(`Logged in as ${readyClient.user.tag}`);
});
ESM
import { Client, GatewayIntentBits, Events } from 'bare-discord-js';
const client = new Client({ intents: [GatewayIntentBits.Guilds] });
client.once(Events.ClientReady, (readyClient) => {
console.log(`Logged in as ${readyClient.user.tag}`);
});
Use Events.ClientReady (clientReady). discord.js 14.27 still emits ready with a deprecation warning; Events.Ready is aliased to clientReady so it stays current.
Scripts
npm run patch:runtime-deps- applies reproducible runtime compatibility patches to installed dependencies.npm run sync:imports-map- copiesbare-node-runtime/importsinto the shipped Node→Bare map.npm run analyze- generates runtime/dependency inventories.npm run verify-bootstrap-load- validates CJS/ESM bootstrap loading.npm run generate-patches- writes patch manifest placeholders.npm run apply-patches- validates patch manifest integrity.npm run test:parity- verifies baseline API parity surface.npm run test:bare- loads the library under thebareruntime.npm run release:verify- checks required release artifacts.
Example Bot
bare examples/basic-bot.cjs- runs a minimal gateway login bot using.env(DISCORD_TOKEN=...).
Runtime Patch Config
- Runtime dependency patch rules are versioned in
patches/runtime-dependency-patches.json. scripts/patch-runtime-deps.mjsapplies those rules after install (postinstall) and in CI.
Project Layout
src/bootstrap- runtime import-map/global bootstrap.src/adapters- compatibility adapters for runtime deltas.scripts- analysis, patching, sync, release automation.test- parity and smoke harness.patches- patch metadata and fallback import mappings.
Roadmap
- Add real gateway/REST/voice conformance integration runs under Bare.
- Automate upstream v14 sync with patch rebase + report generation.