Belayer is a simple CLI tool that allows you to install and manage UI components from a remote GitHub repository.
Important
Belayer is currently in early Alpha. It is not currently published to NPM! To run locally you must use the npm link
command.
You can use Belayer directly with npx
:
npx belayer
Alternatively, you can install it globally:
npm install -g belayer
Before using Belayer, you need to run the setup process:
npx belayer
This will prompt you to enter configuration details, such as:
- The local path where components should be installed
- Your GitHub repository URL
- Whether the repository is private
- Your GitHub Personal Access Token (if needed)*(Note, not currently used in MVP!!)
- An alias for your component library
- The remote component folder (e.g.,
src/components
)
These settings will be stored in belayer-config.json
for future use.
To view a list of all available components in your GitHub repository, run:
npx belayer list
This will fetch and display the names of all component directories inside the configured remote component folder.
To install a specific component from the repository, use:
npx belayer add <ComponentName>
For example, to install a component named Button
:
npx belayer add Button
This will fetch the component files and place them in your local component directory.
Belayer stores your configuration in a belayer-config.json
file in your project root. You can manually edit this file if needed:
{
"componentPath": "src/components/",
"githubRepo": "https://github.com/yourusername/your-repo.git",
"isPrivate": true,
"githubToken": "your-github-token",
"libraryAlias": "belayer-ui",
"remoteRoot": "src/components"
}
✅ Easily fetch UI components from a GitHub repository ✅ Supports private repositories with authentication ✅ Fast and lightweight using sparse cloning ✅ Works with any project setup
-
Error:
Component "XYZ" not found
- Ensure the component exists in the configured
src/components/
directory in the repository. - Run
npx belayer list
to verify available components.
- Ensure the component exists in the configured
-
Error:
Failed to fetch components
- Check your GitHub token permissions (for private repos, it needs
read
access to the repo). - Ensure the GitHub repo URL is correct.
- Check your GitHub token permissions (for private repos, it needs
MIT License.
Enjoy using Belayer! 🎉 Feel free to contribute or suggest improvements.