Repository navigation
fix(@schematics/angular): set explicit type for the application root component - #34685
Open
nagahara-naoki wants to merge 1 commit into
Open
nagahara-naoki wants to merge 1 commit into
nagahara-naoki wants to merge 1 commit into
Conversation
…component Pass an empty type for the 2025 application root component so workspace component defaults cannot produce filenames that differ from the application templates. Keep the 2016 naming behavior and ordinary component defaults intact. Add an E2E regression test that builds both naming styles with a workspace type configured and verifies that separate component generation still uses that type. Closes angular#34684
There was a problem hiding this comment.
Code Review
This pull request updates the Angular application schematic to set componentOptions.type to an empty string when the file name style guide is not '2016'. It also introduces a new end-to-end test to verify application generation behavior across different style guides and ensure workspace defaults are respected. I have no feedback to provide.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Checklist
PR Type
What is the current behavior?
When the workspace sets
"@schematics/angular:component": { "type": "component" },ng generate application --file-name-style-guide=2025inherits that type for its root component. It generatesapp.component.css, while the application template generatesapp.tsreferencing./app.css. The first build fails with NG2008, and extraapp.component.*files are left in the application.Issue Number: Closes #34684
What is the new behavior?
Pass an explicit empty
typewhen generating the application root component with the 2025 naming style, so the component files match the application templates:app.ts,app.html, andapp.css.The 2016 branch continues to pass
type: 'component'. Ordinary component generation still uses the workspace default. This follows the approach used in #34450 and #34472.The new E2E test sets the workspace component type, generates and builds applications using both naming styles, checks their stylesheet references and the absence of the incorrectly named root component, and verifies that a separately generated component still uses the workspace type.
Does this PR introduce a breaking change?
Other information
Validated locally against
mainatd5035923f0e357b2526c98110125eee04b05192f:schematic-defaultsE2E test both pass.git diff --checkpass.Commands:
The full CLI repository test suite was not run.