@lopin6farrier/envsync
v0.1.0
Published
Sync development environments for Angular teams
Maintainers
Readme
EnvSync CLI
Development environment synchronization tool for Angular teams
EnvSync is a command-line tool that helps Angular development teams maintain consistent development environments across all team members. It manages Node.js versions, package managers, global dependencies, and VSCode extensions through a simple configuration file.
Features
- 🚀 Automatic Detection: Detects Angular project configuration automatically
- 🔄 Environment Sync: Synchronizes Node.js versions, package managers, and dependencies
- 📦 NVM Integration: Automatically manages Node.js versions using nvm
- 🔧 Global Dependencies: Manages global npm packages like Angular CLI
- 💻 VSCode Extensions: Auto-installs recommended VSCode extensions
- ✅ Health Checks: Validates environment setup with
envsync try - 🔍 Diff View: Compare expected vs actual environment configuration
- 🧹 Clean Command: Clean and reset project dependencies
Installation
npm install -g @lopin6farrier/envsyncQuick Start
1. Initialize in your Angular project
cd your-angular-project
envsync initThis creates an envsync.yaml file with your project's environment requirements.
2. Share with team
Commit the envsync.yaml file to version control:
git add envsync.yaml
git commit -m "Add EnvSync configuration"
git push3. Team members sync their environment
Team members clone the repo and run:
envsync syncEnvSync will automatically:
- Install or switch to the correct Node.js version (via nvm)
- Install the correct package manager
- Install required global dependencies
- Install recommended VSCode extensions
- Run post-sync scripts (like
npm install)
Commands
envsync init
Initialize EnvSync in your Angular project. Detects project configuration and creates envsync.yaml.
Options:
-f, --force- Overwrite existing envsync.yaml
Example:
envsync init
envsync init --forceenvsync sync
Synchronize your environment to match the project requirements defined in envsync.yaml.
Options:
-y, --yes- Skip confirmation prompts
Example:
envsync sync
envsync sync -yenvsync try (alias: check, doctor, status)
Check the health of your development environment and display a health score.
Example:
envsync try
envsync doctorenvsync diff
Show differences between expected and current environment configuration.
Example:
envsync diffenvsync update
Update envsync.yaml to match your current project versions (useful after upgrading Angular).
Options:
-y, --yes- Skip confirmations and auto-sync
Example:
envsync update
envsync update -yenvsync clean
Clean node_modules and lockfiles, then optionally reinstall dependencies.
Options:
-y, --yes- Skip confirmations-a, --all- Also remove build cache and dist folder
Example:
envsync clean
envsync clean -y --allConfiguration File
The envsync.yaml file defines your project's environment requirements:
project:
name: my-angular-app
type: angular
angularVersion: "17.1.0"
runtime:
node: "20.11.1"
packageManager: "pnpm@latest"
dependencies:
global:
- "@angular/[email protected]"
- "nx@latest"
extensions:
vscode:
- "angular.ng-template"
- "johnpapa.angular2"
- "esbenp.prettier-vscode"
- "dbaeumer.vscode-eslint"
- "cyrilletuzi.angular-schematics"
scripts:
pre-sync: []
post-sync:
- "pnpm install"
- "npx husky install"Configuration Options
project
name: Project nametype: Project type (currently onlyangularis supported)angularVersion: Angular version
runtime
node: Required Node.js version (e.g.,"20.11.1")packageManager: Package manager and version (e.g.,"pnpm@latest","npm","yarn")
dependencies
global: Array of global npm packages to install (e.g.,"@angular/[email protected]")
extensions (optional)
vscode: Array of VSCode extension IDs to install
scripts (optional)
pre-sync: Commands to run before sync startspost-sync: Commands to run after sync completes
Requirements
- Node.js: Any version (EnvSync will manage the correct version via nvm)
- nvm: Recommended for managing Node.js versions
- Windows: nvm-windows
- Mac/Linux: nvm
Use Cases
New Team Member Onboarding
git clone <repo>
cd <repo>
npm install -g @lopin6farrier/envsync
envsync syncEnvSync sets up their complete development environment in one command.
Upgrading Angular Version
After upgrading Angular in your project:
envsync updateThis updates your envsync.yaml to match the new versions, and you can commit it so the team can sync.
Troubleshooting Environment Issues
envsync doctorShows what's missing or misconfigured in your environment with a health score.
Starting Fresh
envsync clean -y --all
envsync syncCompletely resets your project dependencies and rebuilds the environment.
Global Options
--verbose- Enable verbose logging--no-color- Disable colored output-v, --version- Output the current version-h, --help- Display help information
Angular Version Support
EnvSync automatically recommends the correct Node.js version based on your Angular version:
| Angular Version | Node.js Version | |----------------|-----------------| | 18.x | 20.11.1 | | 17.x | 20.11.1 | | 16.x | 18.19.0 | | 15.x | 18.13.0 | | 14.x | 16.20.0 | | 13.x | 16.20.0 |
How It Works
- Detection: EnvSync detects your Angular project by looking for
angular.jsonor@angular/coreinpackage.json - Analysis: Analyzes project dependencies, Angular version, and package manager
- Configuration: Generates or reads
envsync.yamlwith environment requirements - Synchronization: Automatically installs/switches to required tools and versions
- Validation: Verifies the environment is correctly configured
Troubleshooting
nvm not found
If EnvSync can't find nvm, install it:
- Windows: Download from nvm-windows releases
- Mac/Linux: Run
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
VSCode extensions not installing
Make sure the VSCode CLI is installed:
- Open VSCode
- Press
Ctrl+Shift+P(orCmd+Shift+Pon Mac) - Type "Shell Command: Install 'code' command in PATH"
- Select it and restart your terminal
Permission errors
On Unix systems, you may need to use sudo for global package installations, or configure npm to use a different directory:
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc
source ~/.bashrcExamples
Basic Angular Project
# Create new Angular project
ng new my-app
cd my-app
# Initialize EnvSync
envsync init
# View configuration
cat envsync.yaml
# Check environment health
envsync tryNx Monorepo
EnvSync automatically detects Nx and adds it to global dependencies:
envsync init
# Detects Nx and adds 'nx@latest' to global dependenciesCustom Package Manager
# Use pnpm
envsync init
# Select 'pnpm' when prompted
# envsync.yaml will have: packageManager: "pnpm@latest"Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
MIT
Author
Vinicio
Links
Related Projects
- nvm - Node Version Manager for Unix
- nvm-windows - Node Version Manager for Windows
- Angular CLI - Angular Command Line Interface
Made with ❤️ for Angular teams
