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 🙏

© 2025 – Pkg Stats / Ryan Hefner

ajr-sync

v1.1.0

Published

File sync watcher for Termux with single sync command and bidirectional package.json sync

Readme

# AJR Sync - File Sync Watcher for Termux

![badge](https://img.shields.io/badge/version-1.1.0-blue.svg)
![badge](https://img.shields.io/badge/node-%3E%3D14.0.0-green.svg)
![badge](https://img.shields.io/badge/platform-termux-orange.svg)

Un watcher de archivos inteligente que sincroniza cambios en tiempo real usando rsync, diseñado específicamente para Termux. Perfecto para desarrolladores que trabajan en proyectos entre el almacenamiento interno y Termux.

## 🚀 Características

- 🔄 **Sincronización en tiempo real** - Detecta cambios automáticamente
- ⚡ **Sync único rápido** - Comando directo para sincronización inmediata
- 🎯 **Configurable** - Adaptable a cualquier proyecto
- 🚫 **Exclusiones inteligentes** - Ignora node_modules, .git, etc.
- 📱 **Diseñado para Termux** - Funciona perfectamente en Android
- 🛡️ **Manejo de errores** - Reintentos automáticos y recuperación
- 📊 **Logs detallados** - Información clara del proceso
- 🔄 **Sync bidireccional** - Sincroniza package.json en ambas direcciones

## 📦 Instalación

```bash
# Instalar desde npm
npm install -g ajr-sync

# O instalar localmente en tu proyecto
npm install ajr-sync --save-dev

🛠️ Configuración Rápida

  1. Inicializar configuración
# En la raíz de tu proyecto
ajr-sync init

Esto creará un archivo .ajr-sync/settings.json con la configuración básica.

  1. Editar configuración

Abre el archivo .ajr-sync/settings.json y configura tus rutas:

{
  "dirs": {
    "origin": "/storage/emulated/0/www/mi-proyecto/",
    "destiny": "~/mi-proyecto/"
  },
  "excludes": [".next", ".git", "node_modules", ".DS_Store", "*.tmp", "*.log"],
  "flags": ["a", "v"],
  "debounceTime": 2000
}
  1. Usar los comandos
# Sincronización única rápida
ajr-sync sync

# Modo watcher continuo
ajr-sync watch

# Dry-run (ver qué se sincronizaría)
ajr-sync sync --dry-run

⚙️ Configuración Detallada

Estructura del archivo de configuración

{
  "dirs": {
    "origin": "/ruta/origen/",
    "destiny": "/ruta/destino/"
  },
  "excludes": [
    ".next",
    ".git", 
    "node_modules",
    ".DS_Store",
    "*.tmp",
    "*.log"
  ],
  "flags": ["a", "v"],
  "debounceTime": 2000,
  "maxRetries": 5,
  "retryDelay": 5000,
  "healthCheckInterval": 30000
}

Propiedades de configuración

| Propiedad | Tipo | Requerido | Descripción | |:---------:|:----:|:---------:|:-----------:| | dirs.origin | string | ✅ | Ruta de origen a monitorear | | dirs.destiny | string | ✅ | Ruta de destino para sincronizar | | excludes | array | ❌ | Patrones de archivos/directorios a excluir | | flags | array | ❌ | Flags de rsync (por defecto: ["a", "v"]) | | debounceTime | number | ❌ | Tiempo de espera antes de sincronizar (ms) | | maxRetries | number | ❌ | Máximo de reintentos en caso de error | | retryDelay | number | ❌ | Tiempo entre reintentos (ms) | | healthCheckInterval | number | ❌ | Intervalo de health checks (ms) |

Rutas comunes en Termux

Origen (almacenamiento interno):

/storage/emulated/0/www/tu-proyecto/
/storage/emulated/0/Documents/proyectos/
/storage/emulated/0/Download/dev/

Destino (Termux home):

~/tu-proyecto/                 # Se expande a: /data/data/com.termux/files/home/tu-proyecto/
/data/data/com.termux/files/home/tu-proyecto/

🎯 Uso Avanzado

Comandos disponibles

# Inicializar configuración
ajr-sync init

# Sincronización única rápida
ajr-sync sync

# Sincronización con dry-run
ajr-sync sync --dry-run
ajr-sync sync -d

# Iniciar watcher con configuración por defecto
ajr-sync watch

# Usar archivo de configuración personalizado
ajr-sync watch --config ./config/sync.json
ajr-sync sync --config ./custom-config.json

# Ver ayuda
ajr-sync --help

Flags de rsync comunes

| Flag | Descripción | |:----:|:-----------:| | a | Modo archivo (preserva permisos, timestamps) | | v | Modo verbose (muestra detalles) | | delete | Elimina archivos en destino que no existen en origen | | z | Compresión durante transferencia | | progress | Muestra progreso de transferencia |

Ejemplo de configuración para React/Next.js

{
  "dirs": {
    "origin": "/storage/emulated/0/www/mi-app/",
    "destiny": "~/mi-app/"
  },
  "excludes": [
    ".next",
    ".git",
    "node_modules",
    ".DS_Store",
    "*.tmp",
    "*.log",
    "next-env.d.ts",
    "yarn-error.log"
  ],
  "flags": ["a", "v"],
  "debounceTime": 1500
}

📋 Flujo de Trabajo Recomendado

Opción 1: Desarrollo con Sync Único (Rápido)

# 1. Sincronizar cambios manualmente cuando necesites
ajr-sync sync

# 2. Ejecutar comandos en Termux
cd ~/mi-proyecto
npm run dev

Opción 2: Desarrollo con Watcher (Automático)

# 1. Iniciar watcher en una terminal
ajr-sync watch

# 2. En otra terminal, trabajar en el proyecto
cd ~/mi-proyecto
npm run dev

Ejemplo práctico completo:

# 1. En la raíz de tu proyecto (almacenamiento interno)
ajr-sync init

# 2. Editar .ajr-sync/settings.json con tus rutas

# 3. Sincronizar por primera vez
ajr-sync sync

# 4. En Termux, ir al directorio destino y instalar dependencias
cd ~/mi-proyecto
npm install

# 5. Usar sync para cambios futuros o iniciar watcher
ajr-sync sync
# O
ajr-sync watch

🔄 Sync Bidireccional de Package.json

AJR Sync monitorea automáticamente cambios en package.json, package-lock.json y yarn.lock en el directorio destino y los sincroniza de vuelta al origen. Perfecto para cuando instalas dependencias en Termux.

🐛 Solución de Problemas

Error: "Config file not found"

# Asegúrate de haber ejecutado:
ajr-sync init

Error: "Permission denied"

# Dar permisos de almacenamiento a Termux
termux-setup-storage

Error: "rsync command not found"

# Instalar rsync en Termux
pkg install rsync

El watcher no detecta cambios

· Verifica que las rutas en la configuración sean correctas · Asegúrate de que Termux tiene permisos de almacenamiento · Revisa que el directorio origen existe

Los archivos no se sincronizan

· Verifica los flags de rsync en la configuración · Revisa los excludes - quizás estás excluyendo archivos importantes · Aumenta el debounceTime si hay muchos archivos

🔧 Desarrollo

Estructura del proyecto

ajr-sync/
├── bin/
│   └── ajr-sync.js          # Punto de entrada CLI
├── lib/
│   ├── watcher.js           # Lógica principal del watcher
│   ├── sync-manager.js      # Manejo de sync bidireccional
│   ├── config.js            # Manejo de configuración
│   └── utils.js             # Utilidades y helpers
└── package.json

Instalación desde fuente

git clone <repository>
cd ajr-sync
npm install
npm link  # Para uso global

📝 Licencia

MIT License - ver archivo LICENSE para detalles.

🤝 Contribuciones

¡Las contribuciones son bienvenidas! Por favor:

  1. Fork el proyecto
  2. Crea una rama para tu feature (git checkout -b feature/AmazingFeature)
  3. Commit tus cambios (git commit -m 'Add some AmazingFeature')
  4. Push a la rama (git push origin feature/AmazingFeature)
  5. Abre un Pull Request

⚠️ Notas Importantes

· Requiere Termux con permisos de almacenamiento · Rsync debe estar instalado en Termux · Las rutas son case-sensitive · Usa trailing slash (/) en rutas de directorios para mejor comportamiento de rsync · El comando sync es más rápido que watch para sincronizaciones únicas


¿Problemas? Abre un issue en GitHub con los detalles de tu configuración y el error que estás experimentando.