2023/12/18

Weekend Project 9: VerySimple UI Component Library

I'm building a UI component library that is simple, customizable, and accessible. I'm calling it VerySimple. Since it's so new, I'm still working on the documentation. I'll be adding more components and features in the coming weeks.

This weekend project is actually a collection of the last 3 weekends. I should've realeased them iteratively, I'm bummed that I didn't but I'm grouping them together this weekend and I'll work to stay consistent.

Why?

I'm building this component library for a few reasons. First, I want to have a solid foundation for my personal projects. Second, I want to create a component library that is simple, customizable, and accessible. Third, I want to make sure my understanding of how to package and release software is up to date. Doing this regularly will help me stay sharp.

Step 1: Publish packages in CI.

Before this change, I was managing releases locally. I'd make changes to the code, commit them, and then manually publish the packages. This was fine for a while, but it was getting tedious. So I decided to automate it.

Here are the related scripts.

package.json

"scripts": {
  "changeset:version": "changeset version",
  "changeset:publish": "changeset publish",
  "publish-packages": "turbo run test build lint && changeset version && changeset publish"
}

To manage the releases of my project, I'm using a combination of Turbo Repos, Yarn Workspaces, Changesets, and Github Actions. Let's take a look at how I set up a basic build in the PR using Github Actions.

Github Actions Setup

Here's the GitHub actions yaml to build the project upon Pull request:

.github/workflows/build.yml

name: PR Build

on:
  pull_request:
    branches:
      - main

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
        with:
          fetch-depth: 0

      - uses: volta-cli/action@v4

      - name: Install dependencies
        run: yarn install --frozen-lockfile

      - name: Build
        run: yarn build

Volta

I prefer using Volta for managing system dependencies like Node and Yarn. It ensures a consistent environment across systems and simplifies managing different Node and Yarn versions. I highly recommend it.

Subscribe to continue reading this post.

Subscribe