npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@context-action/typedoc-vitepress-sync

v0.8.4

Published

Enhanced TypeDoc to VitePress documentation sync with smart caching, parallel processing, and quality validation

Downloads

23

Readme

@context-action/typedoc-vitepress-sync

Enhanced TypeDoc to VitePress documentation sync with smart caching, parallel processing, and quality validation.

npm version License: MIT

🚀 Features

  • 🔥 Smart Caching: SHA256 hash-based file change detection with 24-hour TTL
  • ⚡ Parallel Processing: Configurable batch processing for improved performance
  • 🛡️ Error Recovery: Strategic error handling with automatic recovery
  • ✨ Quality Validation: Markdown syntax, link integrity, and accessibility checks
  • 📊 Comprehensive Metrics: Detailed performance and quality reporting
  • 🎨 Vue Compatibility: Automatic VitePress/Vue template processing
  • 🔧 CLI Interface: Full-featured command-line tool
  • 📱 Responsive Design: Works with modern documentation workflows

📦 Installation

As a standalone package

npm install @context-action/typedoc-vitepress-sync
# or
yarn add @context-action/typedoc-vitepress-sync
# or
pnpm add @context-action/typedoc-vitepress-sync

Global installation

npm install -g @context-action/typedoc-vitepress-sync

🔧 Quick Start

CLI Usage

# Initialize configuration
npx typedoc-vitepress-sync init

# Sync documentation
npx typedoc-vitepress-sync sync --source ./docs/api/generated --target ./docs/en/api

# With custom configuration
npx typedoc-vitepress-sync sync --config ./sync.config.js

# Clean cache and generated files
npx typedoc-vitepress-sync clean

Programmatic Usage

import { TypeDocVitePressSync } from '@context-action/typedoc-vitepress-sync'

const sync = new TypeDocVitePressSync({
  sourceDir: './docs/api/generated',
  targetDir: './docs/en/api',
  packageMapping: {
    'core': 'core',
    'react': 'react'
  }
})

// Auto-optimize based on system resources
sync.autoOptimize()

// Perform sync
const result = await sync.sync()

console.log(`Processed ${result.filesProcessed} files in ${result.processingTime}ms`)
console.log(`Cache hit rate: ${result.cache.hitRate}`)

⚙️ Configuration

Configuration File

Create typedoc-vitepress-sync.config.js:

export default {
  sourceDir: './docs/api/generated',
  targetDir: './docs/en/api',
  sidebarConfigPath: './docs/.vitepress/config/api-spec.ts',
  packageMapping: {
    'core': 'core',
    'react': 'react',
    'utils': 'utilities'
  },
  cache: {
    enabled: true,
    dir: './.typedoc-vitepress-cache',
    ttl: 24 * 60 * 60 * 1000, // 24 hours
    hashAlgorithm: 'sha256'
  },
  parallel: {
    enabled: true,
    maxWorkers: 4,
    batchSize: 10
  },
  quality: {
    validateLinks: true,
    validateMarkdown: true,
    checkAccessibility: true
  },
  metrics: {
    enabled: true,
    outputFile: './reports/sync-metrics.json'
  }
}

Configuration Options

| Option | Type | Default | Description | |--------|------|---------|-------------| | sourceDir | string | Required | Source directory containing TypeDoc output | | targetDir | string | Required | Target directory for VitePress docs | | sidebarConfigPath | string | ./docs/.vitepress/config/api-spec.ts | Output path for sidebar configuration | | packageMapping | Record<string, string> | {} | Map source packages to target directories | | cache.enabled | boolean | true | Enable caching system | | cache.dir | string | ./.typedoc-vitepress-cache | Cache directory path | | cache.ttl | number | 86400000 | Cache TTL in milliseconds (24h) | | parallel.enabled | boolean | true | Enable parallel processing | | parallel.maxWorkers | number | 4 | Maximum worker threads | | parallel.batchSize | number | 10 | Files per batch | | quality.validateLinks | boolean | true | Validate internal links | | quality.validateMarkdown | boolean | true | Validate markdown syntax | | quality.checkAccessibility | boolean | true | Check accessibility compliance | | metrics.enabled | boolean | true | Enable metrics collection | | metrics.outputFile | string | ./reports/metrics.json | Metrics output file |

🎯 CLI Commands

Main Commands

# Sync documentation
typedoc-vitepress-sync sync [options]

# Clean cache and generated files  
typedoc-vitepress-sync clean [options]

# Initialize configuration
typedoc-vitepress-sync init [options]

Cache Management

# Show cache statistics
typedoc-vitepress-sync cache stats

# Clear cache
typedoc-vitepress-sync cache clear

CLI Options

| Option | Description | |--------|-------------| | -c, --config <path> | Configuration file path | | -s, --source <dir> | Source directory override | | -t, --target <dir> | Target directory override | | --sidebar <path> | Sidebar config output path | | --no-cache | Disable caching | | --no-parallel | Disable parallel processing | | --no-quality | Disable quality validation | | --no-metrics | Disable metrics collection | | -v, --verbose | Enable verbose logging | | --force | Force process all files | | --dry-run | Show what would be done |

