Skip to content

Commit 93ab9be

Browse files
committed
fix: resolve arrow function boundary detection in React components
- Fix tree-sitter parser to correctly identify nested arrow functions - Modified collectNodesByTypes to recursively traverse function nodes - Arrow functions inside React components now correctly identified with accurate line counts and nesting depths - Update version to 2.2.1 - Add auto-release workflow for GitHub Release automation - Remove old manual release workflow
1 parent cd55ca0 commit 93ab9be

6 files changed

Lines changed: 100 additions & 64 deletions

File tree

.github/workflows/auto-release.yml

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
name: Auto Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'package.json'
9+
10+
jobs:
11+
check-version:
12+
runs-on: ubuntu-latest
13+
outputs:
14+
version-changed: ${{ steps.check.outputs.changed }}
15+
new-version: ${{ steps.check.outputs.version }}
16+
steps:
17+
- uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 2
20+
21+
- name: Check if version changed
22+
id: check
23+
run: |
24+
CURRENT_VERSION=$(node -p "require('./package.json').version")
25+
git checkout HEAD~1 -- package.json 2>/dev/null || echo "First commit"
26+
PREVIOUS_VERSION=$(node -p "require('./package.json').version" 2>/dev/null || echo "0.0.0")
27+
git checkout HEAD -- package.json
28+
29+
echo "Current version: $CURRENT_VERSION"
30+
echo "Previous version: $PREVIOUS_VERSION"
31+
32+
if [ "$CURRENT_VERSION" != "$PREVIOUS_VERSION" ]; then
33+
echo "changed=true" >> $GITHUB_OUTPUT
34+
echo "version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
35+
else
36+
echo "changed=false" >> $GITHUB_OUTPUT
37+
fi
38+
39+
ci:
40+
needs: check-version
41+
if: needs.check-version.outputs.version-changed == 'true'
42+
runs-on: ubuntu-latest
43+
steps:
44+
- uses: actions/checkout@v4
45+
46+
- uses: actions/setup-node@v4
47+
with:
48+
node-version: 20
49+
cache: npm
50+
51+
- run: npm ci
52+
53+
- name: Lint
54+
run: npm run lint
55+
56+
- name: Format check
57+
run: npm run format:check
58+
59+
- name: Build
60+
run: npm run build
61+
62+
- name: Test
63+
run: npx vitest --run
64+
65+
create-release:
66+
needs: [check-version, ci]
67+
if: needs.check-version.outputs.version-changed == 'true'
68+
runs-on: ubuntu-latest
69+
permissions:
70+
contents: write
71+
steps:
72+
- uses: actions/checkout@v4
73+
74+
- name: Create Release
75+
uses: softprops/action-gh-release@v2
76+
with:
77+
tag_name: v${{ needs.check-version.outputs.new-version }}
78+
name: Release v${{ needs.check-version.outputs.new-version }}
79+
body: |
80+
## Changes in v${{ needs.check-version.outputs.new-version }}
81+
82+
See [commits](https://github.com/${{ github.repository }}/commits/v${{ needs.check-version.outputs.new-version }}) for details.
83+
84+
## Installation
85+
86+
```bash
87+
npm install -g eff-u-code@${{ needs.check-version.outputs.new-version }}
88+
```
89+
draft: false
90+
prerelease: false
91+
generate_release_notes: true

.github/workflows/release.yml

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

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "eff-u-code",
3-
"version": "2.2.0",
3+
"version": "2.2.1",
44
"description": "Production-grade code quality analyzer with AST parsing and AI integration",
55
"type": "module",
66
"main": "dist/index.js",

src/parser/tree-sitter-parser.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -913,10 +913,13 @@ export class TreeSitterParser implements IParser {
913913
const walk = (node: Parser.SyntaxNode): void => {
914914
if (typeSet.has(node.type)) {
915915
callback(node);
916-
// For comments, continue recursing; for functions/classes, don't
916+
// For comments and imports, continue recursing
917+
// For functions, also continue recursing to find nested functions (e.g., arrow functions in React components)
918+
// For classes, don't recurse (methods will be found separately)
917919
if (
918920
this.config.commentNodeTypes.includes(node.type) ||
919-
this.config.importNodeTypes.includes(node.type)
921+
this.config.importNodeTypes.includes(node.type) ||
922+
this.config.functionNodeTypes.includes(node.type)
920923
) {
921924
for (const child of node.namedChildren) walk(child);
922925
}

src/version.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
* Application version - single source of truth
33
* This value is automatically synced from package.json during build
44
*/
5-
export const VERSION = '2.2.0';
5+
export const VERSION = '2.2.1';

0 commit comments

Comments
 (0)