Hairylib Monorepo
Hairylib is a monorepo project managed and published using pnpm and bumpp. It collects the libraries and utilities I use across projects into one place, with shared tooling and workflows.
What are the benefits of a Monorepo?
Dependency Hoisting. When multiple projects depend on common libraries like
react,vue, orTypeScript, usingpnpm workspacewith thecatalog:protocol hoists dependencies to the top level. This allows multiple sub-modules/packages to reuse the same dependencies, reducing project size and ensuring consistency.Unified Management. In micro-frontend projects, multiple sub-applications can be placed in the same
monorepofor easier management. Backend projects usingnode.jscan also be managed with the same technology stack in amonorepo. DuringCI/CDand other pipeline processes, this facilitates unified iteration or version upgrades, and makes it easier to apply common config across multiple sub-projects.Unified Publishing. Tools like
bumppandpnpmfor unified publishing simplifies version management and reduces publishing complexity. and thegithub releaseis automatically generated. This makes it easier to manage the version of the entire project and publish it tonpm.
Workflow
- Code quality: Unified linting and formatting powered by antfu/eslint-config and lint-staged and simple-git-hooks.
- Continuous integration: GitHub Actions runs
pnpm lint,pnpm test, andpnpm typecheck(tsc --noEmit) on every push/PR sobranchstays green. - Versioning & Releases: Use bumpp for versioning and changelogithub for
CHANGELOGand GitHub Releases and Automate passwordless publishing via npm Trusted Publisher - Build & runtime: tsdown outputs both
esmandcjsbundles; tsx is used to run TypeScript directly during development. - Monorepo DX: Uses pnpm catalog for centralized dependency management and hoisting; during development packages import each other's
index.tsdirectly to simplify cross-package references. - Testing: vitest with built-in workspace support for fast, isolated tests.
Packages in this monorepo
These are the packages currently maintained in this repository:
- @hairy/utils – core utility library used by all other packages.
- @hairy/wechat-jssdk – helpers around the WeChat JSSDK.
- @hairy/palette – utilities for building and working with color palettes.
- @hairy/vue-lib – Vue composables and helpers (Vue 2 + 3 via
vue-demi). - @hairy/uni-lib – shared utilities targeting Uni-app / Vue-based runtimes.
- @hairy/react-lib – A utility tool library based on React.
- @hairy/react-lib-composition – React reactivity layer using
@vue/reactivity. - @hairy/react-i18-lib – small helpers for
react-i18next-based i18n. - lib-placeholder – A empty template.
All publishable packages share the same toolchain: tsdown for builds, vitest for tests, tsx for quick scripts, and pnpm workspaces with catalog: hoisting for consistent dependency versions.