@fsco/autosync
v0.3.1
Published
FSCO AutoSync CLI Tool
Readme
🚀 Features
- 📦 File Synchronization — Sync files between folders with intelligent change detection
- 📋 OpenAPI Schema to TypeScript — Generate DTOs/clients from
.yamlor.json - 🔄 Real-time File Watching — Automatic sync on file changes
- 🚀 Fast Generation — Native Bun generator + OpenAPI generator fallback
- 📦 Schema Bundling — Automatic Redocly bundling to resolve
$refissues - 🐳 Docker Support — Containerized development environment
- 📊 Progress Tracking — Real-time progress with detailed logging
- 🔧 Configurable — Flexible configuration with JSON/YAML support
Schema Bundling with Redocly
The AutoSync CLI automatically bundles OpenAPI schemas using @redocly/cli before passing them to the OpenAPI generator. This resolves common $ref issues that can cause generation failures.
How it works:
- Automatic Bundling: When using the OpenAPI generator, schemas are automatically bundled using
redocly bundle - Flattened Output: All
$refreferences are resolved into a single, flat schema file - Fallback Support: If bundling fails, the original schema file is used as fallback
- Transparent: Works automatically without any user configuration needed
📦 Installation
# Recommended
bunx @fsco/autosync init
# Or globally
bun add -g @fsco/autosyncNPM/Yarn supported too:
npm install -g @fsco/autosync
npx @fsco/autosync init⚡ Quick Start
# 1. Init config
fsco-autosync init
# 2. Start watch mode
fsco-autosync watch
# 3. Run one-time sync
fsco-autosync sync🔧 Configuration (autosync.json)
{
"exclude": ["*.test.*", "node_modules"],
"folders": [
{
"path": "./shared",
"syncTo": ["./app1/shared", "./app2/shared"]
}
],
"schemas": [
{
"path": "./schema",
"exportTo": ["./models"],
"generator": {
"type": "typescript-fetch",
"engine": "bun"
}
}
]
}Supported Keys
| Key | Description |
|-------------|----------------------------------------------|
| folders | Sync source → target folders |
| schemas | Auto-generate TS models from OpenAPI |
| exclude | Global and per-folder exclude patterns |
| generator | Choose "bun" or "openapi" engines |
📚 Commands
| Command | Description |
|-------------------------|------------------------------------------|
| fsco-autosync init | Create config file interactively |
| fsco-autosync watch | Watch & sync files + generate schemas |
| fsco-autosync sync | One-time sync/generation |
| fsco-autosync stop | Stop Docker-based watcher |
🧪 Examples
Basic Folder Sync
{
"folders": [
{
"path": "./shared/components",
"syncTo": ["./frontend/src", "./backend/src"]
}
]
}OpenAPI to TypeScript Models
{
"schemas": [
{
"path": "./api-specs",
"exportTo": ["./models"],
"generator": {
"type": "typescript-fetch",
"engine": "bun"
}
}
]
}🐳 Docker Support
Watch mode uses a bundled Docker image (with Java + OpenAPI CLI). No extra install required:
fsco-autosync watch