Skip to content
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

Feature: Add support for Angular 16 #22096

Merged
merged 8 commits into from
Apr 28, 2023
Merged

Conversation

yannbf
Copy link
Member

@yannbf yannbf commented Apr 14, 2023

Closes #22305

What I did

Angular just released v16 RC.0, so we gotta prepare for it!

This PR does two things:

  1. expands the version range to allow for Angular 16
  2. adds an Angular sandbox

How to test

  1. Run a sandbox for the template, e.g. yarn task --task sandbox --start-from auto --template angular-cli/16-ts
  2. Open Storybook in your browser
  3. Try it out!

Findings

Angular 16 removed ngcc, so we have to account for it as well (we already have a framework option to disable it, so that helps!)

Checklist

  • Make sure your changes are tested (stories and/or unit, integration, or end-to-end tests)
  • Make sure to add/update documentation regarding your changes
  • If you are deprecating/removing a feature, make sure to update
    MIGRATION.MD

Maintainers

  • If this PR should be tested against many or all sandboxes,
    make sure to add the ci:merged or ci:daily GH label to it.
  • Make sure this PR contains one of the labels below.

["cleanup", "BREAKING CHANGE", "feature request", "bug", "documentation", "maintenance", "dependencies", "other"]

@yannbf yannbf added angular build Internal-facing build tooling & test updates labels Apr 14, 2023
@yannbf yannbf force-pushed the feat/angular-16-sandbox branch 3 times, most recently from 17c617e to 9549ab3 Compare April 14, 2023 21:54
@yannbf yannbf marked this pull request as ready for review April 17, 2023 15:53
@yannbf yannbf added maintenance User-facing maintenance tasks and removed build Internal-facing build tooling & test updates labels Apr 18, 2023
@valentinpalkovic valentinpalkovic force-pushed the feat/angular-16-sandbox branch 2 times, most recently from 4ca0b59 to f533abd Compare April 21, 2023 12:27
@socket-security
Copy link

socket-security bot commented Apr 21, 2023

New dependency changes detected. Learn more about Socket for GitHub ↗︎


👍 No new dependency issues detected in pull request

Bot Commands

To ignore an alert, reply with a comment starting with @SocketSecurity ignore followed by a space separated list of package-name@version specifiers. e.g. @SocketSecurity ignore foo@1.0.0 bar@* or ignore all packages with @SocketSecurity ignore-all

Pull request alert summary
Issue Status
Install scripts ✅ 0 issues
Native code ✅ 0 issues
Bin script confusion ✅ 0 issues
Bin script shell injection ✅ 0 issues
Shell access ✅ 0 issues
Uses eval ✅ 0 issues
Unresolved require ✅ 0 issues
Invalid package.json ✅ 0 issues
HTTP dependency ✅ 0 issues
Git dependency ✅ 0 issues
GitHub dependency ✅ 0 issues
New author ✅ 0 issues
Potential typo squat ✅ 0 issues
Known Malware ✅ 0 issues
Telemetry ✅ 0 issues
Protestware/Troll package ✅ 0 issues

📊 Modified Dependency Overview:

⬆️ Updated Package Version Diff Added Capability Access +/- Transitive Count Publisher
@angular/animations@16.0.0-rc.3 15.2.8...16.0.0-rc.3 None +1/-0 google-wombot

@leosvelperez
Copy link
Contributor

leosvelperez commented Apr 21, 2023

@yannbf awesome to see this being worked on!

FYI, Angular 16 also changes the bundles that it generates. The es2015 main field won't be present anymore, nor the ngcc-related ones. I don't think that breaks the Storybook code, but probably would make sense to clean it up for correctness based on the Angular version here https://github.com/storybookjs/storybook/blob/feat/angular-16-sandbox/code/frameworks/angular/src/server/framework-preset-angular-ivy.ts#L72-L75.

@yannbf
Copy link
Member Author

yannbf commented Apr 21, 2023

@yannbf awesome to see this being worked on!

FYI, Angular 16 also changes the bundles that it generates. The es2015 main field won't be present anymore, nor the ngcc-related ones. I don't think that breaks the Storybook code, but probably would make sense to clean it up for correctness based on the Angular version here feat/angular-16-sandbox/code/frameworks/angular/src/server/framework-preset-angular-ivy.ts#L72-L75.

Wow thanks for catching that! I updated the code. Would you be so kind to check whether we are missing anything more?

@leosvelperez
Copy link
Contributor

Wow thanks for catching that! I updated the code. Would you be so kind to check whether we are missing anything more?

Glad to help!

From a runtime point of view, I think you've covered what I've found in my testing so far. I can see the pipeline failing with some typing issues. From what I can see:

  • The issue reported in file src/builders/build-storybook/index.ts is because there a mismatch with the RxJS versions. The Angular CLI packages now use RxJS 7 and Storybook is using RxJS 6.
  • The issue reported in file src/client/angular-beta/utils/NgComponentAnalyzer.test.ts is because entryComponents was removed in Angular 16.
  • The issue reported in file src/client/angular-beta/utils/NgComponentAnalyzer.ts is because Inputs type changed and can now be an object with properties like required or alias.

@valentinpalkovic valentinpalkovic added the ci:daily Run the CI jobs that normally run in the daily job. label Apr 28, 2023
@valentinpalkovic valentinpalkovic changed the title Build: Add sandbox for angular 16 Feature: Add support for Angular 16 Apr 28, 2023
@valentinpalkovic valentinpalkovic added feature request and removed maintenance User-facing maintenance tasks labels Apr 28, 2023
@valentinpalkovic valentinpalkovic merged commit 6592f3a into next Apr 28, 2023
@valentinpalkovic valentinpalkovic deleted the feat/angular-16-sandbox branch April 28, 2023 12:56
@yannbf
Copy link
Member Author

yannbf commented May 1, 2023

@valentinpalkovic this was not released yet, could you add a patch label in case you feel this should be patched?

@valentinpalkovic
Copy link
Contributor

@yannbf nx should first test it under the alpha release. Afterwards we can do a hotfix release before angular gets released.

@nstuyvesant
Copy link

The links above got me a 404. Anyone have a working example of Angular 16 rc with Storybook 7.1 alpha? Looking primarily for the main.ts.

@valentinpalkovic
Copy link
Contributor

7.1.0-alpha.11 should work with Angular 16

@valentinpalkovic valentinpalkovic added patch:yes Bugfix & documentation PR that need to be picked to main branch maintenance User-facing maintenance tasks and removed feature request labels May 2, 2023
@shilman shilman added the patch:done Patch/release PRs already cherry-picked to main/release branch label May 3, 2023
shilman pushed a commit that referenced this pull request May 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
angular ci:daily Run the CI jobs that normally run in the daily job. maintenance User-facing maintenance tasks patch:done Patch/release PRs already cherry-picked to main/release branch patch:yes Bugfix & documentation PR that need to be picked to main branch
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

[Feature Request]: Support Angular 16
5 participants