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

fix(angular): handle projects with no targets in angular migration #15940

Merged
merged 1 commit into from
Mar 29, 2023

Conversation

FrozenPandaz
Copy link
Collaborator

@FrozenPandaz FrozenPandaz commented Mar 28, 2023

Current Behavior

Angular file-server migration errors when there is a project with no targets.

Expected Behavior

Angular file-server migration skips over projects with no targets and does not error.

Related Issue(s)

Fixes #

@vercel
Copy link

vercel bot commented Mar 28, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated
nx-dev ⬜️ Ignored (Inspect) Mar 29, 2023 at 3:14PM (UTC)

forEachExecutorOptions(
tree,
'@nrwl/angular:file-server',
(currentValue, project, target, configuration) => {
Copy link
Member

Choose a reason for hiding this comment

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

We are not updating options and configurations. Using forEachExecutorOptions would needlessly execute the callback for every configuration and once for the options, but we only need it once per target.

We could have a different utility like forEachTargetWithExecutor for these use cases, but while we don't have it, it's better here to just change the existing code like:

- for (const [targetName, target] of Object.entries(project.targets)) {
+ for (const [targetName, target] of Object.entries(project.targets ?? {})) {

Copy link
Contributor

Choose a reason for hiding this comment

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

I concur. I had originally wrote this with forEachExecutorOptions, but as Leo has mentioned, it runs needlessly.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sure, we can do that.

@@ -64,4 +64,22 @@ describe('updateFileServerExecutor', () => {
'@nrwl/web:file-server'
);
});

it('it should change the executor correctly in nx.json', async () => {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
it('it should change the executor correctly in nx.json', async () => {
it('it should handle projects with no targets', async () => {

@FrozenPandaz FrozenPandaz enabled auto-merge (squash) March 29, 2023 15:30
@FrozenPandaz FrozenPandaz merged commit afdf5ea into nrwl:master Mar 29, 2023
3 checks passed
@github-actions
Copy link

github-actions bot commented Apr 4, 2023

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants