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

chore(deps): update d3* and @types/d3*, and override d3-sankey and @types/d3-sankey #4880

Draft
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

Yokozuna59
Copy link
Member

@Yokozuna59 Yokozuna59 commented Sep 27, 2023

📑 Summary

  • update d3 version to 7.8.5 exclude the 7.4.0 version.
  • override d3-sankey and @types/d3-sankey dependencies versions.
  • move @types/d3-scale and @types/d3-scale-chromatic to devDependencies.
  • update all d3 related dependencies.

Resolves #4872

📏 Design Decisions

We were waiting for d3/d3-sankey#117 to be merged to resolve the d3-sankey issues, but it appears it won't be anytime soon. So we're taking the suggested workaround here for now to exclude older versions.

As far as I can tell, taking such an approach shouldn't affect the layout or types of d3-sankey, and renovate should also be able to update overriden versions in package.json.

📋 Tasks

Make sure you

@netlify
Copy link

netlify bot commented Sep 27, 2023

Deploy Preview for mermaid-js ready!

Name Link
🔨 Latest commit b63fdd9
🔍 Latest deploy log https://app.netlify.com/sites/mermaid-js/deploys/65c4a979e729c80007e9d3a5
😎 Deploy Preview https://deploy-preview-4880--mermaid-js.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@Yokozuna59
Copy link
Member Author

I don't know how to see the size difference after the commit, but according to this comment, it should be less by ~50Kb.

@codecov
Copy link

codecov bot commented Sep 27, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.09%. Comparing base (9c6ad54) to head (b63fdd9).
Report is 2189 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #4880      +/-   ##
===========================================
+ Coverage    79.51%   85.09%   +5.57%     
===========================================
  Files          175      174       -1     
  Lines        14396    11666    -2730     
  Branches       855      844      -11     
===========================================
- Hits         11447     9927    -1520     
+ Misses        2755     1543    -1212     
- Partials       194      196       +2     
Flag Coverage Δ
e2e 85.09% <ø> (ø)
unit ?

Flags with carried forward coverage won't be shown. Click here to find out more.

see 23 files with indirect coverage changes

* update `d3` version to `7.8.5` exclude the `7.4.0` version
* override `d3-sankey` and `@types/d3-sankey` dependencies versions
* move `@types/d3-scale` and `@types/d3-scale-chromatic` to devDependencies
* update all `d3` related dependencies
Copy link
Member

@aloisklink aloisklink left a comment

Choose a reason for hiding this comment

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

Hi @Yokozuna59,

Two questions:

  • Why have we made this change: * update `d3` version to `7.8.5` exclude the `7.4.0` version. Is it just to keep things updated? We might want to make a separate PR for this, just so there's a separate entry in the release notes for it.
  • Unit tests are failing due to:
    packages/mermaid/src/mermaid.spec.ts > when using mermaid and  > when using #registerExternalDiagrams > should throw error (but still render) if registerExternalDiagrams fails
AssertionError: expected [Function] to throw error including 'Failed to load 1 external diagrams' but got 'Failed to load 2 external diagrams'

- Expected
+ Received

- Failed to load 1 external diagrams
+ Failed to load 2 external diagrams

 ❯ packages/mermaid/src/mermaid.spec.ts:72:7
     70|       node.appendChild(document.createTextNode('graph TD;\na;'));
     71| 
     72|       await expect(
       |       ^
     73|         mermaid.registerExternalDiagrams(
     74|           [

The sankey e2e tests seem to be fine, though, so I'm not sure if that's the issue.

By the way, this is super minor and it's probably too much effort to do this in this PR, but in the future, making a separate commit for each change would be more ideal, e.g. something like:

  • chore(deps): update `d3` version to `^7.8.5`
  • chore(deps): override `d3-sankey` and `@types/d3-sankey` version
  • chore(deps): move `@types/d3-scale` and `@types/d3-scale-chromatic` to devDependencies
  • chore(deps): update all `d3` related dependencies

@aloisklink aloisklink added the dependencies Pull requests that update a dependency file label Sep 27, 2023
@Yokozuna59
Copy link
Member Author

Hi @aloisklink,

  • Why have we made this change: * update `d3` version to `7.8.5` exclude the `7.4.0` version. Is it just to keep things updated? We might want to make a separate PR for this, just so there's a separate entry in the release notes for it.

I'd say it's not, in package.json of the previous commit, it uses [email protected], but in the pnpm-lock.yaml it uses kinda uses both [email protected] and [email protected]:

mermaid/pnpm-lock.yaml

Lines 212 to 214 in 2049915

d3:
specifier: ^7.4.0
version: 7.8.2

So I updated both versions in packages/mermaid/package.json and packages/mermaid-example-diagram/package.json to resolve the issue.

  • Unit tests are failing due to:

The sankey e2e tests seem to be fine, though, so I'm not sure if that's the issue.

Same here. I wasn't sure what's the issue so I created a PR until I figure it out.

By the way, this is super minor and it's probably too much effort to do this in this PR, but in the future, making a separate commit for each change would be more ideal, e.g. something like:

I planed to do so, but then I thought that it would has unnecessary commits. And the pnpm-lock.yaml is already updated and it would need more effort to partially git add lines for each commit.

@Yokozuna59 Yokozuna59 changed the title chore(dev-deps): update d3* and @types/d3*, and override d3-sankey and @types/d3-sankey chore(deps): update d3* and @types/d3*, and override d3-sankey and @types/d3-sankey Sep 29, 2023
Copy link
Member

@aloisklink aloisklink left a comment

Choose a reason for hiding this comment

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

By the way, this is super minor and it's probably too much effort to do this in this PR, but in the future, making a separate commit for each change would be more ideal, e.g. something like:

I planed to do so, but then I thought that it would has unnecessary commits. And the pnpm-lock.yaml is already updated and it would need more effort to partially git add lines for each commit.

Sounds good! Having each separate change in a separate commit would make it easier to find which change caused the unit tests to fail (e.g. using something like git bisect, but that's up to you.

I'll set this PR as a draft until we figure out what's happening with the unit tests. Other than that, this PR looks good!

@aloisklink aloisklink marked this pull request as draft September 30, 2023 17:37
@Yokozuna59
Copy link
Member Author

Sounds good! Having each separate change in a separate commit would make it easier to find which change caused the unit tests to fail (e.g. using something like git bisect, but that's up to you.

It's because of sankey dependencies overriding. I've removed them locally and tested it out, and it worked fine.
The weird part is that e2e tests are passing.

@github-actions github-actions bot added the Type: Bug / Error Something isn't working or is incorrect label Jan 27, 2024
@Yokozuna59 Yokozuna59 mentioned this pull request Jan 29, 2024
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file Type: Bug / Error Something isn't working or is incorrect
Projects
None yet
Development

Successfully merging this pull request may close these issues.

d3-shape, d3-path, d3-array are bundled multiple times
2 participants