Skip to content

Commit aea2fbe

Browse files
authored
chore: update quickjs-emscripten package version and dependencies (#53)
* Successfully updated non-breaking dev dependencies! Here's what was updated: Updated Dependencies: - TypeScript: 4.8.2 → 5.7.2 (major version jump, but backward compatible) - Vite: 4.1.2 → 6.0.3 (major updates with improved performance) - Vitest: 0.28.5 → 2.1.8 (major update) - @vitest/coverage-v8: Replaced coverage-c8 with coverage-v8 (new package name) - vite-plugin-dts: 2.0.0-beta.1 → 4.3.0 (stable release) - ESLint: 8.22.0 → 8.57.1 (latest v8, not v9 to avoid breaking changes) - Prettier: 2.7.1 → 2.8.8 (latest v2, not v3 to stay compatible with eslint-config-reearth) * chore: upgrade to [email protected] and add evalModule support - Upgrade quickjs-emscripten 0.21→0.25 and dev dependencies - Add Arena.evalModule() for ES module code execution with side effects - Add 5 test cases for module functionality (123 tests total) * ci: update GitHub Actions to latest versions - Update actions/checkout v3 -> v4 - Update actions/setup-node v3 -> v4 - Update codecov/codecov-action v2 -> v4 - Update actions/upload-artifact v3 -> v4 - Update amannn/action-semantic-pull-request v4 -> v5 Fixes CI failures due to deprecated action versions * Fix lint errors and warnings * add memory management API for Arena Add setMemoryLimit(), setMaxStackSize(), getMemoryUsage(), and dumpMemoryUsage() methods for controlling and monitoring QuickJS runtime resource usage. - Prevents runaway memory allocation in sandboxed code - Protects against stack overflow from deep recursion - Provides detailed memory statistics for debugging - 8 new tests covering memory limits and monitoring * create a new automated release workflow for version upgrade * revert: switch back to @vitest/coverage-c8 * fix: downgrade vitest to 0.28.5 to match coverage-c8 version * ci: restrict release workflow to main branch only
1 parent 5936622 commit aea2fbe

File tree

7 files changed

+1854
-681
lines changed

7 files changed

+1854
-681
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ jobs:
88
runs-on: ubuntu-latest
99
steps:
1010
- name: Checkout repo
11-
uses: actions/checkout@v3
11+
uses: actions/checkout@v4
1212

1313
- name: Use Node
14-
uses: actions/setup-node@v3
14+
uses: actions/setup-node@v4
1515
with:
1616
node-version: lts/*
1717

@@ -25,13 +25,13 @@ jobs:
2525
run: yarn test --coverage
2626

2727
- name: codecov
28-
uses: codecov/codecov-action@v2
28+
uses: codecov/codecov-action@v4
2929

3030
- name: Build
3131
run: yarn run build
3232

3333
- name: Upload artifacts
34-
uses: actions/upload-artifact@v3
34+
uses: actions/upload-artifact@v4
3535
with:
3636
name: dist
3737
path: dist/**/*

.github/workflows/pr_title.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
pr_title:
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: amannn/action-semantic-pull-request@v4
14+
- uses: amannn/action-semantic-pull-request@v5
1515
env:
1616
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1717
ignoreLabels: meta

.github/workflows/release.yml

Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version_type:
7+
description: 'Version bump type'
8+
required: true
9+
type: choice
10+
options:
11+
- patch
12+
- minor
13+
- major
14+
- custom
15+
custom_version:
16+
description: 'Custom version (only used if version_type is custom, e.g., 1.2.3)'
17+
required: false
18+
type: string
19+
20+
jobs:
21+
release:
22+
runs-on: ubuntu-latest
23+
if: github.ref == 'refs/heads/main'
24+
permissions:
25+
contents: write
26+
pull-requests: write
27+
steps:
28+
- name: Checkout repo
29+
uses: actions/checkout@v4
30+
with:
31+
fetch-depth: 0
32+
33+
- name: Configure Git
34+
run: |
35+
git config user.name "github-actions[bot]"
36+
git config user.email "github-actions[bot]@users.noreply.github.com"
37+
38+
- name: Use Node
39+
uses: actions/setup-node@v4
40+
with:
41+
node-version: lts/*
42+
43+
- name: Install dependencies
44+
run: yarn install --frozen-lockfile
45+
46+
- name: Run tests
47+
run: yarn test run
48+
49+
- name: Run build
50+
run: yarn build
51+
52+
- name: Get current version
53+
id: current_version
54+
run: echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
55+
56+
- name: Bump version
57+
id: bump_version
58+
run: |
59+
if [ "${{ github.event.inputs.version_type }}" = "custom" ]; then
60+
NEW_VERSION="${{ github.event.inputs.custom_version }}"
61+
npm version $NEW_VERSION --no-git-tag-version
62+
else
63+
npm version ${{ github.event.inputs.version_type }} --no-git-tag-version
64+
fi
65+
NEW_VERSION=$(node -p "require('./package.json').version")
66+
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
67+
68+
- name: Generate changelog
69+
id: changelog
70+
run: |
71+
NEW_VERSION="${{ steps.bump_version.outputs.new_version }}"
72+
73+
if git describe --tags --abbrev=0 2>/dev/null; then
74+
LAST_TAG=$(git describe --tags --abbrev=0)
75+
git log $LAST_TAG..HEAD --pretty=format:"- %s" --no-merges > /tmp/commits.txt
76+
else
77+
git log --pretty=format:"- %s" --no-merges > /tmp/commits.txt
78+
fi
79+
80+
DATE=$(date +%Y-%m-%d)
81+
82+
cat > /tmp/changelog_entry.md << 'CHANGELOG_EOF'
83+
## [$NEW_VERSION] - $DATE
84+
85+
### Changes
86+
CHANGELOG_EOF
87+
88+
sed "s/\$NEW_VERSION/$NEW_VERSION/g; s/\$DATE/$DATE/g" /tmp/changelog_entry.md > /tmp/changelog_header.md
89+
cat /tmp/commits.txt >> /tmp/changelog_header.md
90+
echo "" >> /tmp/changelog_header.md
91+
92+
if [ -f CHANGELOG.md ]; then
93+
cat /tmp/changelog_header.md CHANGELOG.md > /tmp/new_changelog.md
94+
mv /tmp/new_changelog.md CHANGELOG.md
95+
else
96+
echo "# Changelog" > CHANGELOG.md
97+
echo "" >> CHANGELOG.md
98+
echo "All notable changes to this project will be documented in this file." >> CHANGELOG.md
99+
echo "" >> CHANGELOG.md
100+
cat /tmp/changelog_header.md >> CHANGELOG.md
101+
fi
102+
103+
echo "changelog<<CHANGELOG_OUTPUT_EOF" >> $GITHUB_OUTPUT
104+
cat /tmp/changelog_header.md >> $GITHUB_OUTPUT
105+
echo "CHANGELOG_OUTPUT_EOF" >> $GITHUB_OUTPUT
106+
107+
- name: Create release branch and commit
108+
id: create_branch
109+
run: |
110+
BRANCH_NAME="release/v${{ steps.bump_version.outputs.new_version }}"
111+
git checkout -b "$BRANCH_NAME"
112+
git add package.json CHANGELOG.md
113+
git commit -m "chore: release v${{ steps.bump_version.outputs.new_version }}"
114+
git push origin "$BRANCH_NAME"
115+
echo "branch_name=$BRANCH_NAME" >> $GITHUB_OUTPUT
116+
117+
- name: Create Pull Request
118+
uses: actions/github-script@v7
119+
with:
120+
script: |
121+
const changelog = `${{ steps.changelog.outputs.changelog }}`;
122+
const version = '${{ steps.bump_version.outputs.new_version }}';
123+
const branchName = '${{ steps.create_branch.outputs.branch_name }}';
124+
125+
const prBody = `## Release v${version}
126+
127+
This PR was automatically created by the release workflow.
128+
129+
### Changelog
130+
${changelog}
131+
132+
### Pre-merge Checklist
133+
- [ ] Review version bump is correct
134+
- [ ] Review changelog entries
135+
- [ ] All tests passing
136+
- [ ] Build successful
137+
138+
### Post-merge Steps
139+
After merging this PR:
140+
1. Create a GitHub release with tag \`v${version}\`
141+
2. Manually publish to npm: \`npm publish\`
142+
`;
143+
144+
const { data: pr } = await github.rest.pulls.create({
145+
owner: context.repo.owner,
146+
repo: context.repo.repo,
147+
title: `chore: release v${version}`,
148+
head: branchName,
149+
base: 'main',
150+
body: prBody
151+
});
152+
153+
console.log('Pull request created:', pr.html_url);
154+
core.summary.addHeading('Release PR Created');
155+
core.summary.addLink('View Pull Request', pr.html_url);
156+
await core.summary.write();

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@
3232
},
3333
"devDependencies": {
3434
"@vitest/coverage-c8": "^0.28.5",
35-
"eslint": "^8.22.0",
35+
"eslint": "^8.57.1",
3636
"eslint-config-reearth": "^0.2.1",
37-
"prettier": "^2.7.1",
38-
"quickjs-emscripten": "^0.21.0",
39-
"typescript": "^4.8.2",
40-
"vite": "^4.1.2",
41-
"vite-plugin-dts": "^2.0.0-beta.1",
37+
"prettier": "^2.8.8",
38+
"quickjs-emscripten": "^0.25.0",
39+
"typescript": "^5.7.2",
40+
"vite": "^6.0.3",
41+
"vite-plugin-dts": "^4.3.0",
4242
"vitest": "^0.28.5"
4343
}
4444
}

0 commit comments

Comments
 (0)