build: add precompiled CLI distribution

This commit is contained in:
2026-08-29 19:00:14 +08:00
parent d074681928
commit 4d1dc76e31
77 changed files with 3461 additions and 0 deletions
+41
View File
@@ -0,0 +1,41 @@
import 'dotenv/config';
import { networkInterfaces } from 'node:os';
import qrcode from 'qrcode-terminal';
import { loadProjectConfig } from "./lib/config.js";
import { resolveDeck } from "./lib/content.js";
import { runSlidev } from "./lib/run-slidev.js";
import { resolveTheme } from "./lib/theme.js";
const input = process.argv.slice(2).find(argument => !argument.startsWith('-'));
const config = await loadProjectConfig();
const deck = await resolveDeck(input, process.cwd(), config.slidesDir);
const port = process.env.PORT || '3030';
const address = firstLanAddress();
const remoteToken = process.env.SLIDEV_REMOTE_TOKEN || 'easy-slides-local';
const remotePassword = encodeURIComponent(remoteToken);
const presenterUrl = `http://${address}:${port}/presenter/?password=${remotePassword}`;
const remoteUrl = `http://${address}:${port}/entry?password=${remotePassword}`;
console.log(`\n观众视图:http://${address}:${port}/`);
console.log(`演示者视图:${presenterUrl}`);
console.log(`手机遥控器:${remoteUrl}`);
qrcode.generate(presenterUrl, { small: true });
await runSlidev([
deck.entry,
'--theme',
resolveTheme(config.theme),
'--port',
port,
'--remote',
remoteToken,
'--bind',
'0.0.0.0',
]);
function firstLanAddress() {
for (const entries of Object.values(networkInterfaces())) {
for (const entry of entries ?? []) {
if (entry.family === 'IPv4' && !entry.internal)
return entry.address;
}
}
return 'localhost';
}
//# sourceMappingURL=present.js.map