Skip to content

Commit 40e4ee7

Browse files
committed
⬆️ Upgrade to Next.js 16 with ESM module system
Convert package to native ESM with modern TypeScript configuration: - Add "type": "module" and update exports to use "import" field - Change tsconfig to use ESNext module with Bundler resolution - Update test-app to Next.js 16.0.7 with matching config changes Fix client-side bundling issue in env-script component: - Dynamic import next/headers to avoid including server-only code Simplify release workflow: - Switch from semantic-release to tag-triggered releases - Remove back-merge job and reduce permissions - Use softprops/action-gh-release for GitHub releases
1 parent 602633a commit 40e4ee7

File tree

9 files changed

+213
-232
lines changed

9 files changed

+213
-232
lines changed

.github/workflows/release.yml

Lines changed: 17 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@ name: Release
22

33
on:
44
push:
5-
branches: [main]
5+
tags:
6+
- 'v*'
67
workflow_dispatch:
78

89
permissions:
910
contents: write
10-
issues: write
11-
pull-requests: write
1211
id-token: write
1312

1413
concurrency:
@@ -24,18 +23,12 @@ jobs:
2423
name: Release
2524
runs-on: ubuntu-latest
2625
timeout-minutes: 15
27-
outputs:
28-
released: ${{ steps.semantic.outputs.new_release_published }}
29-
version: ${{ steps.semantic.outputs.new_release_version }}
30-
channel: ${{ steps.semantic.outputs.new_release_channel }}
31-
tag: ${{ steps.semantic.outputs.new_release_git_tag }}
3226

3327
steps:
3428
- name: Checkout
3529
uses: actions/checkout@v4
3630
with:
3731
fetch-depth: 0
38-
persist-credentials: false
3932

4033
- name: Setup pnpm
4134
uses: pnpm/action-setup@v4
@@ -55,65 +48,23 @@ jobs:
5548
- name: Build
5649
run: pnpm build
5750

58-
- name: Semantic Release
59-
id: semantic
60-
env:
61-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
62-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
63-
GIT_AUTHOR_NAME: 'github-actions[bot]'
64-
GIT_AUTHOR_EMAIL: 'github-actions[bot]@users.noreply.github.com'
65-
GIT_COMMITTER_NAME: 'github-actions[bot]'
66-
GIT_COMMITTER_EMAIL: 'github-actions[bot]@users.noreply.github.com'
67-
run: pnpm semantic-release
68-
69-
- name: Summary
70-
if: always()
71-
run: |
72-
if [ "${{ steps.semantic.outputs.new_release_published }}" == "true" ]; then
73-
echo "## Release Published" >> $GITHUB_STEP_SUMMARY
74-
echo "" >> $GITHUB_STEP_SUMMARY
75-
echo "**Version:** \`${{ steps.semantic.outputs.new_release_version }}\`" >> $GITHUB_STEP_SUMMARY
76-
echo "**Tag:** \`${{ steps.semantic.outputs.new_release_git_tag }}\`" >> $GITHUB_STEP_SUMMARY
77-
echo "" >> $GITHUB_STEP_SUMMARY
78-
echo "[npm](https://www.npmjs.com/package/next-dynenv/v/${{ steps.semantic.outputs.new_release_version }}) · [Release Notes](https://github.com/${{ github.repository }}/releases/tag/${{ steps.semantic.outputs.new_release_git_tag }})" >> $GITHUB_STEP_SUMMARY
79-
else
80-
echo "## No Release" >> $GITHUB_STEP_SUMMARY
81-
echo "" >> $GITHUB_STEP_SUMMARY
82-
echo "No releasable changes detected." >> $GITHUB_STEP_SUMMARY
83-
fi
51+
- name: Run tests
52+
run: pnpm test
8453

85-
back-merge:
86-
name: Back-merge
87-
runs-on: ubuntu-latest
88-
needs: release
89-
if: needs.release.outputs.released == 'true'
90-
timeout-minutes: 5
54+
- name: Publish to npm
55+
run: pnpm publish --access public --no-git-checks
56+
env:
57+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
9158

92-
steps:
93-
- name: Checkout
94-
uses: actions/checkout@v4
59+
- name: Create GitHub Release
60+
uses: softprops/action-gh-release@v2
9561
with:
96-
fetch-depth: 0
97-
token: ${{ secrets.GITHUB_TOKEN }}
62+
generate_release_notes: true
9863

99-
- name: Configure Git
100-
run: |
101-
git config user.name "github-actions[bot]"
102-
git config user.email "github-actions[bot]@users.noreply.github.com"
103-
104-
- name: Merge to development
64+
- name: Summary
10565
run: |
106-
git fetch origin main development
107-
git checkout development
108-
git pull origin development
109-
110-
if git merge origin/main --no-ff -m "chore: back-merge main into development [skip ci]"; then
111-
git push origin development
112-
echo "## Back-merge Complete" >> $GITHUB_STEP_SUMMARY
113-
echo "Successfully merged main → development" >> $GITHUB_STEP_SUMMARY
114-
else
115-
echo "## Back-merge Failed" >> $GITHUB_STEP_SUMMARY
116-
echo "Merge conflict detected. Manual merge required." >> $GITHUB_STEP_SUMMARY
117-
git merge --abort
118-
exit 1
119-
fi
66+
echo "## Release Published" >> $GITHUB_STEP_SUMMARY
67+
echo "" >> $GITHUB_STEP_SUMMARY
68+
echo "**Tag:** \`${{ github.ref_name }}\`" >> $GITHUB_STEP_SUMMARY
69+
echo "" >> $GITHUB_STEP_SUMMARY
70+
echo "[npm](https://www.npmjs.com/package/next-dynenv) · [Release](https://github.com/${{ github.repository }}/releases/tag/${{ github.ref_name }})" >> $GITHUB_STEP_SUMMARY

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22
"name": "next-dynenv",
33
"version": "4.0.0",
44
"description": "Dynamic runtime environment variables for Next.js - populate your environment at runtime, not build time.",
5+
"type": "module",
56
"main": "build/index.js",
67
"types": "build/index.d.ts",
78
"exports": {
89
".": {
910
"types": "./build/index.d.ts",
10-
"default": "./build/index.js"
11+
"import": "./build/index.js"
1112
}
1213
},
1314
"engines": {
@@ -51,7 +52,7 @@
5152
},
5253
"homepage": "https://github.com/hyperb1iss/next-dynenv#readme",
5354
"dependencies": {
54-
"next": "^15",
55+
"next": "^16.0.7",
5556
"react": "^19"
5657
},
5758
"devDependencies": {

0 commit comments

Comments
 (0)