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: merge cds-core tools to clr-angular (WIP) #1515

Draft
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

Jinnie
Copy link
Contributor

@Jinnie Jinnie commented Aug 9, 2024

PR Checklist

Please check if your PR fulfills the following requirements:

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • If applicable, have a visual design approval

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Copy link
Contributor

github-actions bot commented Aug 9, 2024

👋 @Jinnie,

  • 🙏 The Clarity team thanks you for opening a pull request
  • 🎉 The build for this PR has succeeded
  • 🔍 The PR is now ready for review
  • 🍿 In the meantime, view a preview of this PR
  • 🖐 You can always follow up here. If you're a VMware employee, you can also reach us on our internal Clarity Support space

Thank you,

🤖 Clarity Release Bot

package.json Outdated Show resolved Hide resolved

## Quick Start Install

1. First, install the Clarity Core package from npm.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The info in this file is irrelevant now. It should either be updated, or the file deleted.

Copy link
Contributor Author

@Jinnie Jinnie left a comment

Choose a reason for hiding this comment

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

The content of /projects/core/build should be reviewed. Some storybook and website related tools exist, that are not relevant to the new location.

Copy link

netlify bot commented Aug 14, 2024

Deploy Preview for clarity-date-range ready!

Name Link
🔨 Latest commit 8512188
🔍 Latest deploy log https://app.netlify.com/sites/clarity-date-range/deploys/66bcb348b8526500087923c3
😎 Deploy Preview https://deploy-preview-1515--clarity-date-range.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.

package.json Outdated
@@ -66,21 +70,32 @@
"@angular/platform-browser": "15.2.2",
"@angular/platform-browser-dynamic": "15.2.2",
"@angular/router": "15.2.2",
"@cds/core": "6.9.2",
"@cds/core": "file:dist/@cds/core",
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 think this should be in package.json. I think it would be better to use path aliases in tsconfig.json so that you don't have to have core built before staring ng-clarity.

Copy link
Member

@kevinbuhmann kevinbuhmann Aug 14, 2024

Choose a reason for hiding this comment

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

Another problem with this is that the cds-icon imports work in this project, but the icon component is not included in a published package. I think this needs to be restructured so that there is not a ./dist/@cds/core folder. It's not actually a dist folder anyway because it is not published. Instead, I think the styles/tokens should be in @clr/ui and the icon component should be in @clr/angular. Otherwise, there is no way for consumers of the published packages to use the things that used to be in @cds/core.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's still one of the WIP parts. And your feedback is very valuable.
The idea is to either have a separate package (but not named @cds/core, maybe @clr/core or something else), or, as you say, move tokens to @clr/ui and the rest to @clr/angular (or a smaller core package).
The problem with moving them to the existing packages is that many of the consumable artefacts should still be built before we're able to import and use them.
As a next step we can explore the merging option, and if unsuccessful, fall back to a @clr/core or similar package.

cdsCloseButton.setAttribute('aria-label', ariaLabel);
cdsCloseButton.setAttribute('aria-hidden', 'true');
cdsCloseButton.setAttribute('type', 'button');
const createCloseButton = (document: Document, ariaLabel: string) => {
Copy link
Member

Choose a reason for hiding this comment

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

I think this change should be extracted to a separate PR that just removes dependency on cds-internal-close-button.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, we can do it before the rest of this PR lands.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, with PR #1539

Comment on lines 418 to 419
& {
@if (map.has-key($map, $key)) {
Copy link
Member

Choose a reason for hiding this comment

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

Why is this change needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

At some point I was using a newer SASS version and it started reporting issues with the order of mixins vs declarations.
But once we need to do this, we'd better do it separately from this PR and when the change is needed.
I'll revert this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. Also remove the same change from _buttons...

Comment on lines 26 to 27
buildAndroidXMLTokens('./dist/@cds/core/tokens/tokens.android.xml');
buildIOSSwiftTokens('./dist/@cds/core/tokens/tokens.ios.swift');
Copy link
Member

Choose a reason for hiding this comment

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

I think these should be removed. The ./dist/@cds/core folder is not published as a package, so this is dead code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch, I removed some, but these I've missed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

package.json Outdated
@@ -66,21 +70,32 @@
"@angular/platform-browser": "15.2.2",
"@angular/platform-browser-dynamic": "15.2.2",
"@angular/router": "15.2.2",
"@cds/core": "6.9.2",
"@cds/core": "file:dist/@cds/core",
"@commitlint/cz-commitlint": "16.2.3",
Copy link
Member

Choose a reason for hiding this comment

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

This should be removed.

package.json Outdated
@@ -103,15 +118,28 @@
"karma-mocha-reporter": "2.2.5",
"karma-parallel": "0.3.1",
"lint-staged": "12.3.7",
"lit": "^2.1.3",
Copy link
Member

Choose a reason for hiding this comment

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

This should be an exact version.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

package.json Outdated
"ng-packagr": "15.0.1",
"node-static": "0.7.11",
"npm-run-all": "4.1.5",
"patch-package": "6.4.7",
"playwright": "1.43.0",
"postcss-cli": "8.3.1",
"prettier": "2.6.2",
"purgecss": "^4.1.3",
Copy link
Member

Choose a reason for hiding this comment

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

This should be an exact version.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Comment on lines 7 to 11
@import '../../../dist/@cds/core/styles/module.reset.min.css';
@import '../../../dist/@cds/core/styles/module.tokens.min.css';
@import '../../../dist/@cds/core/styles/module.layout.min.css';
@import '../../../dist/@cds/core/styles/module.typography.min.css';
@import '../../../dist/@cds/core/styles/theme.dark.min.css';
Copy link
Member

Choose a reason for hiding this comment

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

How are consumer supposed to import these files? I think we need to build these files into the @clr/ui directory so that they are included in a published package.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This will be handled once we make a choice and provide solution, as discussed in my reply to your first comment above.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For now, changing the import to be through @cds/core/styles/....., so we don't rely on direct relative paths and dist.

@Jinnie Jinnie force-pushed the jinnie/cds-core-to-clr branch 2 times, most recently from 415ea42 to 45b8ce1 Compare August 15, 2024 08:15
@Jinnie Jinnie force-pushed the jinnie/cds-core-to-clr branch 2 times, most recently from d6c05d5 to bc46b1c Compare September 3, 2024 10:50
Copy link
Contributor

github-actions bot commented Sep 3, 2024

This PR introduces visual changes: 57a4d47
If these changes are intended and correct, please cherry-pick the above commit to this PR.

git checkout jinnie/cds-core-to-clr
git fetch https://github.com/vmware-clarity/ng-clarity.git 57a4d47d365107e79dc9b4664c25ae9fe5d73d83
git cherry-pick 57a4d47d365107e79dc9b4664c25ae9fe5d73d83
git push

Copy link
Contributor

github-actions bot commented Sep 4, 2024

This PR introduces visual changes: 8cb1534
If these changes are intended and correct, please cherry-pick the above commit to this PR.

git checkout jinnie/cds-core-to-clr
git fetch https://github.com/vmware-clarity/ng-clarity.git 8cb1534c782ef0b7b015c761818d31dda573bcfc
git cherry-pick 8cb1534c782ef0b7b015c761818d31dda573bcfc
git push

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants