turbo
29aeaf04 - fix(turbo-ignore): infer correct version of turbo for project (#8363)

Commit
1 year ago
fix(turbo-ignore): infer correct version of turbo for project (#8363) ### Description This PR allows for `turbo-ignore` to use the appropriate version of `turbo` for the project it is pointed at. The strategy is: - `--turbo-version` if users specifies an override for the detection - `turbo` entry in `package.json`'s `dependencies`/`devDependencies` - `turbo@^1` if `pipeline` is in root `turbo.json`, `turbo@^2` if `tasks` is present ### Testing Instructions Added unit tests for finding correct version of turbo based on `package.json` as well as `turbo.json` for getting the major version if necessary. Some manual testing: ``` [0 olszewski@Chriss-MacBook-Pro] /tmp/foo/apps/web $ node ~/code/vercel/turborepo/packages/turbo-ignore/dist/cli.js ≫ Using Turborepo to determine if this project is affected by the commit... ≫ Inferred "web" as workspace from "package.json" ≫ Inferred turbo version "2" from "package.json" ≫ Using "build" as the task from the arguments ≫ Analyzing results of `npx -y turbo@2 run "build" --filter="web...[HEAD^]" --dry=json` ≫ This commit affects "web" ✓ Proceeding with deployment [1 olszewski@Chriss-MacBook-Pro] /tmp/foo/apps/web $ node ~/code/vercel/turborepo/packages/turbo-ignore/dist/cli.js --turbo-version 2.0.2 ≫ Using Turborepo to determine if this project is affected by the commit... ≫ Inferred "web" as workspace from "package.json" ≫ Using turbo version "2.0.2" from arguments ≫ Using "build" as the task from the arguments ≫ Analyzing results of `npx -y turbo@2.0.2 run "build" --filter="web...[HEAD^]" --dry=json` ≫ This commit affects "web" ✓ Proceeding with deployment [1 olszewski@Chriss-MacBook-Pro] /tmp/foo/apps/web $ vim ../../package.json [0 olszewski@Chriss-MacBook-Pro] /tmp/foo/apps/web $ node ~/code/vercel/turborepo/packages/turbo-ignore/dist/cli.js ≫ Using Turborepo to determine if this project is affected by the commit... ≫ Inferred "web" as workspace from "package.json" ≫ Inferred turbo version ^2 based on "tasks" in "turbo.json" ≫ Using "build" as the task from the arguments ≫ Analyzing results of `npx -y turbo@^2 run "build" --filter="web...[HEAD^]" --dry=json` ≫ This commit affects "web" ✓ Proceeding with deployment [1 olszewski@Chriss-MacBook-Pro] /tmp/foo/apps/web $ vim ../../turbo.json [0 olszewski@Chriss-MacBook-Pro] /tmp/foo/apps/web $ node ~/code/vercel/turborepo/packages/turbo-ignore/dist/cli.js ≫ Using Turborepo to determine if this project is affected by the commit... ≫ Inferred "web" as workspace from "package.json" ≫ Inferred turbo version ^1 based on "pipeline" in "turbo.json" ≫ Using "build" as the task from the arguments ≫ Analyzing results of `npx -y turbo@^1 run "build" --filter="web...[HEAD^]" --dry=json` ≫ This commit affects "web" ✓ Proceeding with deployment ```
Parents
Loading