fix(schematics): resolve valid project template before upgrading packages - #1799
fix(schematics): resolve valid project template before upgrading packages#1799ivanvpetrov wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The new resolver’s return type is inconsistent with its documented/implemented null behavior, and one upgrade path currently fails silently when no upgradeable template can be resolved (with missing focused test coverage for the resolver).
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR fixes upgrade-packages fallback behavior by introducing a shared resolver that selects only valid, non-hidden project templates for upgrade operations, preventing hidden/partial templates (e.g., ai-config) from being chosen and throwing Method not implemented.
Changes:
- Added
resolveUpgradeableProjecthelper to filter out hidden/non-upgradeable project templates and provide a safe fallback selection. - Reused the resolver in Angular schematics, CLI
upgrade-packages, and corePackageManagerupgrade paths. - Added explicit failure handling in the schematic/CLI flows when no upgradeable project template can be resolved.
File summaries
| File | Description |
|---|---|
| packages/ng-schematics/src/upgrade-packages/index.ts | Uses shared resolver and throws a SchematicsException when no valid template is available. |
| packages/core/util/ProjectTemplateResolver.ts | Introduces resolver to pick a non-hidden, upgrade-capable project template (or none). |
| packages/core/util/index.ts | Re-exports the new resolver from the util barrel. |
| packages/core/packages/PackageManager.ts | Switches upgrade path to use resolver and conditionally invokes the template upgrade hook. |
| packages/cli/lib/commands/upgrade.ts | Switches CLI upgrade flow to use resolver and emits an error when no valid template is resolved. |
Review details
- Files reviewed: 5/5 changed files
- Comments generated: 3
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
🟢 Approval recommended
The shared resolver correctly prevents hidden or unsupported templates from being selected and handles missing targets gracefully.
Review details
- Files reviewed: 6/6 changed files
- Comments generated: 0 new
- Review effort level: Balanced
Description
This fixes the upgrade-packages fallback logic for Angular projects.
Previously, when a configured project template was missing/invalid, the code fell back to the first project in the library without checking whether it was a valid upgrade target. That allowed hidden/partial templates such as ai-config to be picked, which led to runtime failures such as
Method not implementedRelated Issue
Closes #1797
What changed
Type of 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
npm run test)npm run build)npm run lint)Additional Context