Skip to content

More granular cargo features #601

@TimJentzsch

Description

@TimJentzsch

What problem does this solve or what need does it fill?

The main goal would be to make the CLI more lean for CI use-cases.
For example, when you want to use any web functionality, a lot of additional dependencies are added. But the majority of them is actually just needed for running web apps.

What solution would you like?

Similar to how we have the default feature to serve the needs of most users, I want a ci feature to serve the needs of most CI workflows.

Then, for CI we could do --no-default-features -F ci to more quickly install the CLI in that case.
We could also provide pre-built binaries for this configuration if the user wants to use binstall, the reduced binary size would still make it faster.

In general, I think we might want to guard every command behind it's own feature flag, so e.g.

[features]
# Commands
build = []
build-web = ["build"]
run = ["build"]
run-web = ["run"]
new = []
lint = []

# Tools
rustup = []

unstable = []

# Composite features
web = ["build-web", "run-web"]
ci = ["build", "build-web", "run", "lint", "rustup", "unstable"]
default = [
  # Everything
]

Then for CI builds, dependencies like axum wouldn't need to be compiled as they could be brought in by run-web.

What alternative(s) have you considered?

There's definitely more ways we could configure the features.
E.g. we might not need a separate feature for each command and just use the ci feature directly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-CLIRelated to the main CLI and not a more specific subcommandC-DependenciesA change related to dependenciesD-StraightforwardSimple bug fixes and API improvements, docs, test and examplesS-Ready-for-ImplementationThis issue is ready for an implementation PR. Go for it!

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions