nuejs / create-nue

A recommended way to start a Nue project
https://nuejs.org
139 stars 30 forks source link

Bun shebang #35

Open sj0n opened 7 months ago

sj0n commented 7 months ago
  1. Is there specific reason why bun is used instead of node? Based on my testing with node shebang, I was able to run the cli both on node and bun (wsl).
  2. So I changed shebang to node and it works but there is an error during folder creation on windows. The code below produce the path \C:\User\user... Notice the initial backslash before the drive letter. To fix this, I reference the code from https://github.com/nodejs/node/issues/28114#issuecomment-894422124.

Original code:

const root = new URL('.', import.meta.url).pathname
const src = join(root, name)

Fix:

import { dirname } from 'path';
import { fileURLToPath } from 'url';

const __dirname = fileURLToPath(dirname(import.meta.url));
const src = join(__dirname, name)

I would submit a PR if I can change the shebang to node.

tipiirai commented 7 months ago

It's there because Bun is the recommended engine for Nue. It seems that Bun Windows support gets a big improvement this month, hopefully fixing this issue as well.

sj0n commented 7 months ago

I understand it is the recommended runtime but it still works even if you use node and run the cli with bun. Also about path handling, am I allowed to submit a PR?