web-sync-watcher
v1.0.0
Published
Real-time file synchronization tool for WEB projects with locale directory support
Maintainers
Readme
WEB Sync Watcher
Real-time file synchronization tool for WEB projects with locale directory support.
Features
- 🔄 Real-time sync: Watches for file changes and syncs automatically
- 🗺️ Locale support: Automatically moves files to
[locale]directories - ⚡ Fast: Efficient file copying with intelligent diff handling
- 📊 Detailed stats: Shows synchronization timing and performance metrics
- 🔧 Configurable: Customizable paths and exclusion rules
- ✅ Verification: Validates that files are in correct locations
Installation
npm install -g web-sync-watcher
# or
yarn global add web-sync-watcherFor local installation in a project:
npm install --save-dev web-sync-watcher
# or
yarn add -D web-sync-watcherQuick Start
# Start the watcher with default paths
web-sync start
# Start with custom paths
web-sync start \
--source-dir ../my-web \
--temp-dir ../my-temp \
--diff-dir ../my-diff
# Initialize sync once (without watcher)
web-sync init
# Verify sync results
web-sync verifyDefault Directory Structure
../.langfuse-3.71.0/ # Source directory (original Langfuse code)
../.temp/ # Temporary directory (built code)
../web_update/ # Diff directory (modified files)Commands
start
Start the real-time synchronization watcher.
Options:
--source-dir: Source directory path (default:../.langfuse-3.71.0)--temp-dir: Temporary directory path (default:../.temp)--diff-dir: Diff directory path (default:../web_update)--skip-dirs: Comma-separated directories to skip--exclude-move-dirs: Directories to exclude from locale move--exclude-move-files: Files to exclude from locale move--quiet: Reduce console output--verbose: Increase console output
init
Initialize sync once (without starting watcher).
Options:
--source-dir: Source directory path--temp-dir: Temporary directory path--diff-dir: Diff directory path
verify
Verify the sync result.
Options:
--temp-dir: Temporary directory path
API Usage
You can also use the module programmatically:
const { start } = require('web-sync-watcher');
start({
sourceDir: '../.langfuse-3.71.0',
tempDir: '../.temp',
diffDir: '../web_update',
skipDirs: ['node_modules', '.git'],
excludeMoveDirs: ['/api'],
excludeMoveFiles: ['_app.tsx'],
quiet: false,
verbose: true
});Locale Directory Logic
The tool automatically handles file movement to [locale] directories:
/web/src/app/layout.tsx→/web/src/app/[locale]/layout.tsx/web/src/pages/*→/web/src/pages/[locale]/*(excluding/apiand_app.tsx)
Skipped Directories
By default, these directories are skipped:
node_modules,.git,.vscode,.ideadist,build,coverage.next,.nuxt,.temp
Requirements
- Node.js >= 14.0.0
- npm or yarn
License
MIT
