31 lines
837 B
JavaScript
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.');
|