Skip to content

fix(upgrade-packages): update projects/* and workspaces pattern folders - #1905

Merged
kdinev merged 2 commits into
masterfrom
dkalinov/upgrade-packages-workspaces-1858
Nov 24, 2026
Merged

kdinev merged 2 commits into
masterfrom
dkalinov/upgrade-packages-workspaces-1858

Conversation

@dkalinovInfra

Copy link
Copy Markdown
Contributor

Description

For React and Web Components, ig upgrade-packages run in a repository root only updated the root package.json and src/. Folders under projects/*, and folders matched by glob patterns in workspaces, were never searched: updateWorkspace() expanded those patterns with fs.glob() and kept the results that are directories, but FsFileSystem.glob() uses nodir: true and returns files only.

Changes:

  • packages/core/update/Update.ts: the workspace pattern is no longer expanded to folders first. It stays in the search root and is matched together with the file patterns (projects/* + **/*.ts), so nested folders such as projects/charts/bar-chart/ are reached too.
  • packages/core/util/FileSystem.ts: FsFileSystem.glob() now honors the ignorePatterns argument that IFileSystem declares and that it used to drop. The workspace searches pass node_modules and dist, so reaching into projects/app does not rewrite files in projects/app/node_modules.

Two behavior changes beyond the issue:

  • The root src/ is now always searched for React and Web Components, also when workspaces is set. Before, such a root got licensed dependencies in package.json but kept the trial imports in src/.
  • Files matched by overlapping patterns (e.g. projects/* and projects/charts/*) are processed once.

Related Issue

Closes #1858

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Refactoring / code cleanup
  • Build / CI configuration change

Affected Packages

  • igniteui-cli (packages/cli)
  • @igniteui/cli-core (packages/core)
  • @igniteui/angular-templates (packages/igx-templates)
  • @igniteui/angular-schematics (packages/ng-schematics)
  • @igniteui/mcp-server (packages/igniteui-mcp)

Checklist

  • I have tested my changes locally (npm run test)
  • I have built the project successfully (npm run build)
  • I have run the linter (npm run lint)
  • I have added/updated tests as needed
  • My changes do not introduce new warnings or errors

Not the full scripts, so the first three boxes are left open. What was run locally (Node 24.18.0, Windows):

  • tsc build of the monorepo (without the MCP server build)
  • eslint on the three changed files: clean
  • npm run jasmine: 986 specs, 5 failures, all in "MCP runtime tool handlers" (docLoader.getBases is not a function). The MCP package is not touched by this PR and was not rebuilt locally; the failures were not investigated.

Additional Context

The existing specs mock glob to return directories, which the real file system never does, so they passed with the bug. The new Workspace folders on disk specs run updateWorkspace with the real FsFileSystem in a temp folder; against the previous sources all three fail.

Checked with the built CLI as well (ig upgrade-packages --skip-install in the root of a Web Components project):

file before after
package.json rewritten rewritten
src/main.ts rewritten (not with workspaces set) rewritten
projects/app/package.json not rewritten rewritten
projects/app/src/app.ts not rewritten rewritten
projects/charts/bar-chart/package.json not rewritten rewritten
projects/charts/bar-chart/src/index.ts not rewritten rewritten
projects/app/node_modules/dep/* not rewritten not rewritten

Same result without workspaces and with "workspaces": ["projects/*", "projects/charts/*"].

🤖 Generated with Claude Code

The file system glob returns files only, so expanding `projects/*` or a
`workspaces` pattern to folders never matched anything and only the root
`src` was updated for React and Web Components.

- match the workspace pattern together with the file patterns instead of
  expanding it to folders first
- always update the root `src`, also when `workspaces` is set
- honor `ignorePatterns` in `FsFileSystem.glob` and skip `node_modules`
  and `dist` inside workspaces
- add specs that run against real folders

Closes #1858

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings November 24, 2026 09:37
@coveralls

coveralls commented Nov 24, 2026 •

Copy link
Copy Markdown

Coverage Status

coverage: 95.662% (+0.005%) from 95.657% — dkalinov/upgrade-packages-workspaces-1858 into master

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Unresolved traversal and exclusion bugs can leave nested trial imports unchanged while manifests are upgraded and allow installed dependencies to be rewritten.

4 open issues
What changed in this PR

This PR addresses #1858 by making root-level ig upgrade-packages searches reach React and Web Components projects matched by workspace patterns.

Changes:

  • Searches workspace patterns directly and always includes root src/.
  • Adds filesystem exclusions for node_modules and dist, and deduplicates matched files.
  • Adds real-filesystem regression tests for nested projects and explicit workspaces.
File Description
spec/​unit/​update-spec.ts Updates mocks and adds on-disk workspace regression tests.
packages/​core/​util/​FileSystem.ts Implements the optional glob exclusion argument.
packages/​core/​update/​Update.ts Revises workspace searches, passes exclusions, and deduplicates files.

Review effort: Balanced

Comment thread packages/core/update/Update.ts Resolved
Comment thread packages/core/util/FileSystem.ts Resolved
Comment thread packages/core/update/Update.ts Resolved
Comment thread packages/core/update/Update.ts Resolved
- NgTreeFileSystem.glob: with ignorePatterns, return the files of every
  folder instead of the parent's files for leaf folders, and match the
  pattern relative to dirPath
- FsFileSystem.glob: anchor ignorePatterns above a wildcard in dirPath,
  so a `*` workspace does not reach the root node_modules or dist
- update html files inside workspaces, not only in the root
- skip package.json files without dependencies instead of throwing

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues block approval of the workspace-discovery fixes.

No open issues 🎉

4 resolved since last review

Review effort: Balanced

@kdinev
kdinev merged commit 38b78af into master Nov 24, 2026
5 checks passed
@kdinev
kdinev deleted the dkalinov/upgrade-packages-workspaces-1858 branch November 24, 2026 13:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

upgrade-packages: workspace patterns such as projects/* never match, because the file system glob is called with nodir

4 participants