a11ywatch / rust-to-npm

Rust to npm
https://crates.io/crates/rust-to-npm
MIT License
32 stars 4 forks source link

Cargo Doesn't Use Custom Package Name? #11

Open JimLynchCodes opened 1 year ago

JimLynchCodes commented 1 year ago

Hi again! 😃

I have a new exploration spike project now in which I am testing out the -n flag.

I deployed with this command:

rust-to-npm-cli deploy -b -n other-name-jims-rust-to-npm-cli-test

npm seems to work great. I install with:

npm i -g other-name-jims-rust-to-npm-cli-test

and then use it like this:

jims-new-rust-cli-test

For Cargo I would expect to be able to do this:

cargo install other-name-jims-rust-to-npm-cli-test

But instead, Cargo doesn't respect the -n flag. Instead, it wants me install with this:

cargo install jims-new-rust-cli-test

So, I am wondering... is it by design that the cargo package doesn't use the custom name? It is like an anti-pattern for me to want to do this in the first place? Or is it some limitation of cargo that you cannot publish with these two things having different names?

Just curious why it is like this because it seems unintuitive to me.

Thanks!

j-mendez commented 1 year ago

@JimLynchCodes hi, by design we currently do not modify the cargo file. One option is we can pass in a temp file for the deployment or look into adding a flag to overwrite or modify in place.

JimLynchCodes commented 1 year ago

I don't like the idea of having the build actually modify the file. I'd prefer if it deployed a temp file. thanks