Skip to content

Create sandbox package for testing w3ux library components from source#307

Draft
Copilot wants to merge 4 commits intomainfrom
copilot/fix-306
Draft

Create sandbox package for testing w3ux library components from source#307
Copilot wants to merge 4 commits intomainfrom
copilot/fix-306

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jun 28, 2025

This PR implements a new sandbox package that enables real-time testing of w3ux library components and utilities directly from their source files without requiring compilation or publishing to npm.

What's Added

🏗️ Sandbox Package Structure

  • Vite + React + TypeScript: Modern development environment with hot module replacement
  • Workspace Integration: Added to pnpm workspace configuration for seamless monorepo integration
  • Source-only Imports: Direct path mappings to library source files (../library/*/src)

🔧 Configuration

  • TypeScript Path Mappings: All @w3ux/* packages mapped to their source directories
  • Vite Alias Resolution: Configured to resolve library imports at build time
  • ESLint Integration: Properly excluded from main workspace linting to avoid conflicts

📦 Library Integration

The sandbox demonstrates importing and using multiple w3ux packages:

  • @w3ux/react-polkicon - Polkadot identicon component
  • @w3ux/react-odometer - Animated number display
  • @w3ux/utils - Utility functions (address validation, unit conversion, ellipsis formatting)
  • @w3ux/hooks - React hooks (useTimeLeft countdown)
  • @w3ux/types - TypeScript type definitions

🎯 Usage

# Start development server
cd sandbox && pnpm run dev

# Build for production
pnpm run build

# Lint sandbox code
pnpm run lint

Benefits

  • 🚀 Fast Development: Test library changes instantly without compilation
  • 🔄 Hot Reload: Changes to library source files trigger immediate updates
  • 🧪 Integration Testing: Test multiple packages working together
  • 🔒 Type Safety: Full TypeScript support with proper path resolution
  • 📝 Documentation: Comprehensive README with usage examples

Example Usage

import { Polkicon } from '@w3ux/react-polkicon'
import { isValidAddress } from '@w3ux/utils'
import { useTimeLeft } from '@w3ux/hooks'

function TestComponent() {
  const address = '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY'
  const { timeleft } = useTimeLeft()
  
  return (
    <div>
      <Polkicon address={address} />
      <p>Valid: {isValidAddress(address) ? 'Yes' : 'No'}</p>
      <p>Time: {timeleft.raw.minutes}m {timeleft.raw.seconds}s</p>
    </div>
  )
}

This enables testing observables and react-connect-kit modules directly within w3ux as requested, providing a robust development environment for library integration testing.

Fixes #306.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits June 28, 2025 08:06
Co-authored-by: rossbulat <13929023+rossbulat@users.noreply.github.com>
Co-authored-by: rossbulat <13929023+rossbulat@users.noreply.github.com>
Copilot AI changed the title [WIP] Create sandbox package that tests w3ux library Create sandbox package for testing w3ux library components from source Jun 28, 2025
Copilot AI requested a review from rossbulat June 28, 2025 08:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create sandbox package that tests w3ux library

2 participants