Skip to content

Conversation

@tylerbutler
Copy link
Member

@tylerbutler tylerbutler commented Dec 10, 2025

Summary

  • Adds additionalConfigFiles property to task file dependencies, allowing any task that extends LeafWithDoneFileTask to track additional configuration files for incremental build invalidation
  • Introduces ${repoRoot} token for portable file paths that resolve to the repository root regardless of package depth
  • Supports "..." spread syntax to extend global task definitions at the package level rather than replacing them
  • Simplifies EsLintTask by removing hardcoded shared config tracking in favor of the new declarative approach
  • Refactors TscDependentTask subclasses to use composable getTaskSpecificConfigFiles() pattern

These changes enable tracking shared configuration files (like root-level .eslintrc.cjs) that affect task behavior but weren't previously tracked, ensuring tasks rebuild when those configs change.

Copilot AI and others added 10 commits December 8, 2025 21:30
The feature to extend file dependencies in task definitions using "..." was already
implemented but not documented. This commit adds:
- Comprehensive unit tests to verify the feature works correctly
- Documentation in README.md explaining how to use file dependencies
- Comments in fluidBuild.config.cjs to make the feature more discoverable

Co-authored-by: tylerbutler <[email protected]>
Added a detailed example document showing:
- Real-world scenarios for using file dependency extension
- Examples of extending inputGlobs and outputGlobs
- Examples of completely overriding file dependencies
- Benefits and how the feature works
- Link from README to the example document

Co-authored-by: tylerbutler <[email protected]>
…racking

Implements the ability to specify additional configuration files to track for known
task handlers (eslint, tsc, api-extractor, etc.) without modifying task handler code.

Changes:
- Added `additionalConfigFiles` property to TaskFileDependencies interface
- Modified TscDependentTask to merge task-specific configs with additional configs
- Updated all TscDependentTask subclasses to use getTaskSpecificConfigFiles()
- Added getAdditionalConfigFiles() method to BuildPackage for tasks to access config
- Added comprehensive unit tests for the new feature
- Documented the feature in README with examples
- Created detailed example document showing real-world use cases

Co-authored-by: tylerbutler <[email protected]>
Added caching to prevent recomputing the config files list on every access.
The additional config files don't change during task execution, so we can
safely cache the result.

Co-authored-by: tylerbutler <[email protected]>
Implements support for the <repoRoot> token in:
- inputGlobs and outputGlobs for declarative tasks
- additionalConfigFiles for task handlers

Changes:
- Added REPO_ROOT_TOKEN constant and utility functions in fluidBuildConfig.ts
- Updated DeclarativeLeafTask to replace <repoRoot> in input/output globs
- Updated TscDependentTask to replace <repoRoot> in additionalConfigFiles
- Added comprehensive tests for token replacement
- Updated documentation to show <repoRoot> usage instead of relative paths
- Token works consistently across all packages regardless of directory depth

This solves the problem of having to specify different relative paths (../../, ../../../, etc.)
for packages at different depths in the repository structure.

Co-authored-by: tylerbutler <[email protected]>
Changes:
- Changed token format from <repoRoot> to ${repoRoot} to match standard variable syntax
- Removed "Using ${repoRoot} in Declarative Tasks" section from documentation
- Replied to questions about getter vs method and why feature is limited to TscDependentTask

The ${repoRoot} token format is more consistent with common patterns like ${workspaceFolder}
used in VS Code and other tools.

Co-authored-by: tylerbutler <[email protected]>
…e classes

Updated documentation to accurately reflect that while the feature is currently implemented
for TscDependentTask subclasses, the underlying file tracking infrastructure (LeafWithDoneFileTask
and LeafWithFileStatDoneFileTask) is available in most task types and could support this
feature in the future.

Co-authored-by: tylerbutler <[email protected]>
Removed dependsOn: ["..."] from examples in README and documentation as it doesn't
add clarity to the additionalConfigFiles feature examples.

Co-authored-by: tylerbutler <[email protected]>
Moved additionalConfigFiles support from TscDependentTask to LeafWithFileStatDoneFileTask,
making it available to ALL task types that track input/output files including:
- BiomeTask, PrettierTask, Ts2EsmTask, and other file-tracking tasks
- All TscDependentTask subclasses (eslint, tslint, api-extractor, etc.)

The feature now works by:
- Adding getAdditionalConfigFiles() method to LeafWithFileStatDoneFileTask
- Including additional config files in getDoneFileContent() for both stat and hash modes
- Supporting ${repoRoot} token replacement for all task types

Updated documentation to reflect broader support across the task hierarchy.

