pyrajs-cli
v0.18.4
Published
π₯ @Pyra/cli - A cli tool for using core cli commands
Downloads
859
Maintainers
Readme
pyrajs-cli
π₯ Pyra.js - Next-gen build tool for blazing-fast web development
A modern, TypeScript-first build tool with zero-config defaults, instant dev server, and lightning-fast builds.
β¨ Features
- π Blazing Fast - Powered by esbuild for instant builds and dev server startup
- π₯ Hot Module Replacement - See changes instantly without losing state
- π¦ Zero Config - Sensible defaults, works out of the box
- π― TypeScript First - Full TypeScript support with type checking
- π Plugin System - Extend functionality with a powerful plugin API
- π¨ Framework Agnostic - Works with React, Vue, Svelte, or vanilla JS/TS
- π± Modern Bundling - ESM-first with automatic code splitting
- π οΈ Smart Package Manager Detection - Auto-detects npm, pnpm, yarn, or bun
π¦ Installation
# npm
npm install -D pyrajs-cli
# pnpm
pnpm add -D pyrajs-cli
# yarn
yarn add -D pyrajs-cli
# bun
bun add -D pyrajs-cliπ Quick Start
Create a New Project
# Auto-detects your package manager
npx pyrajs-cli create my-app
# Or specify package manager
npx pyrajs-cli create my-app --pm pnpm
# Or use a template
npx pyrajs-cli init my-app --template reactUse in Existing Project
# Install
npm install -D pyrajs-cli
# Add scripts to package.json
{
"scripts": {
"dev": "pyra dev",
"build": "pyra build"
}
}
# Start developing
npm run devπ Usage
Development Server
# Start dev server (default: http://localhost:3000)
pyra dev
# Custom port
pyra dev --port 8080
# Open browser automatically
pyra dev --openProduction Build
# Build for production
pyra build
# Custom output directory
pyra build --out-dir build
# With sourcemaps
pyra build --sourcemapCreate Projects
# Simple setup (recommended for quick start)
pyra create my-app
# Template-based setup (for frameworks)
pyra init my-react-app --template react --language typescript
# Skip dependency installation
pyra create my-app --skip-install
# Force specific package manager
pyra create my-app --pm yarnβοΈ Configuration
Create a pyra.config.js or pyra.config.ts in your project root:
import { defineConfig } from 'pyrajs-cli';
export default defineConfig({
// Entry point (default: 'src/index.ts')
entry: 'src/main.ts',
// Output directory (default: 'dist')
outDir: 'build',
// Dev server configuration
server: {
port: 3000,
open: true,
hmr: true,
},
// Build configuration
build: {
sourcemap: true,
minify: true,
target: 'es2020',
},
// Path aliases
resolve: {
alias: {
'@': './src',
'@components': './src/components',
},
},
});π― Zero Config
Pyra works out of the box with sensible defaults:
- Entry:
src/index.tsorsrc/index.js - Output:
dist/ - Port:
3000 - HMR: Enabled
- TypeScript: Auto-detected and supported
π Package Manager Detection
Pyra automatically detects your preferred package manager:
- Lockfiles - Checks for
pnpm-lock.yaml,yarn.lock,bun.lockb,package-lock.json - Environment - Reads
npm_config_user_agent - PATH - Detects available package managers
- Override - Use
--pm <npm|pnpm|yarn|bun>to force a specific manager
ποΈ Project Structure
A typical Pyra project:
my-app/
βββ src/
β βββ index.ts # Your application entry
βββ index.html # HTML entry point
βββ pyra.config.js # Configuration (optional)
βββ package.json
βββ tsconfig.json # TypeScript config (optional)π Examples
React Project
// pyra.config.ts
import { defineConfig } from 'pyrajs-cli';
export default defineConfig({
entry: 'src/main.tsx',
framework: {
name: 'react',
options: {
refresh: true, // Fast Refresh
},
},
resolve: {
alias: {
'@': './src',
},
},
});Multi-Page Application
export default defineConfig({
entry: {
main: 'src/main.ts',
admin: 'src/admin.ts',
},
build: {
splitting: true,
},
});Library/Package
export default defineConfig({
entry: 'src/index.ts',
build: {
external: ['react', 'react-dom'],
splitting: false,
sourcemap: 'external',
},
});π¨ Framework Support
Pyra supports all major frameworks:
- β React - With Fast Refresh
- β Vue - Full SFC support
- β Svelte - With HMR
- β Preact - Optimized builds
- β Solid - Modern reactive UI
- β Vanilla - No framework needed
π¦ API
defineConfig(config)
Type-safe configuration helper:
import { defineConfig } from 'pyrajs-cli';
export default defineConfig({
// Your config with full TypeScript autocomplete
});Available Types
import type {
PyraConfig,
PyraPlugin,
DevServerConfig,
BuildConfig,
} from 'pyrajs-cli';π€ Contributing
Contributions are welcome! Please check out our GitHub repository.
π License
MIT Β© Nathaniel Paz
π Links
β‘ Philosophy
"Speed creates flow, and flow creates creativity."
Pyra is built on the principle that developer tools should be fast, simple, and get out of your way. We believe that instant feedback and zero configuration enable developers to focus on what matters: building great products.
Made with π₯ by the Pyra team