📊 Performance

Benchmarks

| Scenario | Files | First Run | Cached Run | Improvement | |----------|-------|-----------|------------|-------------| | Small Project | 20 files | 150ms | 50ms | 67% faster | | Medium Project | 76 files | 300ms | 100ms | 67% faster | | Large Project | 200+ files | 800ms | 250ms | 69% faster |

Cache Performance

  • Hit Rate: 95-100% on unchanged files
  • Hash Algorithm: SHA256 for accurate change detection
  • Storage: Efficient JSON manifest with file metadata
  • TTL: Configurable expiration (default 24h)

🔍 Quality Validation

Markdown Validation

  • Detects undefined template values
  • Validates code block syntax
  • Checks for unclosed markdown syntax
  • Identifies malformed tables
  • Reports overly long lines

Link Validation

  • Validates internal link integrity
  • Checks for broken file references
  • Detects empty link text
  • Supports relative and absolute paths
  • Ignores external URLs and anchors

Accessibility Validation

  • Ensures images have alt text
  • Validates heading hierarchy
  • Checks list formatting
  • Verifies table structure
  • Reports accessibility issues

📈 Metrics & Monitoring

Automatic Metrics Collection

{
  "filesProcessed": 76,
  "filesSkipped": 0,
  "processingTime": 1250,
  "cache": {
    "hits": 72,
    "misses": 4,
    "hitRate": "94.74%"
  },
  "quality": {
    "totalIssues": 2,
    "files": [...]
  },
  "performance": {
    "filesPerSecond": "60.8",
    "averageTimePerFile": "16.45ms",
    "cacheEfficiency": "excellent"
  }
}

Console Output

============================================================
✅ TypeDoc VitePress Sync Complete!
============================================================
📄 Files processed: 76
⏭️  Files skipped: 72 (cache hits)  
⏱️  Processing time: 1.25s

📊 Cache Statistics:
  - Hit rate: 94.74%
  - Hits: 72
  - Misses: 4

⚡ Performance: Excellent

🛠️ Advanced Usage

Event-Driven Processing

const sync = new TypeDocVitePressSync(config)

sync.on('start', (config) => {
  console.log('Sync starting with config:', config)
})

sync.on('fileComplete', (filePath, result) => {
  if (result.cached) {
    console.log(`Cache hit: ${filePath}`)
  } else {
    console.log(`Processed: ${filePath}`)
  }
})

sync.on('complete', (result) => {
  console.log(`Sync completed: ${result.filesProcessed} files`)
})

await sync.sync()

Custom Validation

import { QualityValidator } from '@context-action/typedoc-vitepress-sync'

const validator = new QualityValidator({
  validateMarkdown: true,
  validateLinks: true,
  checkAccessibility: true
})

const issues = await validator.validateFile('./docs/api.md')
if (issues) {
  console.log('Quality issues found:', issues.issues)
}

Cache Management

import { CacheManager } from '@context-action/typedoc-vitepress-sync'

const cache = new CacheManager({
  enabled: true,
  dir: './custom-cache',
  ttl: 60 * 60 * 1000 // 1 hour
})

await cache.initialize()

// Check if file needs processing
const shouldProcess = cache.shouldProcess('source.md', 'target.md')

// Update cache after processing
cache.updateCache('source.md', 'target.md')

// Get statistics
const stats = cache.getStats()
console.log(`Cache hit rate: ${stats.hitRate}`)

🔌 Integration

Package.json Scripts

{
  "scripts": {
    "docs:sync": "typedoc-vitepress-sync sync",
    "docs:clean": "typedoc-vitepress-sync clean",
    "docs:build": "typedoc && npm run docs:sync && vitepress build docs",
    "docs:dev": "vitepress dev docs"
  }
}

GitHub Actions

name: Documentation

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]

jobs:
  docs:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      
      - name: Setup Node.js
        uses: actions/setup-node@v3
        with:
          node-version: '18'
          
      - name: Install dependencies
        run: npm ci
        
      - name: Generate TypeDoc
        run: npm run docs:api
        
      - name: Sync to VitePress
        run: npx typedoc-vitepress-sync sync --verbose
        
      - name: Build documentation
        run: npm run docs:build

VitePress Integration

The generated sidebar configuration can be imported directly:

// docs/.vitepress/config.ts
import { defineConfig } from 'vitepress'
import { sidebarApiEn } from './config/api-spec'

export default defineConfig({
  themeConfig: {
    sidebar: {
      '/en/api/': sidebarApiEn(),
      // ... other sidebar configs
    }
  }
})

🤝 Contributing

Contributions are welcome! Please read our Contributing Guide for details.

Development Setup

# Clone repository
git clone https://github.com/mineclover/context-action.git
cd context-action/packages/typedoc-vitepress-sync

# Install dependencies
pnpm install

# Build package
pnpm build

# Run tests
pnpm test

# Run tests with coverage
pnpm test:coverage

📄 License

MIT © mineclover

🔗 Related


Made with ❤️ for the TypeScript documentation community