Monorepo for @funish/basis - A unified development toolkit with CLI for package management, versioning, publishing, linting, and git hooks management for JavaScript/TypeScript projects.
This is the monorepo for @funish/basis, a modern development toolkit that unifies common development workflows into a single CLI. Instead of juggling multiple tools for package management, versioning, publishing, linting, and git hooks, Basis provides one interface for everything.
π€ User? Looking to use @funish/basis? Check out the package documentation or install directly:
# Install globally with pnpm (recommended)
pnpm add -g @funish/basis
# Quick start
basis init
π§βπ» Developer? Welcome! This document is for you. Keep reading to learn how to contribute to this project.
Basis is a unified CLI toolkit that provides:
- π¦ Package Management: Auto-detected package manager support (npm, yarn, pnpm, bun, deno)
- π·οΈ Version Management: Semantic versioning with automated git tagging
- π Publishing: Multi-tag publishing strategy with edge version tracking
- π§ Linting: Tool-agnostic linting workflow
- πͺ Git Hooks: Smart git hooks management
- π» Modern Architecture: Built on unjs ecosystem (citty, consola, c12, nypm, semver)
basis/
βββ packages/
β βββ basis/ # Main @funish/basis package
β βββ src/
β β βββ cli.ts # CLI entry point
β β βββ commands/ # CLI command implementations
β β β βββ install.ts # Package installation (nypm)
β β β βββ add.ts # Add dependencies (nypm)
β β β βββ remove.ts # Remove dependencies (nypm)
β β β βββ run.ts # Run scripts (nypm)
β β β βββ version.ts # Version management (semver)
β β β βββ publish.ts # Publishing workflow
β β β βββ lint.ts # Linting coordination
β β β βββ git.ts # Git management with subcommands
β β β βββ init.ts # Project initialization
β β β βββ config.ts # Configuration management
β β βββ modules/ # Core business logic
β β β βββ version.ts # Version management logic
β β β βββ publish.ts # Publishing logic
β β β βββ git.ts # Git hooks and config implementation
β β β βββ lint.ts # Linting implementation
β β β βββ init.ts # Initialization logic
β β βββ config.ts # Configuration system (c12)
β β βββ types.ts # TypeScript type definitions
β β βββ utils.ts # Shared utilities
β βββ package.json # Package manifest
β βββ build.config.ts # Build configuration (unbuild)
β βββ README.md # User documentation
βββ package.json # Monorepo configuration
βββ pnpm-workspace.yaml # pnpm workspace configuration
βββ tsconfig.json # TypeScript configuration
βββ basis.config.ts # Self-hosting configuration
βββ README.md # This file (development documentation)
- Node.js 18.x or higher
- pnpm 9.x or higher (this project uses pnpm as the package manager)
- Git for version control
-
Clone the repository:
git clone https://github.com/funish/basis.git cd basis
-
Install dependencies:
pnpm install
-
Build packages:
pnpm build
-
Development mode (watch and rebuild):
pnpm dev
-
Test the CLI locally:
# Link the package globally for testing cd packages/basis pnpm link --global # Now you can use 'basis' command anywhere basis --version
pnpm dev # Watch and rebuild (recommended for development)
pnpm build # Build all packages for production
pnpm lint # Run code formatting and linting
The codebase is organized into clear layers:
- Commands (
src/commands/
): CLI interface using citty - Modules (
src/modules/
): Business logic implementation - Configuration (
src/config.ts
): Unified config system using c12 - Types (
src/types.ts
): TypeScript definitions - Utilities (
src/utils.ts
): Shared helper functions
- citty: Modern CLI framework for command structure
- consola: Elegant console logging
- c12: Universal configuration loader
- nypm: Universal package manager interface
- semver: Semantic versioning utilities
- pkg-types: Package.json utilities
- pathe: Universal path utilities
- micromatch: Pattern matching for linting
Uses c12 for powerful configuration loading with:
- TypeScript support
- Environment-based overrides
- Schema validation
- Unified configuration file (
basis.config.ts
)
Multi-tag publishing approach:
edge
: Always points to latest published versionlatest
: Stable releases onlyalpha/beta/rc
: Prerelease channels- Custom tags: Flexible workflow support
We welcome contributions! Here's how to get started:
# Clone and setup
git clone https://github.com/funish/basis.git
cd basis
pnpm install
pnpm dev
# Test your changes
cd packages/basis && pnpm link --global
basis --version
- Code: Follow our standards in CONTRIBUTING.md
- Test:
pnpm build && basis <your-command>
- Commit: Use conventional commits (
feat:
,fix:
, etc.) - Submit: Create a Pull Request
π For detailed guidelines, principles, and best practices, see our Contributing Guide.
This project uses itself for version management and publishing:
# Create a new version
basis version patch # or minor/major
# Publish to npm
basis publish --stable # for stable release
basis publish # for edge release
- Patch: Bug fixes, small improvements
- Minor: New features, backwards compatible
- Major: Breaking changes
- Prerelease: Alpha/beta releases with
basis version --prerelease
This monorepo uses its own basis configuration:
// basis.config.ts
export default defineBasisConfig({
git: {
hooks: {
"pre-commit": "basis lint --staged",
"commit-msg": "basis git lint-commit",
},
config: {
core: {
autocrlf: "input",
},
},
autoInitGit: true,
},
lint: {
staged: {
"*.{ts,js,json}": "pnpm oxlint --fix --fix-suggestions",
},
},
version: {
tagPrefix: "v",
autoCommit: true,
autoTag: true,
autoPush: false,
},
publish: {
defaultTag: "edge",
stableTag: "latest",
checkGitClean: true,
checkTests: true,
},
});
Basis follows core principles that guide its design and development:
- Unified Interface: One CLI for all development tasks
- Tool Agnostic: Don't replace tools, orchestrate them
- Auto-Detection: Minimize configuration, maximize convenience
- Modern Stack: Built on proven unjs ecosystem
- Developer Experience: Focus on productivity and simplicity
- Balanced Output: Silent process with clear completion status
π For detailed development principles and coding standards, see our Contributing Guide.
The unjs ecosystem provides:
- Consistency: Similar APIs across tools
- Quality: Well-tested, maintained packages
- Performance: Optimized for speed and bundle size
- Community: Active development and support
- π« Report Issues
- π¬ Discussions
- π Documentation
This project is licensed under the MIT License - see the LICENSE file for details.
Built with β€οΈ by Funish using the amazing unjs ecosystem