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

Cleanup prior to making logic changes #6041

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

Conversation

jgreywolf
Copy link
Contributor

📑 Summary

This PR is for small cleanup to code before making larger changes to address multiple issues related to class diagrams.
Ensure consistent naming between documentation and code, and remove an unnecessary function

📋 Tasks

Make sure you

  • 📖 have read the contribution guidelines
  • 💻 have added necessary unit/e2e tests.
  • 📓 have added documentation. Make sure MERMAID_RELEASE_VERSION is used for all new features.
  • 🦋 If your PR makes a change that should be noted in one or more packages' changelogs, generate a changeset by running pnpm changeset and following the prompts. Changesets that add features should be minor and those that fix bugs should be patch. Please prefix changeset messages with feat:, fix:, or chore:.

Copy link

changeset-bot bot commented Nov 8, 2024

⚠️ No Changeset found

Latest commit: 53bb6ef

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions github-actions bot added the Type: Other Not an enhancement or a bug label Nov 8, 2024
Copy link

netlify bot commented Nov 8, 2024

Deploy Preview for mermaid-js ready!

Name Link
🔨 Latest commit 53bb6ef
🔍 Latest deploy log https://app.netlify.com/sites/mermaid-js/deploys/6734b506909dca0008db400d
😎 Deploy Preview https://deploy-preview-6041--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.

Copy link

pkg-pr-new bot commented Nov 8, 2024

Open in Stackblitz

pnpm add https://pkg.pr.new/mermaid-js/mermaid@6041
pnpm add https://pkg.pr.new/mermaid-js/mermaid/@mermaid-js/mermaid-zenuml@6041
pnpm add https://pkg.pr.new/mermaid-js/mermaid/@mermaid-js/layout-elk@6041
pnpm add https://pkg.pr.new/mermaid-js/mermaid/@mermaid-js/parser@6041

commit: 53bb6ef

Copy link

codecov bot commented Nov 8, 2024

Codecov Report

Attention: Patch coverage is 0% with 100 lines in your changes missing coverage. Please review.

Project coverage is 4.49%. Comparing base (c8ce416) to head (53bb6ef).

Files with missing lines Patch % Lines
packages/mermaid/src/diagrams/class/classDb.ts 0.00% 45 Missing ⚠️
packages/mermaid/src/diagrams/class/svgDraw.js 0.00% 16 Missing ⚠️
...ndering-util/rendering-elements/shapes/classBox.ts 0.00% 14 Missing ⚠️
packages/mermaid/src/diagrams/class/shapeUtil.ts 0.00% 11 Missing ⚠️
packages/mermaid/src/dagre-wrapper/nodes.js 0.00% 9 Missing ⚠️
packages/mermaid/src/diagrams/class/classTypes.ts 0.00% 4 Missing ⚠️
packages/mermaid-layout-elk/src/render.ts 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##           develop   #6041   +/-   ##
=======================================
  Coverage     4.49%   4.49%           
=======================================
  Files          383     383           
  Lines        53925   53910   -15     
  Branches       596     596           
=======================================
  Hits          2425    2425           
+ Misses       51500   51485   -15     
Flag Coverage Δ
unit 4.49% <0.00%> (+<0.01%) ⬆️

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

Files with missing lines Coverage Δ
packages/mermaid-layout-elk/src/render.ts 0.00% <0.00%> (ø)
packages/mermaid/src/diagrams/class/classTypes.ts 0.00% <0.00%> (ø)
packages/mermaid/src/dagre-wrapper/nodes.js 0.00% <0.00%> (ø)
packages/mermaid/src/diagrams/class/shapeUtil.ts 0.00% <0.00%> (ø)
...ndering-util/rendering-elements/shapes/classBox.ts 0.00% <0.00%> (ø)
packages/mermaid/src/diagrams/class/svgDraw.js 0.00% <0.00%> (ø)
packages/mermaid/src/diagrams/class/classDb.ts 0.00% <0.00%> (ø)

Copy link

argos-ci bot commented Nov 8, 2024

The latest updates on your projects. Learn more about Argos notifications ↗︎

Build Status Details Updated (UTC)
default (Inspect) ⚠️ Changes detected (Review) 7 changed, 343 added, 343 removed Nov 13, 2024, 2:34 PM

@jgreywolf
Copy link
Contributor Author

@sidharthv96 @ashishjain0512 Can one of you please review? I would like to get this in place before I work on all of the pending classDiagram issues

packages/mermaid/src/diagrams/class/classDb.ts Outdated Show resolved Hide resolved
packages/mermaid/src/diagrams/class/classDb.ts Outdated Show resolved Hide resolved
members: ClassMember[];
attributes: ClassMember[];
Copy link
Member

Choose a reason for hiding this comment

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

This change needs to be documented in a changeset. I'm not really sure if we should consider this as breaking or not, but it should atleast be a minor version bump. @aloisklink wdyt?

Copy link
Member

Choose a reason for hiding this comment

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

I don't see why it should be documented in a changeset.

Are we exposing the class types externally to any users of Mermaid?

The only thing I can exported that is potentially risky is the InternalHelpers type:

export type InternalHelpers = typeof internalHelpers;
, which looks to be used by the @mermaid-js/layout-elk package:

/**
* Internal helpers for mermaid
* @deprecated - This should not be used by external packages, as the definitions will change without notice.
*/
export const internalHelpers = {
common,
getConfig,
insertCluster,
insertEdge,
insertEdgeLabel,
insertMarkers,
insertNode,
interpolateToCurve,
labelHelper,
log,
positionEdgeLabel,
};
export type InternalHelpers = typeof internalHelpers;

But it doesn't look like this ClassNode is being exported anywhere.

Copy link
Member

Choose a reason for hiding this comment

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

Although we are not exporting it, it's being used by others like excalidraw. So it's good to be documented in the changelog.

Copy link
Member

Choose a reason for hiding this comment

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

Ah, we are exporting it, just not via the import XXX from 'mermaid'; entry-point.

We should probably ban import type XXX from 'mermaid/dist/xxxxx' by removing this line in our package.json:

(although this will be a breaking change), as otherwise every future change in the internal types will be a breaking change.

Maybe we can create a separate entry-point like import type XXX from 'mermaid/internal-types' where all these types are explicitly marked as not covered by SemVer and may change even between patch releases?

Or we could use something like https://api-extractor.com/ to mark types as @alpha/@beta/@internal and warn us about breaking changes to the types automatically.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should it? Agree with Alois that internal names should not be an issue that causes a version bump.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Other Not an enhancement or a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants