Skip to content

Conversation

sheetalkamat
Copy link
Member

@sheetalkamat sheetalkamat commented Sep 8, 2025

Open to option name suggestions

Name of the flag?
Default value?

@sheetalkamat sheetalkamat marked this pull request as ready for review September 8, 2025 22:52
@Copilot Copilot AI review requested due to automatic review settings September 8, 2025 22:52
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements the --maxConcurrentProjects command-line option to limit the number of projects that can be built concurrently during tsc build mode. The feature includes validation for invalid values (negative numbers, zero, and non-numeric inputs) and prevents it from being used together with the --singleThreaded option.

Key Changes

  • Added --maxConcurrentProjects build option with integer validation
  • Implemented error handling for invalid values (negative, zero, or non-numeric)
  • Added conflict validation with existing --singleThreaded option
  • Created comprehensive test coverage for various validation scenarios

Reviewed Changes

Copilot reviewed 24 out of 26 changed files in this pull request and generated no comments.

Show a summary per file
File Description
testdata/baselines/reference/tsoptions/commandLineParsing/parseBuildOptions/reports error when --maxConcurrentProjects is negative.js Tests error reporting for negative values
testdata/baselines/reference/tsoptions/commandLineParsing/parseBuildOptions/reports error when --maxConcurrentProjects is invalid type.js Tests error reporting for non-numeric values
testdata/baselines/reference/tsoptions/commandLineParsing/parseBuildOptions/reports error when --maxConcurrentProjects is 0.js Tests error reporting for zero values
testdata/baselines/reference/tsoptions/commandLineParsing/parseBuildOptions/parse --maxConcurrentProjects.js Tests successful parsing of valid values
testdata/baselines/reference/tsoptions/commandLineParsing/parseBuildOptions/--singleThreaded and --maxConcurrentProjects together is invalid.js Tests conflict detection between incompatible options
testdata/baselines/reference/tsbuild/projectsBuilding/when-there-are-8-projects-in-a-solution.js Baseline test for 8-project solution without concurrency limit
testdata/baselines/reference/tsbuild/projectsBuilding/when-there-are-8-projects-in-a-solution-with-maxConcurrentProjects-3.js Tests 8-project solution with concurrency limit of 3
testdata/baselines/reference/tsbuild/projectsBuilding/when-there-are-5-projects-in-a-solution.js Baseline test for 5-project solution without concurrency limit
testdata/baselines/reference/tsbuild/projectsBuilding/when-there-are-5-projects-in-a-solution-with-maxConcurrentProjects-2.js Tests 5-project solution with concurrency limit of 2

@ghiscoding
Copy link

I'm not sure if that helps or not, but in Lerna/Lerna-Lite when running lerna run (or lerna exec) in a monorepo project, you could specify a custom --concurrency option in the CLI and its default value is:

import { cpus } from 'node:os';
const DEFAULT_CONCURRENCY = cpus().length;
const concurrency = Math.max(1, +concurrency || DEFAULT_CONCURRENCY);

@jakebailey
Copy link
Member

There's an equivalent in Go, but I think we need to come up with some larger plan on how to limit resource usage; this may not be the right way to do things given there's parallelism inside projects such that we might need to instead be limiting the number of concurrent checks, or some other gate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants