这是indexloc提供的服务,不要输入任何密码
Skip to content

Ability to provide global default options #498

@fubhy

Description

@fubhy

Describe the feature you'd like to request

I'd like to be able to specify global defaults for the cli.

Describe the solution you'd like

Options like --cache-dir are best configured globally instead of always setting them in each command that is run. In general, I think it would be good to read these configuration options (with increasing priority):

  1. From the package.json configuration
  2. From an environment variable
  3. From a cli option

Personally, I've adopted this pattern for literally every option in the cli tools that I maintain. There's always a weird edge case where in some environment you want to override one of the options conveniently via a environment variable (e.g. in CI) for instance.

Describe alternatives you've considered

The CLI options are currently very strictly parsed with positional arguments first and options second only. E.g. this is valid:

yarn turbo run build --cache-dir=.turbo

but this isn't:

yarn turbo run --cache-dir=.turbo build

This means that currently it's also not possible to e.g. specify a common base command like

"scripts": {
   ...
   "turbo:run": "turbo run --cache-dir=.turbo"
   ...
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions