Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
{
"$schema": "https://unpkg.com/@changesets/config@3.1.1/schema.json",
"changelog": "@changesets/cli/changelog",
"changelog": [
"@svitejs/changesets-changelog-github-compact",
{ "repo": "dak-engineering/synv" }
],
"commit": false,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
"fixed": [],
"linked": []
}
10 changes: 0 additions & 10 deletions .changeset/fix-env-file-write.md

This file was deleted.

25 changes: 25 additions & 0 deletions .changeset/major-release.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
"synv": major
---

Complete rewrite of synv - a tool to sync .env files with .env.example templates.

## Breaking Changes
- Completely new implementation and behavior
- Now requires Node.js 18+ (ESM modules)

## New Features
- 🔄 Interactive conflict resolution when values differ between .env and .env.example
- 📝 Preserves formatting and comments from .env.example
- 🔤 Automatically moves stray environment variables to the bottom in alphabetical order
- 🎨 Beautiful CLI with loading spinners and colored output
- 📁 Support for custom file paths with -i and -o flags
- 🤖 CI mode support (set CI=true for non-interactive mode)
- ✨ Prompts for empty values when needed
- 🧪 Comprehensive test coverage including end-to-end CLI tests

## How it works
- .env.example is the source of truth for all environment variable keys
- Merges existing values from .env file when available
- Interactive prompts to resolve conflicts (defaults to keeping current .env values)
- Never modifies .env.example file
11 changes: 4 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
name: CI

on:
push:
branches: ["**"]
pull_request:
branches: ["**"]
- pull_request

jobs:
test:
Expand All @@ -25,9 +22,6 @@ jobs:
- name: Type check
run: bun tsc --noEmit

- name: Run tests with coverage
run: bun test:coverage

- name: Build package
run: bun run build

Expand All @@ -38,3 +32,6 @@ jobs:
exit 1
fi
echo "✓ Build output verified"

- name: Run tests with coverage
run: bun test:coverage
58 changes: 42 additions & 16 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,24 @@ name: Release

on:
push:
branches:
- main
branches: [main, alpha, beta, rc]
repository_dispatch:
types: [release]

concurrency: ${{ github.workflow }}-${{ github.ref }}
concurrency:
group: ${{ github.workflow }}-${{ github.event.number || github.ref }}
cancel-in-progress: true

permissions:
contents: write
id-token: write
pull-requests: write

jobs:
release:
name: Release
if: github.repository_owner == 'dak-engineering'
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
id-token: write

steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -25,30 +29,52 @@ jobs:
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
bun-version: 1.3.0

- name: Install dependencies
run: bun install --frozen-lockfile

- name: Build package
run: bun run build

- name: Run tests
run: bun test

- name: Build package
run: bun run build
- name: Check for Changesets marked as major
id: major
run: |
echo "found=false" >> $GITHUB_OUTPUT
regex="(major)"
shopt -s nullglob
for file in .changeset/*.md; do
if [[ $(cat $file) =~ $regex ]]; then
echo "found=true" >> $GITHUB_OUTPUT
fi
done

- name: Create Release Pull Request or Publish to npm
- name: Run Changesets (version or publish)
id: changesets
uses: changesets/action@v1
with:
publish: bun changeset publish
version: bun changeset version
commit: "chore: release package"
title: "chore: release package"
version: bun run changeset:version
publish: bun run changeset:publish
commit: 'ci: Version Packages'
title: 'ci: Version Packages'
createGithubReleases: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Auto-merge Changesets PR
if: steps.changesets.outputs.hasChangesets == 'true' && steps.major.outputs.found == 'false'
run: |
gh pr merge --squash "$PR_NUMBER"
gh api --method POST /repos/$REPO/dispatches -f 'event_type=release'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
PR_NUMBER: ${{ steps.changesets.outputs.pullRequestNumber }}

- name: Publish Summary
if: steps.changesets.outputs.published == 'true'
run: |
Expand Down
1 change: 1 addition & 0 deletions .node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
22.19.0
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
save-exact=true
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
22.19.0
8 changes: 8 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Ignore artifacts:
build
coverage

page.mdx
*.md

components/shadcn/*
23 changes: 23 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"experimentalTernaries": false,
"experimentalOperatorPosition": "start",
"singleAttributePerLine": true,
"useTabs": true,
"tabWidth": 2,
"printWidth": 100,
"singleQuote": true,
"trailingComma": "all",
"plugins": ["@ianvs/prettier-plugin-sort-imports", "prettier-plugin-tailwindcss"],
"importOrder": [
"^(react/(.*)$)|^(react$)",
"^(next/(.*)$)|^(next$)",
"<THIRD_PARTY_MODULES>",
"",
"^~/",
"",
"^@/(.*)$",
"^[./]"
],
"importOrderParserPlugins": ["typescript", "jsx", "decorators-legacy"],
"semi": false
}
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodejs 22.19.0
103 changes: 103 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# Contributing to synv

Thank you for your interest in contributing to synv! This document provides guidelines for contributing to the project.

## Development Setup

1. Fork and clone this repository
2. Install dependencies:
```bash
bun install
```
3. Run tests:
```bash
bun test
```
4. Build the project:
```bash
bun run build
```

## Making Changes

### Creating a Changeset

We use [changesets](https://github.com/changesets/changesets) to manage versions and changelogs. When you make a change that should be released, you need to create a changeset:

1. Run the changeset command:
```bash
bun run changeset
```

2. Select the packages you want to include in the changeset (press space to select)

3. Choose the type of change:
- **patch**: Bug fixes and minor updates (0.0.X)
- **minor**: New features that are backward compatible (0.X.0)
- **major**: Breaking changes (X.0.0)

4. Write a brief description of the change. This will appear in the changelog.

Example changeset file (`.changeset/fluffy-pandas-dance.md`):
```markdown
---
"synv": patch
---

Fixed environment variable parsing for quoted values
```

### Commit Messages

We follow conventional commit messages:
- `fix:` for bug fixes
- `feat:` for new features
- `docs:` for documentation changes
- `chore:` for maintenance tasks
- `ci:` for CI/CD changes

## Pull Request Process

1. Create a new branch for your changes
2. Make your changes and add tests if applicable
3. Create a changeset (see above)
4. Commit your changes including the changeset file
5. Push your branch and open a pull request
6. Wait for the CI checks to pass

## Release Process

Our release process is fully automated:

1. When PRs with changesets are merged to `main`, a "Version Packages" PR is automatically created
2. This PR updates package versions and changelogs based on the changesets
3. For non-major releases, the PR is automatically merged
4. For major releases, manual approval is required
5. After merging, packages are automatically published to npm

### Pre-release versions

You can also create pre-release versions by pushing to these branches:
- `alpha` - for alpha releases
- `beta` - for beta releases
- `rc` - for release candidates

## Running Tests

```bash
# Run all tests
bun test

# Run tests in watch mode
bun test --watch

# Run tests with coverage
bun run test:coverage

# Open test UI
bun run test:ui
```

## Questions?

If you have questions, please open an issue on GitHub.
Loading