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

upcoming: [M3-8638] - Introduce the new (at)linode/ui package #11057

Merged
merged 10 commits into from
Oct 10, 2024

Conversation

hkhalil-akamai
Copy link
Contributor

@hkhalil-akamai hkhalil-akamai commented Oct 7, 2024

Description 📝

Introduces the new @linode/ui package, which will host our shared UI component library. The package also supports unit tests via vitest and will eventually become the home of our Storybook declarations.

This is the first step in our modularization effort. These components will eventually be published and used outside of Cloud Manager, such as in downstream microfrontends. Therefore, they need to function independently of any tools, utilities or components specific to Cloud Manager.

The package must support unit testing through vitest. Existing unit tests will be migrated alongside their associated components.

Storybook and all storybook declarations will also eventually be hosted from this package.

Changes 🔄

  • Introduces the new @linode/ui package
  • Update generate-changelog and package-version scripts to include this package
  • Update ci.yml to typecheck and test this package
  • Copy the Chip and BetaChip components to demonstrate the usage of this package

How to test 🧪

  • Importing components from this package into Cloud Manager works as expected
  • Type checking passes
  • All unit tests pass
  • Release scripts continue to work as expected with this package (changelog, package versions)
  • CI passes -- the package passes typechecking and unit testing

Copy link
Member

@bnussman-akamai bnussman-akamai left a comment

Choose a reason for hiding this comment

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

Just realized this was a draft 🤦 Going to leave this early feedback so it doesn't get lost but will wait to continue reviewing, sorry about that!

packages/ui/package.json Outdated Show resolved Hide resolved
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copied from packages/api-v4/.eslintrc.json

@hkhalil-akamai hkhalil-akamai changed the title WIP: Introduce the new @linode/ui package WIP: Introduce the new (at)linode/ui package Oct 8, 2024
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copied from packages/api-v4/.prettierrc

padding: 0,
},
fontSize: '0.625rem',
fontFamily: '"LatoWebBold", sans-serif', // TODO: remove hardcoded font once theme is added to this package
Copy link
Contributor Author

@hkhalil-akamai hkhalil-akamai Oct 8, 2024

Choose a reason for hiding this comment

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

theme.font is a custom declaration from our theme.ts file

@hkhalil-akamai hkhalil-akamai marked this pull request as ready for review October 8, 2024 19:01
@hkhalil-akamai hkhalil-akamai requested a review from a team as a code owner October 8, 2024 19:01
@hkhalil-akamai hkhalil-akamai requested review from mjac0bs and bnussman-akamai and removed request for a team October 8, 2024 19:01
@hkhalil-akamai hkhalil-akamai changed the title WIP: Introduce the new (at)linode/ui package Introduce the new (at)linode/ui package Oct 8, 2024
@hkhalil-akamai hkhalil-akamai changed the title Introduce the new (at)linode/ui package upcoming: [M3-8638] - Introduce the new (at)linode/ui package Oct 8, 2024
* Optional component to render instead of a span.
*/
component?: React.ElementType;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Something we should address in a follow-up. I don't remember why we ever needed this abstraction, but the _ChipProps already has component as part of it's type.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Figured this was small enough to include in this PR 07e44

Copy link
Contributor

@jaalah-akamai jaalah-akamai left a comment

Choose a reason for hiding this comment

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

This is looking great. Approving pending addition of CHANGELOG.md.

✅ Changesets are working in package
yarn package-versions works as intended
Screenshot 2024-10-08 at 4 38 09 PM

✅ Configs / Dependencies look good
❌ Need to create a CHANGELOG.md file for yarn generate-changelogs
Screenshot 2024-10-08 at 4 39 38 PM

@jaalah-akamai jaalah-akamai added the Add'tl Approval Needed Waiting on another approval! label Oct 8, 2024
Copy link

github-actions bot commented Oct 8, 2024

Coverage Report:
Base Coverage: 86.96%
Current Coverage: 86.96%

Copy link
Contributor

@mjac0bs mjac0bs left a comment

Choose a reason for hiding this comment

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

  • Importing components from this package into Cloud Manager works as expected - confirmed chips look good
  • Type checking passes
  • All unit tests pass - left a ❓ about running tests locally
  • Release scripts continue to work as expected with this package (changelog, package versions) - no issues other than what Jaalah already noted 👍🏼
  • CI passes -- the package passes typechecking and unit testing

