Skip to content

Sunny-117/outilx

Repository files navigation

Outilx Logo

Outilx

A modern, modular utility library collection for JavaScript/TypeScript

Outilx is a monorepo of high-quality, well-tested utility libraries designed to simplify common development tasks across different JavaScript environments.

📦 Packages

Package Description Version
@outilx/core Core utilities for any runtime (Node.js, Deno, Bun, browsers) npm
@outilx/browser Browser environment utilities (includes @outilx/core) npm
@outilx/node Node.js environment utilities npm
@outilx/react-hooks React Hooks collection npm
@outilx/ai AI utilities for code detection, streaming, and SSE npm

✨ Features

  • 🎯 Modular - Install only what you need
  • 📦 Tree-shakeable - Optimized bundle sizes
  • 🔷 TypeScript - Full type definitions included
  • Modern - Built with latest JavaScript features
  • 🧪 Well-tested - Comprehensive test coverage
  • 📚 Well-documented - Detailed API documentation

🚀 Quick Start

Choose the package that fits your needs:

# Core utilities (works in any JS runtime)
npm install @outilx/core

# Browser utilities (includes core)
npm install @outilx/browser

# Node.js utilities
npm install @outilx/node

# React Hooks
npm install @outilx/react-hooks

# AI utilities
npm install @outilx/ai

Usage Examples

// @outilx/core - Array, JSON, cache, async utilities (works everywhere)
import { toArray, parseJsonWithFallback, MemoryCache, TipCache, createAsyncProcessor } from '@outilx/core';

const arr = toArray(1); // [1]
const cache = new TipCache(100);
const memCache = new MemoryCache();

// @outilx/browser - Browser-specific utilities + all core exports
import { LocalStorageCache, toArray } from '@outilx/browser';

const browserCache = new LocalStorageCache('my-app');

// @outilx/node - File operations, directory management
import { ensureDirExists, deleteEmptyDirs, autoPullRepository } from '@outilx/node';

await ensureDirExists('./my-dir');
await deleteEmptyDirs('./my-dir');

// @outilx/react-hooks - State management, async operations, storage
import {
  useArray, useBoolean, useToggle, useCounter,
  useLocalStorageState, useTaskPendingState
} from '@outilx/react-hooks';

function Component() {
  const [items, { push, removeById }] = useArray([]);
  const [visible, { toggle }] = useBoolean(false);
  const [count, { inc, dec }] = useCounter(0);
  const [value, setValue] = useLocalStorageState('key', { defaultValue: '' });
  // ...
}

// @outilx/ai - Code detection, streaming simulation, SSE
import { detectCodeBlocks, useStreamingSimulator, useSSE } from '@outilx/ai';

const blocks = detectCodeBlocks(markdownText);
const { content, startStreaming } = useStreamingSimulator({ chunks, interval: 100 });
const { data, error, isConnected } = useSSE({ url: '/api/events' });

📚 Documentation

Visit our documentation site for:

  • Detailed API references
  • Usage guides and examples
  • Best practices
  • Migration guides

🛠️ Development

# Install dependencies
pnpm install

# Build all packages
pnpm build

# Run tests
pnpm test

# Run playground (interactive demos)
pnpm playground

# Documentation
pnpm docs:dev      # Start dev server
pnpm docs:build    # Build for production

📝 Release

This project uses Changesets for version management:

# Create a changeset
pnpm changeset

# Dry run (test without publishing)
pnpm release:dry

# Publish stable version
pnpm release

# Publish pre-release versions
pnpm release:alpha
pnpm release:beta

🏗️ Architecture

Built with modern tools for optimal developer experience:

  • pnpm workspaces - Efficient package management
  • Turbo - High-performance build system with smart caching
  • Changesets - Streamlined version management and publishing
  • tsdown - Fast TypeScript bundler
  • Vitest - Lightning-fast unit testing
  • VitePress - Modern documentation framework

🤝 Contributing

We welcome contributions! Whether it's:

  • 🐛 Bug reports
  • 💡 Feature requests
  • 📖 Documentation improvements
  • 🔧 Code contributions

Please check our contributing guidelines before submitting.

📄 License

MIT © [Sunny-117]


Made with ❤️ by the Outilx team

Packages

 
 
 

Contributors