Skip to content

Commit 54cdbea

Browse files
committed
ci: fix changelog extraction script for ESM compatibility
1 parent 6f196dd commit 54cdbea

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

.github/workflows/ci-cd.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,13 @@ jobs:
9797
id: get_release_info
9898
shell: bash
9999
run: |
100-
VERSION=$(node -p "require('./package.json').version")
100+
# Use node to safely read version from package.json regardless of module type
101+
VERSION=$(node -e "import fs from 'fs'; console.log(JSON.parse(fs.readFileSync('./package.json')).version)" --input-type=module)
101102
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
102103
103104
# Extract the section from CHANGELOG.md for the current version
104-
# It looks for the header ## [VERSION] and takes everything until the next ## [
105-
# Then we remove the last line (the next header) and any trailing link if it's there
106-
# Using a temporary node script for robust cross-platform parsing
107-
cat << 'EOF' > extract_changelog.js
105+
# Using .cjs extension to force CommonJS mode for the extraction script
106+
cat << 'EOF' > extract_changelog.cjs
108107
const fs = require('fs');
109108
const content = fs.readFileSync('CHANGELOG.md', 'utf8');
110109
const version = process.argv[2];
@@ -122,7 +121,7 @@ jobs:
122121
}
123122
EOF
124123
125-
node extract_changelog.js $VERSION
124+
node extract_changelog.cjs $VERSION
126125
127126
- name: 🔨 Build Standalone EXE
128127
run: npm run build:sea

0 commit comments

Comments
 (0)