Co-authored-by: tylerbutler <[email protected]>
@tylerbutler tylerbutler changed the title feat(fluid-build): add additionalConfigFiles with <repoRoot> token feat(fluid-build): add additionalConfigFiles to built-in task defs Dec 11, 2025
Copilot AI and others added 3 commits December 11, 2025 20:24
Refactored to eliminate code duplication:
- Moved getAdditionalConfigFiles() from LeafWithFileStatDoneFileTask to LeafWithDoneFileTask
- Simplified TscDependentTask.configFileFullPaths to use the base class method
- Removed duplicate token replacement and path resolution logic
- Removed unused import of replaceRepoRootToken from tscTask.ts

This makes the code cleaner and ensures the logic is in a single place that both
LeafWithFileStatDoneFileTask and TscDependentTask can use.

Co-authored-by: tylerbutler <[email protected]>
@tylerbutler tylerbutler marked this pull request as ready for review December 15, 2025 21:59
Copilot AI review requested due to automatic review settings December 15, 2025 21:59
Copy link
Contributor

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 ability to specify additional configuration files for task handlers in fluid-build without modifying task handler code. It introduces a ${repoRoot} token for file paths to reference the repository root consistently across packages at any directory depth, and adds support for extending configuration using the "..." syntax.

Key Changes:

  • Added additionalConfigFiles property to task file dependencies with "..." expansion support
  • Implemented ${repoRoot} token replacement in file paths and globs
  • Refactored TscDependentTask to support additional config files through a new getTaskSpecificConfigFiles() method

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/test/taskDefinitions.test.ts New test file with comprehensive coverage for file dependency extension and additional config files
src/test/repoRootToken.test.ts New test file for ${repoRoot} token replacement functionality
src/fluidBuild/fluidBuildConfig.ts Adds token constants and replacement utility functions
src/fluidBuild/fluidTaskDefinitions.ts Extends schema with additionalConfigFiles and validation logic
src/fluidBuild/buildGraph.ts Adds getAdditionalConfigFiles() method to BuildPackage
src/fluidBuild/tasks/leaf/leafTask.ts Implements getAdditionalConfigFiles() in base class with token replacement
src/fluidBuild/tasks/leaf/tscTask.ts Refactors to use new getTaskSpecificConfigFiles() abstract method
src/fluidBuild/tasks/leaf/lintTasks.ts Updates EsLintTask to implement getTaskSpecificConfigFiles()
src/fluidBuild/tasks/leaf/declarativeTask.ts Adds token replacement for input/output globs
src/fluidBuild/tasks/leaf/apiExtractorTask.ts Updates to implement getTaskSpecificConfigFiles()
src/fluidBuild/tasks/leaf/generateEntrypointsTask.ts Updates to implement getTaskSpecificConfigFiles()
README.md Documents new feature with examples
docs/additional-config-files-example.md New comprehensive documentation with practical examples

@tylerbutler tylerbutler requested a review from a team December 15, 2025 22:28
- Extract REPO_ROOT_REGEX constant from inline regex pattern
- Add @example JSDoc tags to replaceRepoRootToken functions
- Add memoization cache to BuildPackage.getAdditionalConfigFiles
- Remove duplicate GitIgnoreSetting type (now only in fluidTaskDefinitions)
- Remove deprecated TsLintTask reference from documentation
- Add edge case tests for repoRoot token replacement
- Add validation tests for '...' in global task definitions
- Add tests for additionalConfigFiles resolution
- Add tests for ${repoRoot} token preservation in task definitions
- Add tests for combining package and global config files
@tylerbutler tylerbutler changed the title feat(fluid-build): add additionalConfigFiles to built-in task defs feat(build-tools): add additionalConfigFiles and ${repoRoot} token for task file tracking Jan 7, 2026
tylerbutler added a commit that referenced this pull request Jan 7, 2026
…#26147)

## Description

Enables fluid-build to properly support ESLint 9 flat config files for
incremental build tracking.

## Changes

### Config File Detection (`taskUtils.ts`)
Expands `getEsLintConfigFilePath` to detect ESLint 9 flat config files:
- `eslint.config.{mjs,mts,cjs,cts,js,ts}` (checked first)
- Legacy `.eslintrc.{js,cjs,json}` files (backwards compatibility)

### Config File Parsing (`fluidBuildTasks.ts`)
Replaces manual config file parsing with ESLint's
`calculateConfigForFile()` API to extract `parserOptions.project` for
build task dependencies. This properly supports:
- ESLint 9 flat configs (`languageOptions.parserOptions.project`)
- Legacy eslintrc configs (`parserOptions.project`)
- TypeScript config files (`.mts`, `.cts`, `.ts`)
- ESM config files (`.mjs`)

The previous manual parsing with `require()` and `JSON5.parse()`
couldn't handle ESLint 9's different config structure or TypeScript/ESM
configs.

## Motivation

Without these changes, packages using ESLint 9 flat configs cannot have
proper incremental build tracking - fluid-build couldn't detect the
config files or parse them to determine tsc task dependencies.

Related: #26017

---------

Co-authored-by: Joshua Smithrud <[email protected]>
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.

1 participant