design-systems-cli icon indicating copy to clipboard operation
design-systems-cli copied to clipboard

Size limit support

Open JordanForeman opened this issue 3 years ago • 3 comments

What Changed

fixes #690

Adds a new option for ds size that enables enforcement of a limit on component bundles. Refactors the size plugin significantly in order to support locally-scoped configuration options, namely, the sizeLimit option.

Why

I'm building a new Design System component and want to enforce a limit on the component as a whole, rather than simply on incoming changesets

Todo:

  • [ ] Add tests
    • Tests don't exist for this already, so it's unclear to me how/if to try to add any
  • [ ] Add docs
    • Looks like docs all exist in the gh-pages branch. What's the process for adding to that? Just a separate PR to gh-pages?
📦 Published PR as canary version: 4.14.1--canary.691.19342.0

:sparkles: Test out this PR locally via:

npm install @design-systems/[email protected]
npm install @design-systems/[email protected]
npm install @design-systems/[email protected]
npm install @design-systems/[email protected]
npm install @design-systems/[email protected]
npm install @design-systems/[email protected]
npm install @design-systems/[email protected]
npm install @design-systems/[email protected]
npm install @design-systems/[email protected]
npm install @design-systems/[email protected]
npm install @design-systems/[email protected]
npm install @design-systems/[email protected]
npm install @design-systems/[email protected]
npm install @design-systems/[email protected]
npm install @design-systems/[email protected]
npm install @design-systems/[email protected]
npm install @design-systems/[email protected]
npm install @design-systems/[email protected]
npm install @design-systems/[email protected]
npm install @design-systems/[email protected]
npm install @design-systems/[email protected]
npm install @design-systems/[email protected]
npm install @design-systems/[email protected]
npm install @design-systems/[email protected]
npm install @design-systems/[email protected]
npm install @design-systems/[email protected]
npm install @design-systems/[email protected]
# or 
yarn add @design-systems/[email protected]
yarn add @design-systems/[email protected]
yarn add @design-systems/[email protected]
yarn add @design-systems/[email protected]
yarn add @design-systems/[email protected]
yarn add @design-systems/[email protected]
yarn add @design-systems/[email protected]
yarn add @design-systems/[email protected]
yarn add @design-systems/[email protected]
yarn add @design-systems/[email protected]
yarn add @design-systems/[email protected]
yarn add @design-systems/[email protected]
yarn add @design-systems/[email protected]
yarn add @design-systems/[email protected]
yarn add @design-systems/[email protected]
yarn add @design-systems/[email protected]
yarn add @design-systems/[email protected]
yarn add @design-systems/[email protected]
yarn add @design-systems/[email protected]
yarn add @design-systems/[email protected]
yarn add @design-systems/[email protected]
yarn add @design-systems/[email protected]
yarn add @design-systems/[email protected]
yarn add @design-systems/[email protected]
yarn add @design-systems/[email protected]
yarn add @design-systems/[email protected]
yarn add @design-systems/[email protected]

JordanForeman avatar Apr 26 '22 20:04 JordanForeman

Looks like docs all exist in the gh-pages branch. What's the process for adding to that?

The docs are all located here and get published to gh-pages upon release.

Per https://github.com/intuit/design-systems-cli/issues/690

It would be ideal to be able to specify a size limit on a component-by-component basis. I'm super new to this codebase, but it seems like ds.config is system-wide. If it's possible to make component-specific configurations, then exposing a size.limit configuration for a given component that is enforced by ds size would be great. Barring that, setting a size.limit for all components should be feasible as well.

IMO, I don't think a system-wide size-limit would really provide a whole lot of value. This is one of the reasons we went with a % increase approach since that would take into account the baseline complexities of each component. With 1 global upper-bound, components like a Link and Carousel would both end up sharing the same budget.

I think a per-component size limit would be right way to go about this.

adierkens avatar Apr 27 '22 16:04 adierkens

@adierkens Updated to support package-specific size limits! It still supports global limits, but yeah I don't see that being used often. Feel free to re-review.

In order to support package-local configuration I needed to refactor the size command quite a bit. I tried to break this refactor up over a few descriptive commits, so it might be easier to review by commit.

cc. @yucho

JordanForeman avatar Apr 28 '22 15:04 JordanForeman

Thanks for the approval @kelyvin! Can you hold off on merging for the time being? I have been meaning to attach a demo to this PR, and IIRC I was having difficulty that suggested this feature wasn't working. I need to carve out some time to revisit this. I'll nudge you when this is ready.

JordanForeman avatar Jun 14 '22 17:06 JordanForeman