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
5 changes: 5 additions & 0 deletions .changeset/fix-package-entry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'dotenv-diff': patch
---

fix: import from 'dotenv-diff' pointed to a file that didn't exist. also stop shipping tests in the npm package and include LICENSE
11 changes: 7 additions & 4 deletions .github/workflows/build-test-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: Install pnpm
uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0
with:
version: 11.24.0
version: 12.15.0
run_install: false

- name: Install dependencies
Expand All @@ -52,7 +52,7 @@ jobs:
- name: Install pnpm
uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0
with:
version: 11.24.0
version: 12.15.0
run_install: false

- name: Install dependencies
Expand All @@ -61,6 +61,9 @@ jobs:
- name: Run lint
run: pnpm lint

- name: Typecheck (src + tests)
run: pnpm --filter dotenv-diff run typecheck

test:
runs-on: ubuntu-latest

Expand All @@ -76,7 +79,7 @@ jobs:
- name: Install pnpm
uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0
with:
version: 11.24.0
version: 12.15.0
run_install: false

- name: Install dependencies
Expand Down Expand Up @@ -112,7 +115,7 @@ jobs:
- name: Install pnpm
uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0
with:
version: 11.24.0
version: 12.15.0
run_install: false

- name: Install dependencies
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ jobs:
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

- name: Initialize CodeQL
uses: github/codeql-action/init@6f2ac81f5cd81fe351a197ba0b00d91d03cd2aee # v4.39.0
uses: github/codeql-action/init@9b3254085494b55a0f7c4c2b3d2d52cc712ce370 # v4.39.1
with:
languages: javascript-typescript
build-mode: none

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@6f2ac81f5cd81fe351a197ba0b00d91d03cd2aee # v4.39.0
uses: github/codeql-action/analyze@9b3254085494b55a0f7c4c2b3d2d52cc712ce370 # v4.39.1
with:
category: '/language:javascript-typescript'
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
- name: Install pnpm
uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0
with:
version: 11.24.0
version: 12.15.0

- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v 7.1.0
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/scorecard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@ jobs:
retention-days: 5

- name: Upload to code-scanning
uses: github/codeql-action/upload-sarif@6f2ac81f5cd81fe351a197ba0b00d91d03cd2aee # v4.39.0
uses: github/codeql-action/upload-sarif@9b3254085494b55a0f7c4c2b3d2d52cc712ce370 # v4.39.1
with:
sarif_file: results.sarif
138 changes: 138 additions & 0 deletions .github/workflows/smoke-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
name: Package smoke test

# Packs the CLI exactly as it would be published to npm, installs the tarball
# into an empty project and verifies the bin, the ESM entry and the types.

on:
push:
branches: [main]
pull_request:
branches: [main]

permissions:
contents: read

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

defaults:
run:
# Use bash on Windows too, so every step works the same on all runners
shell: bash

jobs:
smoke:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
# Lowest version allowed by "engines" in packages/cli/package.json
node-version: [22]
runs-on: ${{ matrix.os }}
timeout-minutes: 15

steps:
- name: Checkout repo
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- name: Install pnpm
uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0
with:
version: 12.15.0
run_install: false

- name: Setup Node.js
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v 7.1.0
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'

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

- name: Build package
run: pnpm --filter dotenv-diff run build

- name: Pack tarball
run: |
mkdir -p "$RUNNER_TEMP/smoke"
cd packages/cli
pnpm pack --pack-destination "$RUNNER_TEMP/smoke"

- name: Verify tarball contents
working-directory: ${{ runner.temp }}/smoke
run: |
tar -tzf dotenv-diff-*.tgz > contents.txt
echo "Tarball contains $(wc -l < contents.txt) files"

for required in package/LICENSE package/README.md package/dist/bin/dotenv-diff.js package/dist/src/index.js package/dist/src/index.d.ts; do
grep -qx "$required" contents.txt || { echo "::error::Missing $required in tarball"; exit 1; }
done

if grep -E '^package/dist/(test|bench)/' contents.txt; then
echo "::error::Tests or benchmarks leaked into the tarball"
exit 1
fi

- name: Install tarball into empty project
working-directory: ${{ runner.temp }}/smoke
run: |
npm init -y > /dev/null
npm pkg set type=module
npm install --no-audit --no-fund ./dotenv-diff-*.tgz typescript

