Skip to content

Conversation

@PatrickHeneise
Copy link
Member

Summary

Fixes #6 - Changes the behavior from overwriting .env files to intelligently merging them.

What Changed

  • New merge logic: Keys from .env.example now update existing keys in .env while preserving keys that aren't in the example
  • New module: lib/readEnv.js parses existing .env files for merging
  • Comprehensive tests: Added unit and integration tests for merge behavior
  • Documentation: Created CLAUDE.md with architecture details and design decisions
  • Dependency updates: Updated dependencies including security patches

Behavior

  • If .env exists: merges with .env.example, preserving custom keys
  • If .env doesn't exist: creates new file (original behavior)
  • Order: .env.example keys appear first, followed by preserved keys from existing .env

Test Plan

  • All existing tests pass (10/10 tests passing)
  • New tests added for readEnv function
  • Integration tests verify merge behavior:
    • Preserves existing keys not in .env.example
    • Updates existing keys from .env.example
    • Creates new .env if it doesn't exist
  • Manual testing with sample .env files

🤖 Generated with Claude Code

PatrickHeneise and others added 4 commits November 21, 2025 10:30
Changes the behavior from overwriting .env files to intelligently merging them,
preserving existing keys while updating values from .env.example. This prevents
losing custom environment variables when syncing secrets from GCP.

Fixes #6

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Reverts package.json and package-lock.json to main branch versions.
ESLint 9.x upgrade requires config migration which is out of scope for this PR.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Replace map with forEach to avoid unused envArray variable.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@PatrickHeneise PatrickHeneise merged commit 6cbe984 into main Nov 21, 2025
1 check passed
@PatrickHeneise PatrickHeneise deleted the feature/sync-merge-behavior branch November 21, 2025 17:49
@github-actions
Copy link

🎉 This PR is included in version 1.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Synchronize instead of bulk overwrite

2 participants