Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bun shebang #35

Open
sj0n opened this issue Jan 31, 2024 · 2 comments
Open

Bun shebang #35

sj0n opened this issue Jan 31, 2024 · 2 comments

Comments

@sj0n
Copy link

sj0n commented Jan 31, 2024

  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 Transition from __dirname to import.meta.url could be better documented nodejs/node#28114 (comment).

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
Copy link
Contributor

tipiirai commented Feb 5, 2024

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
Copy link
Author

sj0n commented Feb 7, 2024

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants