Slide 1

Slide 1 text

Tools and Strategies for Frontend UI Libraries Marco Solazzi Frontend Engineer , Merpay

Slide 2

Slide 2 text

Marco Solazzi / @dwj Frontend Engineer @ Merpay Until 2017 Marco lived in northern Italy, where he worked as a Frontend developer in the communication and creative fields. He then moved to Tokyo to work for Shiftbrain, a creative web agency, and finally joined Merpay in February 2020. Marco is passionate about UI development, design systems, and accessibility. He is a Vue.js early adopter (and very much still in love with it), but he also likes experimenting with next-gen libraries like Svelte and Solid.js.

Slide 3

Slide 3 text

Frontend developer 2010 ca. http://creativecan.com/2013/04/jquery-slider/

Slide 4

Slide 4 text

Frontend developer 2015 ca. https://todomvc.com/

Slide 5

Slide 5 text

Frontend developer 2020 ca.

Slide 6

Slide 6 text

Our component library is used on internal tools only, so I won’t be able to show screenshots or code samples. 😰 Disclaimer

Slide 7

Slide 7 text

Know what you’re doing!

Slide 8

Slide 8 text

Make a component library that developers can fall in love with. Mission

Slide 9

Slide 9 text

Create an organized set of sharable Vue.js components with simple DX and consistent design and UX. Our goal

Slide 10

Slide 10 text

Organized

Slide 11

Slide 11 text

Organized libraries are easy to navigate and browse. Organized

Slide 12

Slide 12 text

Define components’ layers Core Layer 1 Layer 3 Layer 2 project - override / custom design tokens - project specific components - Input, select, … - Layout primitives - Layout blocks (top bar, containers) - Design tokens (--color-red-50, --color-brand-primary) - base components (button, table, dialog) Form Layout

Slide 13

Slide 13 text

Basic setup Package manager: Pnpm - Fast and efficient memory management - workspaces support Task runner: Turborepo - Cached builds - Clear tasks dependency graph - One single executable

Slide 14

Slide 14 text

Basic setup Publishing: Lerna - Conventional-commit based workflow - Independent versions CI: GitHub Actions - Easy setup - Integrates with our infrastructure

Slide 15

Slide 15 text

Improvements Setup iterations CI Time CircleCI + npm + lerna ~14 mins CircleCI + pnpm + turborepo ~6.5 mins GitHub Actions + pnpm + turborepo ~8 mins

Slide 16

Slide 16 text

Developer experience

Slide 17

Slide 17 text

You cannot design the best workflow for every developer, instead you want to define the main use cases you want to cover Developer experience

Slide 18

Slide 18 text

Define your use cases Module types ● ESM by default ● CJS fallback where needed Bundlers ● Vue CLI (webpack) ● Vite Frameworks ● Nuxt.js

Slide 19

Slide 19 text

Required deliverables 01 Installable as a Vue.js plugin 02 Configurable Nuxt.js module 03 Components as Vue.js SFC modules ● Vue-CLI and Vite support SFC in node_modules ● SFC are complied based on the end-user setup 04 TypeScript declaration files

Slide 20

Slide 20 text

● Developed by the Nuxt.js team ● Bundle build (powered by Rollup and esbuild) ✅ Vue.js plugin & Nuxt module ✅ TypeScript declarations ● Bundle-less build (powered by unjs/mkdist) ✅ Transpiled Vue.js SFC modules ✅ Individual component TypeScript declarations The build tool: unjs/unbuild

Slide 21

Slide 21 text

TSDX: monorepo support, integrated testing and linting microbundle: optimized rollup bundler with support for ESM, TypeScript and JSX Alternatives

Slide 22

Slide 22 text

What about documentation?

Slide 23

Slide 23 text

Enter Storybook 👍 Component development in isolation 👍 Easy to document variants 👍 Built-in markdown documentation support 👎 Difficult to customize 👎 Overall a bit slow (for now)

Slide 24

Slide 24 text

Alternatives: dev environments

Slide 25

Slide 25 text

Alternatives: documentation only Docusaurus VuePress

Slide 26

Slide 26 text

Design and UX

Slide 27

Slide 27 text

The key for great UX is to keep a high standard of consistency and usability. Design and UX

Slide 28

Slide 28 text

Consistency and usability 01 Component testing Jest Vitest Cypress CT

Slide 29

Slide 29 text

Consistency and usability 01 Component testing 02 Accessibility audit Storybook Axe Cypress CT

Slide 30

Slide 30 text

Consistency and usability 01 Component testing 02 Accessibility audit 03 Visual regression testing

Slide 31

Slide 31 text

Closing remarks

Slide 32

Slide 32 text

Having a clear strategy is the key to choose the right tools to create component libraries that other developers will love to use. A matter of love

Slide 33

Slide 33 text

No content