-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add Angular CT Schematic #24374
Conversation
[skip ci]
[skip ci]
[skip ci]
[skip ci]
…ress-io#23696) Falls back to tsconfig.json if one is not passed in
Thanks for taking the time to open a PR!
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR looks great! I would love to see a cypress tests that validates all of this though here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The latest changes seem to be breaking CI, I tried to fix it but I'm actually not clear on what's supposed to be generated - my understanding is a cy.ts
file with cy.mount
, but this is not happening.
I tried to debug this, it looks like it points to ng-component/generators/index.ts
that has:
externalSchematic('@schematics/angular', 'component', {
...options,
skipTests: true,
}),
I have rebased and resolved the conflicts w/ develop.
Also tested, not working for me?
$ ng generate component baz
CREATE src/app/baz/baz.component.scss (0 bytes)
CREATE src/app/baz/baz.component.html (18 bytes)
CREATE src/app/baz/baz.component.spec.ts (578 bytes)
CREATE src/app/baz/baz.component.ts (264 bytes)
UPDATE src/app/app.module.ts (524 bytes)
No cy.ts
is generated.
schematicCollections: ['@cypress/schematic', ...angularJsonVal?.cli?.schematicCollections ?? []], | ||
} | ||
|
||
if (cli.schematicCollections.indexOf('@schematics/angular') === -1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
schematicCollections
is only for Angular-14 apps. Previously, the value was defaultCollection
but it isn't an array. Should we override the default value instead for Angular 13 apps?
Looks like we've got a real CI failure. |
@w0wka91 I think it makes sense to not change the |
@ZachJW34 Makes sense. So I would suggest we append the defaultCollection (if it it not null) to the schematicCollections array. What do you think? |
@w0wka91 I think we drop support for Angular 13 for this version. I don't think schematics should support multiple ranges. I tried implementing what I suggested and any schematics invoked via @jordanpowell88 is it cool to drop support for v13 for this schematic? We could support it but we'll have to manage our deps differently. |
@w0wka91 I chatted with @jordanpowell88 a bit and pushed up a commit that removes support for v13. The component schematic was not working with v13 due to misconfigured dependencies, and furthermore the component schematic adheres to the v14 of the angular component schematic (standalone) so it wouldn't work regardless of the deps issue. Hoping for a green build! |
@lmiller1990 Can you re-review? If it looks good and we merge, we should include a |
Sure thing, main question: it looks like Angular 13 still has a couple hundred k installs / week: https://www.npmjs.com/package/@angular/core?activeTab=versions. It is two majors behind now, though, and my understanding is Angular culture is to upgrade to the latest versions pretty quickly. Are we okay with breaking the schematic in a Cypress minor? I am not sure if we've got an official cadence around this. Or is there some way users on Angular 13 could still use this older version? |
Ideally I think the With the addition of the The best user experience is to have the cypress component schematic match 1:1 with the Angular schematic which we can only do by dropping support for older versions if the contract changes. We could support multiple versions but we would lose this experience, specifically when running |
Sounds good. Let's merge this up. A release went out just now, sow this will be in the next release. |
* develop: (27 commits) refactor: remove unused cloud routes (#25584) chore: fix issue template formatting issue (#25587) fix: fixed issue with CT + electron + run mode not exiting properly (#25585) chore(deps): update dependency ua-parser-js to v0.7.33 [security] (#25561) fix: add alternative binary names for edge-beta (#25456) chore: add batch execution to CloudDataSource (#22457) chore: End a/b campaigns for aci smart banners (#25504) chore: release @cypress/schematic-v2.5.0 fix(cypress-schematic): do not disable e2e support file (#25400) chore: adding memory issue template (#25559) feat: Add Angular CT Schematic (#24374) chore: enforce changelog entries on PR reviews (#25459) chore: bump package.json to 12.4.0 [run ci] (#25556) feat: Add 'type' option to `.as` to store aliases by value (#25251) chore: release @cypress/webpack-dev-server-v3.2.3 feat: Display line break in cy.log (#25467) chore: update types (#25538) fix: Revert "fix: adding emergency garbage collection for chromium-based browsers" (#25546) fix: percy - wait to take snapshot until previous tooltips are gone (#25522) feat: support data-qa selector in selector playground (#25475) ...
User facing changelog
Additional details
Why was this change necessary? What is affected by this change?
This change enables the user to generate a new component including a component spec file. By implementing this we increase users adoption of Angular CT and improve over DX by doing all the boilerplate work for developers.
This change also adds @cypress/schematic to the default schematics. This enables the user to use all of the commands without prefixing them with the package name.
Steps to test
Generate a new Angular Application and add @cypress/schematic with
ng add <path/to/cypress/schematic>
How has the user experience changed?
Before the user had to execute the following commands to generate a component and a component spec file:
Now the user can just execute this command:
ng generate component button
Also, the user can now use any @cypress/schematic generate command without prefixing it with the package name:
So this
ng generate @cypress/schematic:spec {name}
becomes this:
ng generate spec {name}
PR Tasks
cypress-documentation
?type definitions
?