feat(workspace): trackAllFiles flag to track package.json and other bit-generated files - #10702
Conversation
…t-generated files bit drops package.json, a root-level tsconfig.json and lint configs, and the npm/yarn lockfiles from every component because it generates them. a workspace adopted from an existing monorepo owns those files, and without them a workspace restored from the scope can be neither installed nor built. with "trackAllFiles": true in teambit.workspace/workspace, only the git-ignored files and the hard exclusions (node_modules, .env, ...) are left out.
PR Summary by QodoAdd trackAllFiles support for monorepo-owned generated files
AI Description
Diagram
High-Level Assessment
Files changed (12)
|
d2b6186
into
feat/workspace-root-component-nesting
Code Review by Qodo
1. Explicitly ignored lockfiles get tracked
|
| const ignoreList = trackAllFiles | ||
| ? fromIgnoreFiles.filter((pattern) => !LOCKFILES_IGNORE_LIST.includes(pattern)) |
There was a problem hiding this comment.
1. Explicitly ignored lockfiles get tracked 🐞 Bug ≡ Correctness
getIgnoreListHarmony() filters lockfile patterns from the combined user and built-in ignore list without preserving their source. When .gitignore or .bitignore contains **/package-lock.json or **/yarn.lock, enabling trackAllFiles removes that user rule and includes the lockfile during add and subsequent rescans.
Agent Prompt
## Issue description
`retrieveIgnoreList()` combines user patterns with Bit's built-in patterns, after which `trackAllFiles` removes every occurrence matching `LOCKFILES_IGNORE_LIST`. This also removes an identical pattern explicitly supplied through `.gitignore` or `.bitignore`.
## Fix Focus Areas
- components/legacy/bit-map/component-map.ts[500-504]
- scopes/git/modules/ignore-file-reader/ignore.ts[28-32]
## Recommended Fix
Keep user ignore-file patterns separate from Bit's built-in ignore list, and remove lockfile patterns only from the built-in portion when `trackAllFiles` is enabled. Combine the unchanged user patterns with the filtered built-in patterns before appending `additionalPatterns`.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
Stacked on #10698.
Bit drops
package.json, a root-leveltsconfig.jsonand lint configs, and the npm/yarn lockfiles from every component because it generates them. A workspace adopted from an existing monorepo owns those files, and without them a workspace restored from its scope can be neither installed nor built."trackAllFiles": trueunderteambit.workspace/workspacekeeps them: only the git-ignored files and the hard exclusions (node_modules,.env,.DS_Store, and the root component's.bit/.git) are left out. The flag rides the same path asignoredFilesdown to the bit-map layer, so bothbit addand the per-load rescan honor it.Import writes whatever files the model holds, so a component with a tracked
package.jsonimported into a workspace without the flag shows as modified until the flag is set there too.Covered by a unit test for the ignore logic and one e2e for adopt → export → restore onto an empty workspace.