Files
BridgeSwarm/native-host/vendor/bare-discord-js/scripts/verify-bootstrap-load.mjs
T
snxraven 693814f46b
CI / Build & Test (push) Failing after 52s
Add Discordjs
2026-09-04 22:10:35 -04:00

31 lines
837 B
JavaScript

import { createRequire } from 'node:module';
import path from 'node:path';
const require = createRequire(import.meta.url);
const projectRoot = path.join(process.cwd());
function fail(message) {
console.error(message);
process.exit(1);
}
try {
const cjsEntry = require(path.join(projectRoot, 'src', 'index.js'));
if (!cjsEntry || typeof cjsEntry.Client !== 'function') {
fail('CJS entry does not expose discord.js Client.');
}
} catch (error) {
fail(`CJS bootstrap failed: ${error.message}`);
}
try {
const esmEntry = await import(path.join(projectRoot, 'src', 'index.mjs'));
if (!esmEntry || typeof esmEntry.Client !== 'function') {
fail('ESM entry does not expose discord.js Client.');
}
} catch (error) {
fail(`ESM bootstrap failed: ${error.message}`);
}
console.log('Bootstrap verification passed.');