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

Respect "engines" in package.json #1359

@ObliviousHarmony

Description

@ObliviousHarmony

Describe the feature you'd like to request

There is precedent in using the "engines" property of package.json files to ensure that globally installed tools of the wrong version cannot be run on a package. Turborepo should support an engines.turbo version constraint that prevents the globally installed turbo command from running when it does not match.

Describe the solution you'd like

When running a turbo command globally it should read the root package.json file's engines property and check the version constraint of engines.turbo against it's own version. If it does not match it should provide an error and stop executing.

Describe alternatives you've considered

  1. When using pnpm, the best way to execute turbo commands is using pnpm exec. Using pnpm turbo is error-prone since pnpm will eat the --filter argument. This leads to pnpm turbo run build --filter={package} and pnpm turbo run build -- --filter={package} having very different results. Our solution is to globally install turbo, however, this can lead to version mismatches with the installed package.
  2. Another option could be for turbo global commands to execute the local turbo command when one is present. This would be convenient but might result in some ambiguous behavior as opposed to a nice clean error. Even at that though, it's probably still nice to respect engines.turbo to clearly define what is expected here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: ergonomicsIssues and features impacting the developer experience of using turbo

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions