Skip to content
This repository was archived by the owner on Nov 19, 2025. It is now read-only.

Commit 304e59a

Browse files
committed
feat: modernize cross-env with TypeScript, Vitest, and ESM-only build
BREAKING CHANGE: This is a major rewrite that changes the module format from CommonJS to ESM-only. The package now requires Node.js >=20 and only exports ESM modules (not relevant in most cases). BREAKING CHANGE: The package.json exports have been updated to remove CommonJS support. Only ESM imports are now supported. BREAKING CHANGE: All source files have been converted from JavaScript to TypeScript, requiring TypeScript-aware tooling for development. - Replace Jest with Vitest for testing - Convert all source files from .js to .ts with proper TypeScript types - Use zshy for ESM-only builds (removes CJS support) - Adopt @epic-web/config for TypeScript, ESLint, and Prettier - Update to Node.js >=20 requirement - Remove kcd-scripts dependency - Add comprehensive e2e tests with GitHub Actions matrix testing - Update GitHub workflow with caching and cross-platform testing - Modernize documentation and remove outdated sections - Update all dependencies to latest versions - Add proper TypeScript declarations and exports The tool maintains its original functionality while being completely modernized with the latest tooling and best practices.
1 parent ad217a0 commit 304e59a

37 files changed

+9346
-1237
lines changed

.all-contributorsrc

Lines changed: 0 additions & 255 deletions
This file was deleted.

.github/ISSUE_TEMPLATE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ learn how: http://kcd.im/pull-request
1818
Relevant code or config
1919

2020
```javascript
21+
2122
```
2223

2324
What you did:

.github/workflows/auto-format.yml

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
name: Auto Format
2+
3+
on:
4+
push:
5+
branches: [main, develop]
6+
pull_request:
7+
branches: [main, develop]
8+
workflow_dispatch:
9+
10+
jobs:
11+
format:
12+
name: 🔧 Auto Format
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: write
16+
pull-requests: write
17+
steps:
18+
- name: 📥 Checkout code
19+
uses: actions/checkout@v4
20+
with:
21+
token: ${{ secrets.GITHUB_TOKEN }}
22+
ref: ${{ github.head_ref || github.ref_name }}
23+
24+
- name: Setup Node.js
25+
uses: actions/setup-node@v4
26+
with:
27+
node-version: 24
28+
cache: 'npm'
29+
30+
- name: Cache node_modules
31+
uses: actions/cache@v4
32+
with:
33+
path: node_modules
34+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
35+
restore-keys: |
36+
${{ runner.os }}-node-
37+
38+
- name: Install dependencies
39+
run: npm ci
40+
41+
- name: Check current formatting
42+
id: format-check
43+
run: |
44+
if npm run format:check; then
45+
echo "format_needed=false" >> $GITHUB_OUTPUT
46+
echo "✅ Code is already properly formatted"
47+
else
48+
echo "format_needed=true" >> $GITHUB_OUTPUT
49+
echo "⚠️ Code formatting issues found"
50+
fi
51+
52+
- name: Format code
53+
if: steps.format-check.outputs.format_needed == 'true'
54+
run: npm run format
55+
56+
- name: Check for changes
57+
id: changes
58+
if: steps.format-check.outputs.format_needed == 'true'
59+
run: |
60+
if git diff --quiet; then
61+
echo "has_changes=false" >> $GITHUB_OUTPUT
62+
echo "ℹ️ No formatting changes to commit"
63+
else
64+
echo "has_changes=true" >> $GITHUB_OUTPUT
65+
echo "📝 Formatting changes detected"
66+
fi
67+
68+
- name: Configure Git
69+
if: steps.changes.outputs.has_changes == 'true'
70+
run: |
71+
git config --local user.email "action@github.com"
72+
git config --local user.name "GitHub Action"
73+
74+
- name: Commit and push changes
75+
if: steps.changes.outputs.has_changes == 'true'
76+
run: |
77+
git add -A
78+
git commit -m "🔧 Auto-format code with Prettier [skip ci]
79+
80+
This commit was automatically generated by the auto-format workflow.
81+
Changes include:
82+
- Code formatting fixes
83+
- Consistent indentation
84+
- Proper line endings"
85+
git push origin HEAD:${{ github.head_ref || github.ref_name }}
86+
87+
- name: Comment on PR
88+
if:
89+
steps.changes.outputs.has_changes == 'true' && github.event_name ==
90+
'pull_request'
91+
uses: actions/github-script@v7
92+
with:
93+
script: |
94+
github.rest.issues.createComment({
95+
issue_number: context.issue.number,
96+
owner: context.repo.owner,
97+
repo: context.repo.repo,
98+
body: '🔧 **Auto-formatting applied!**\n\nI\'ve automatically formatted the code using Prettier and pushed the changes. The formatting is now consistent with the project standards.'
99+
})
100+
101+
- name: Success message
102+
if:
103+
steps.changes.outputs.has_changes == 'false' ||
104+
steps.format-check.outputs.format_needed == 'false'
105+
run: |
106+
echo "✅ No formatting changes needed - code is already properly formatted!"

0 commit comments

Comments
 (0)