Brendonovich / prisma-client-rust

Type-safe database access for Rust
https://prisma.brendonovich.dev
Apache License 2.0
1.75k stars 106 forks source link

Publish to crates.io to support `cargo-run-bin` workflow #392

Closed dlight closed 10 months ago

dlight commented 10 months ago

Prisma-client-rust's CLI tool currently builds as a crate inside your workspace, so that different projects can use different versions of the tool. Because of that, it isn't published on crates.io and cargo install doesn't work for it.

However, this means that the CLI tool each project must be rebuilt separately (even if they share the same version), which also wastes space in the target/ directory of each project.

There's a new tool called cargo-run-bin that is able to share the same binary between multiple projects (if they have the same version), but otherwise let's you specify, in a certain section of Cargo.toml, the specific version of the CLI tool used for each project. This addresses prisma-client-rust's concerns, but avoid compiling the same tool over and over again and avoid wasting space.

For example, if you have five projects using prisma-client-rust's 0.6.9 and one project still on 0.5.3, cargo-run-bin would need to install just two versions of the CLI tool, shared between the six projects.

But if this is to be used, I think that prisma-client-rust should be published on crates.io. I think it's enough to write down in the readme that installing with bare cargo install is not recommended, and that either cargo-run-bin or continuing to have a crate in the project is preferred (both can be supported)

Brendonovich commented 10 months ago

As I've already stated in #307 and #76, I can't publish PCR to crates.io. If cargo-run-bin supports git dependencies then we can investigate it, but crates.io is not an option.

dlight commented 10 months ago

Yikes, I forgot I had already opened an identical issue, sorry 😅