/
βββ .github/ # GitHub Actions workflows for CI/CD
βββ packages/ # Contains individual packages
β βββ vue-component-library/ # The primary Vue 3 component library
β βββ nuxt-module/ # Nuxt 3 module to auto-import components
βββ .gitignore
βββ pnpm-workspace.yaml # PNPM workspace configuration
βββ package.json # Root-level metadata and scripts
βββ README.md # This documentation file
βββ ...
git clone https://github.com/UCLALibrary/ucla-library-website-components.git
cd ucla-library-website-components
pnpm install
This monorepo contains the ucla-library-website-components library, a Vue 3 component library designed for UCLA Library websites using Nuxt 3. The monorepo utilizes: PNPM workspaces for dependency management.
-
Vite for building the component library.
-
Semantic Release for automated versioning.
-
PNPM Publish for package publication.
-
GitHub Actions for CI/CD workflows.
pnpm lib:storybook
pnpm lib:cypress
pnpm lib:build
- Chromatic runs automatically when merged into main.
- For manual Chromatic checks:
- Visit the GitHub Actions tab.
- Run the "Chromatic" workflow manually.
- Chromatic checks run in CI/CD after merging into main.
pnpm -r lint:fix
-
@ucla-library-monorepo/ucla-library-website-components
-
Vue 3 component library
-
Built with Vite and TypeScript
-
Exports components individually for optimal tree-shaking
-
-
@ucla-library/nuxt-module
- Nuxt 3 module that auto-imports the above components
-
Versioning: Managed by Semantic Release based on commit messages.
-
Publishing: Handled via PNPM Publish for greater control over registry updates.
- Create a new branch with your changes.
- Follow conventional commit standards to tag your commits.
- Open a pull request.
- Upon merging into main, GitHub Actions will:
- Run Chromatic checks.
- Perform a release using semantic-release.
- Publish the package using pnpm publish.
pnpm add --save-dev @ucla-library-monorepo/ucla-library-website-components
or
pnpm install @ucla-library-monorepo/ucla-library-website-components --save-dev
css: [
'@ucla-library-monorepo/ucla-library-website-components/style.css',
],
For direct imports:
import { ButtonLink } from '@ucla-library-monorepo/ucla-library-website-components'
- Always install or add packages from the root
- if adding a package to component library
pnpm --filter @ucla-library-monorepo/ucla-library-website-components add lodash
- if adding package to root use
pnpm install semantic-release-monorepo -w
Use pnpm link to test local changes to the Nuxt module in the library-website-nuxt application without publishing a new version to npm.
Note: These instructions are for pnpm 11+. Global linking (
pnpm link --global) is no longer supported. Instead, link directly to the local package directory.
- Both repositories should use the pnpm version pinned in their respective
package.jsonfiles. - Enable Corepack before working with the repositories:
corepack enableVerify the active pnpm version:
pnpm --versionIf the version does not match the version pinned in the repository's packageManager field, run:
corepack use pnpm@<version>Replace <version> with the version specified in the repository's packageManager field.
From the ucla-library-website-components repository:
cd ucla-library-website-components
pnpm install
pnpm run buildFrom the library-website-nuxt repository:
This path /../../ucla-library-website-components/packages/ should be absolute or relative path to your component librray repo, You need to try what works for you locally
cd ../library-website-nuxt
pnpm link /../../ucla-library-website-components/packages/component-library-nuxt-moduleThis creates a symbolic link from the Nuxt application's node_modules to your local Nuxt module.
The Nuxt application will now use your local module instead of the published package from npm.
Verify that the linked package is being used:
pnpm list @ucla-library/component-library-nuxt-moduleOr verify that the package inside node_modules is a symbolic link:
ls -l node_modules/@ucla-library/component-library-nuxt-moduleThe output should point to your local package directory.
After the link has been created:
-
Make changes to the Nuxt module or the component library.
-
From the
ucla-library-website-componentsrepository, rebuild the Nuxt module:
pnpm run build-
Return to the
library-website-nuxtrepository. -
If the Nuxt development server does not automatically pick up the changes, restart it:
pnpm devRepeat these steps as you continue development.
When you are finished testing the local package:
-
Stop the Nuxt development server (
Ctrl+C). -
From the
library-website-nuxtrepository, unlink the local package:
pnpm unlink @ucla-library/component-library-nuxt-moduleTip: Running
pnpm unlinkwithout specifying a package name removes all locally linked packages in the current project. If you have multiple linked packages, it is recommended to specify the package name so only the desired link is removed.
- Restore the published package from npm:
pnpm install- Restart the development server:
pnpm devThe Nuxt application will now use the published version of @ucla-library/component-library-nuxt-module from npm.
Run these commands from the library-website-nuxt repository:
pnpm list @ucla-library/component-library-nuxt-moduleor
ls -l node_modules/@ucla-library/component-library-nuxt-moduleThe output should indicate whether the package is a symbolic link to your local package or the published package installed from npm.
Run this command from either repository:
pnpm --versionBoth repositories should report the version pinned in their respective package.json files.
Run this command from either repository:
which pnpmThis shows which pnpm executable is currently being used (for example, the Corepack-managed pnpm or a globally installed pnpm).
From either repository, enable Corepack:
corepack enableIf necessary, switch to the version pinned in the current repository's package.json:
corepack use pnpm@<version>Then verify the version:
pnpm --versionFrom the ucla-library-website-components repository, rebuild the Nuxt module:
pnpm --filter @ucla-library/component-library-nuxt-module buildThen, from the library-website-nuxt repository, restart the development server:
pnpm devIf the problem persists, verify that the package is still linked using:
pnpm list @ucla-library/component-library-nuxt-moduleor
ls -l node_modules/@ucla-library/component-library-nuxt-module- These instructions apply to pnpm 11 and later.
pnpm linklinks a local package directory directly into your project'snode_modules.- The linked package is a symbolic link to your local source, allowing you to test changes without publishing to npm.
- After making changes to the Nuxt module, rebuild it before testing in the Nuxt application.
- If changes are not reflected, restart the Nuxt development server.
- When finished testing, always run
pnpm unlinkfollowed bypnpm installto restore the published package from npm. - If you are using Corepack, ensure both repositories are using the pnpm version pinned in their respective
packageManagerfields.
PNPM workspaces PNPM catalogs Semantic Release Documentation