README.md Outdated Show resolved Hide resolved
Copy link
Contributor

@mjac0bs mjac0bs Oct 8, 2024

Choose a reason for hiding this comment

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

Minor and non-blocking: Is there anything we can change in our root package.json to be able to run tests from both manager and ui packages? (Edit: yeah, yarn workspace linode-manager test && yarn workspace @linode/ui test should do it.)

It looks like we have "test": "yarn workspace linode-manager test" configured in the root package.json scripts, but when I ran yarn test from the root, I was only seeing manager tests run.

image

Navigating into the ui package and running yarn test from there worked as expected.

Screenshot 2024-10-08 at 2 31 27 PM

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have some reservations about &&ing these two commands together since it might make it hard to read the output of the test command. For example, failing Manager tests would be hidden somewhere in the middle of the command output.

I wonder if there is a way to instruct vitest to run both test suites as if they are one -- curious if @bnussman-akamai has any suggestions here.

Copy link
Member

@bnussman-akamai bnussman-akamai Oct 9, 2024

Choose a reason for hiding this comment

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

I also am anti-&&

I think we should just use commands like yarn test:manager and yarn test:ui

I don't really know of anything else more elegant we can do 🫤

Copy link
Contributor

Choose a reason for hiding this comment

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

For example, failing Manager tests would be hidden somewhere in the middle of the command output.

@hkhalil-akamai Could you elaborate on what you mean by this? Wouldn't the commands run in order -manager tests would run first and ui tests would run second? That's what I was seeing when I ran it that way, at least.

Using separate commands is okay with me, though - I do just eventually want a way to run all the tests from the root.

Copy link
Member

@bnussman-akamai bnussman-akamai left a comment

Choose a reason for hiding this comment

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

General setup looks good!

I do think our themes should move to this package, but I imagine that requires some significant changes. We can do this as soon as it's feasible

Copy link
Member

Choose a reason for hiding this comment

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

Can we add a job that typechecks the new UI package?

Copy link
Contributor Author

@hkhalil-akamai hkhalil-akamai Oct 9, 2024

Choose a reason for hiding this comment

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

Added. Side note: why don't we typecheck the api-v4 and validation packages?

Copy link
Member

Choose a reason for hiding this comment

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

The build steps for api-v4 and validation (build-validation, build-sdk) inherently type-check because they run tsc during the build process

packages/ui/package.json Outdated Show resolved Hide resolved
@mjac0bs mjac0bs added Approved Multiple approvals and ready to merge! and removed Add'tl Approval Needed Waiting on another approval! Ready for Review labels Oct 9, 2024
@mjac0bs
Copy link
Contributor

mjac0bs commented Oct 10, 2024

Test failures in CI are not related to this PR; merging this on Hussain's behalf.

@mjac0bs mjac0bs merged commit dbf2e0c into linode:develop Oct 10, 2024
22 of 23 checks passed
Copy link

cypress bot commented Oct 10, 2024

Cloud Manager E2E    Run #6655

Run Properties:  status check failed Failed #6655  •  git commit dbf2e0c067: upcoming: [M3-8638] - Introduce the new `(at)linode/ui` package (#11057)
Project Cloud Manager E2E
Run status status check failed Failed #6655
Run duration 27m 43s
Commit git commit dbf2e0c067: upcoming: [M3-8638] - Introduce the new `(at)linode/ui` package (#11057)
Committer Hussain Khalil
View all properties for this run ↗︎

Test results
Tests that failed  Failures 1
Tests that were flaky  Flaky 2
Tests that did not run due to a developer annotating a test with .skip  Pending 2
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 429

Tests for review

Failed  cypress/e2e/core/placementGroups/delete-placement-groups.spec.ts • 1 failed test

View Output Video

Test Artifacts
Placement Group deletion > can delete with Linodes assigned when unexpected error show up and retry Screenshots Video
Flakiness  clone-linode.spec.ts • 1 flaky test

View Output Video

Test Artifacts
clone linode > can clone a Linode from Linode details page Screenshots Video
Flakiness  rebuild-linode.spec.ts • 1 flaky test

View Output Video

Test Artifacts
rebuild linode > cannot rebuild a provisioning linode Screenshots Video

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Approved Multiple approvals and ready to merge! Modularization
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants