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

Hashbang isn't added to cli on Windows #110

Open
1 of 2 tasks
Jrubzjeknf opened this issue Feb 11, 2025 · 1 comment
Open
1 of 2 tasks

Hashbang isn't added to cli on Windows #110

Jrubzjeknf opened this issue Feb 11, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@Jrubzjeknf
Copy link

Jrubzjeknf commented Feb 11, 2025

Problem

When using pkgroll on Windows, the node hashbang isn't added to a cli. The issue comes from this line here.

if (executablePaths.includes(outputPath)) {

I logged the variables here:

executable path output path
./dist/bin/cli.js ./dist/index.cjs
./dist/bin/cli.js ./dist/bin\cli.cjs
./dist/bin/cli.js ./dist/index.mjs
./dist/bin/cli.js ./dist/bin\cli.mjs
./dist/bin/cli.js ./dist/index.js
./dist/bin/cli.js ./dist/bin\cli.js

Notice that the second line should match, but doesn't because of the \. For now I've used the following workaround to develop locally, but this fails to compile on non-Windows platforms.

	"bin": {
		"cli": "./dist/bin/cli.js",
		"__cli": "./dist/bin\\cli.js"
	},

Expected behavior

Should add the hashbang to the cli on Windows.

Minimal reproduction URL

Version

2.8.2

Node.js version

v22.13.1

Package manager

npm

Operating system

Windows

Bugs are expected to be fixed by those affected by it

  • I'm interested in working on this issue

Compensating engineering work financially will speed up resolution

  • I'm willing to offer financial support
@Jrubzjeknf Jrubzjeknf added the bug Something isn't working label Feb 11, 2025
@privatenumber
Copy link
Owner

Interesting... it seems to be passing here:
https://github.com/privatenumber/pkgroll/blob/master/tests/specs/builds/bin.ts#L28

Feel free to work on a fix, and please make sure to cover this case in the tests.

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants