Lines 7-39javascript
7const __dirname = dirname(fileURLToPath(import.meta.url))
8const cmd = process.argv[2]
10const distEntry = resolve(__dirname, '..', 'dist', 'cli', `${cmd || 'help'}.js`)
11if (!cmd || cmd === 'help' || cmd === '--help' || cmd === '-h') {
12 const banner = readVersionBanner()
13 process.stdout.write(banner)
14 process.exit(cmd ? 0 : 0)
17if (cmd === '--version' || cmd === '-v') {
18 const pkg = JSON.parse(readFileSync(resolve(__dirname, '..', 'package.json'), 'utf8'))
19 process.stdout.write(pkg.version + '\n')
23if (!existsSync(distEntry)) {
24 process.stderr.write(`\n unknown command: ${cmd}\n run 'murasaki help' for the list\n\n`)
28const mod = await import(pathToFileURL(distEntry).href)
29if (typeof mod.default !== 'function') {
MediumDynamic Require
Package source references dynamic require/import behavior.
bin/murasaki.mjsView on unpkg · L27 30 process.stderr.write(`\n internal: ${cmd}.js has no default export\n\n`)
33await mod.default(process.argv.slice(3))
35function readVersionBanner() {
36 const pkg = JSON.parse(readFileSync(resolve(__dirname, '..', 'package.json'), 'utf8'))
37 return `\n 🦋 murasaki v${pkg.version} desktop apps with Next.js DX\n\n Usage: murasaki <command> [options]\n\n Commands:\n dev Start the Vite dev server + native WebView\n build Vite production build\n bundle Native folder / .app for the current platform\n installer Distributable installer (.dmg / .msi / .AppImage / .zip)\n init Install Rust toolchain for native binding hackers\n icon Generate .icns / .ico / .png set from a PNG\n release Auto-update manifest helpers\n help Show this help
Long lines were clipped for display.