- name: Run CLI
working-directory: ${{ runner.temp }}/smoke
run: |
npx --no-install dotenv-diff --help

printf 'A=1\nB=2\n' > .env
printf 'A=\nB=\nC=\n' > .env.example

# Missing key must fail
if npx --no-install dotenv-diff --compare --ci; then
echo "::error::Expected --compare to fail when a key is missing"
exit 1
fi

# Matching files must pass
printf 'C=3\n' >> .env
npx --no-install dotenv-diff --compare --ci

- name: Import ESM entry
working-directory: ${{ runner.temp }}/smoke
run: |
node --input-type=module -e "
import assert from 'node:assert/strict';
import { diffEnv, parseEnvContent, parseEnvFile } from 'dotenv-diff';
assert.equal(typeof parseEnvFile, 'function');
const result = diffEnv(parseEnvContent('A=1'), parseEnvContent('A=\nB='));
assert.deepEqual(result.missing, ['B']);
console.log('ESM import OK');
"

- name: Resolve types
working-directory: ${{ runner.temp }}/smoke
run: |
cat > tsconfig.json <<'EOF'
{
"compilerOptions": {
"module": "nodenext",
"moduleResolution": "nodenext",
"strict": true,
"noEmit": true,
"types": []
},
"include": ["check.ts"]
}
EOF
cat > check.ts <<'EOF'
import { diffEnv, parseEnvContent, type DiffResult } from 'dotenv-diff';
const result: DiffResult = diffEnv(parseEnvContent('A=1'), {});
export const missing: string[] = result.missing;
EOF
npx --no-install tsc -p tsconfig.json
echo "Types OK"
2 changes: 1 addition & 1 deletion .github/workflows/test-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:

- uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0
with:
version: 11.24.0
version: 12.15.0

- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v 7.1.0
with:
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,16 @@
"@repo/vitest": "workspace:*",
"@types/node": "^26.6.5",
"@types/prompts": "^2.4.9",
"@typescript-eslint/eslint-plugin": "^8.71.2",
"@typescript-eslint/parser": "^8.71.2",
"@vitest/coverage-v8": "5.0.3",
"@typescript-eslint/eslint-plugin": "^8.72.0",
"@typescript-eslint/parser": "^8.72.0",
"@vitest/coverage-v8": "5.0.5",
"eslint": "^10.13.0",
"husky": "^9.1.7",
"lint-staged": "^17.6.0",
"prettier": "^3.9.10",
"turbo": "^2.11.9",
"turbo": "^2.11.10",
"typescript": "^6.0.3",
"vitest": "^5.0.5"
},
"packageManager": "pnpm@11.24.0"
"packageManager": "pnpm@12.15.0"
}
4 changes: 2 additions & 2 deletions packages/@repo/eslint-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
"format": "prettier --write \"**/*.{ts,js,json,md,yml}\""
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^8.71.2",
"@typescript-eslint/parser": "^8.71.2",
"@typescript-eslint/eslint-plugin": "^8.72.0",
"@typescript-eslint/parser": "^8.72.0",
"eslint": "^10.13.0"
}
}
21 changes: 21 additions & 0 deletions packages/cli/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2025 Chrilleweb

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
12 changes: 6 additions & 6 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,25 @@
"bin": {
"dotenv-diff": "dist/bin/dotenv-diff.js"
},
"main": "dist/index.js",
"types": "dist/index.d.ts",
"main": "dist/src/index.js",
"types": "dist/src/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js"
"types": "./dist/src/index.d.ts",
"import": "./dist/src/index.js"
},
"./package.json": "./package.json"
},
"files": [
"dist/",
"docs/",
"README.md",
"CHANGELOG.md",
"LICENSE"
],
"sideEffects": false,
"scripts": {
"build": "tsc",
"build": "node -e \"fs.rmSync('dist',{recursive:true,force:true})\" && tsc -p tsconfig.build.json",
"typecheck": "tsc --noEmit",
"dev": "npx dotenv-diff",
"test": "vitest run",
"coverage": "vitest run --coverage",
Expand Down
4 changes: 4 additions & 0 deletions packages/cli/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": "./tsconfig.json",
"include": ["src/**/*.ts", "bin/**/*.ts", "types/**/*.d.ts"]
}
Loading
Loading