From f4aa5bee2e24201ee7709a224c758d7643e6eaf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=8B=AC=EC=9C=A0=EC=A7=84?= Date: Sun, 19 Oct 2025 20:30:50 +0900 Subject: [PATCH 1/9] =?UTF-8?q?chore:=20main=20=EB=A8=B8=EC=A7=80=20?= =?UTF-8?q?=EC=8B=9C=20package.json=20=EB=B2=84=EC=A0=84=20=EC=A6=9D?= =?UTF-8?q?=EA=B0=80=20=EC=9B=8C=ED=81=AC=ED=94=8C=EB=A1=9C=20=EC=9E=91?= =?UTF-8?q?=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/auto-bump-version.yaml | 81 ++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 .github/workflows/auto-bump-version.yaml diff --git a/.github/workflows/auto-bump-version.yaml b/.github/workflows/auto-bump-version.yaml new file mode 100644 index 00000000..92efca6c --- /dev/null +++ b/.github/workflows/auto-bump-version.yaml @@ -0,0 +1,81 @@ +name: Auto Bump Version on Merge to main + +on: + pull_request: + types: [closed] + workflow_dispatch: + +permissions: + contents: write + +jobs: + bump-version: + if: > + github.event.pull_request.merged == true && + github.event.pull_request.base.ref == 'main' && + github.actor != 'github-actions[bot]' + runs-on: ubuntu-latest + steps: + - name: Checkout main + uses: actions/checkout@v4 + with: + ref: main + fetch-depth: 0 + + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Check if version was changed in PR + id: check_version_change + uses: actions/github-script@v7 + with: + script: | + const prNumber = context.payload.pull_request.number; + const { data: files } = await github.rest.pulls.listFiles({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: prNumber, + per_page: 250 + }); + + const pkg = files.find(f => f.filename === 'package.json'); + let versionChanged = false; + if (pkg && pkg.patch) { + const touched = pkg.patch.includes('"version"'); + if (touched) versionChanged = true; + } + + core.setOutput('version_changed_in_pr', versionChanged ? 'true' : 'false'); + + - name: Show decision + run: echo "version_changed_in_pr=${{ steps.check_version_change.outputs.version_changed_in_pr }}" + + - name: Bump minor version (+0.1) if not changed in PR + if: steps.check_version_change.outputs.version_changed_in_pr != 'true' + run: | + node -e " + const fs = require('fs'); + const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8')); + const [maj, min, pat] = pkg.version.split('.').map(Number); + const next = [maj, min, (pat || 0) + 1].join('.'); + + pkg.version = next; + fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2) + '\n'); + console.log('Bumped version:', next); + " + + - name: Commit & Push (only if changed) + run: | + if git diff --quiet; then + echo "No changes to commit. Skipping." + exit 0 + fi + + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + + git add package.json + git commit -m "chore: bump version on merge to main [skip ci]" + git push From 06c32c83c1042995749c2a88f9d188412d51afb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=8B=AC=EC=9C=A0=EC=A7=84?= Date: Sun, 19 Oct 2025 20:38:35 +0900 Subject: [PATCH 2/9] =?UTF-8?q?chore:=20UI=20export=20=EB=8F=99=EA=B8=B0?= =?UTF-8?q?=ED=99=94=20=EC=9B=8C=ED=81=AC=ED=94=8C=EB=A1=9C=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/auto-bump-version.yaml | 61 +++++++++++++++++++----- 1 file changed, 49 insertions(+), 12 deletions(-) diff --git a/.github/workflows/auto-bump-version.yaml b/.github/workflows/auto-bump-version.yaml index 92efca6c..e271aed4 100644 --- a/.github/workflows/auto-bump-version.yaml +++ b/.github/workflows/auto-bump-version.yaml @@ -39,20 +39,15 @@ jobs: pull_number: prNumber, per_page: 250 }); - const pkg = files.find(f => f.filename === 'package.json'); let versionChanged = false; if (pkg && pkg.patch) { const touched = pkg.patch.includes('"version"'); if (touched) versionChanged = true; } - core.setOutput('version_changed_in_pr', versionChanged ? 'true' : 'false'); - - name: Show decision - run: echo "version_changed_in_pr=${{ steps.check_version_change.outputs.version_changed_in_pr }}" - - - name: Bump minor version (+0.1) if not changed in PR + - name: Bump patch version (+0.0.1) if not changed in PR if: steps.check_version_change.outputs.version_changed_in_pr != 'true' run: | node -e " @@ -60,22 +55,64 @@ jobs: const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8')); const [maj, min, pat] = pkg.version.split('.').map(Number); const next = [maj, min, (pat || 0) + 1].join('.'); - pkg.version = next; fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2) + '\n'); console.log('Bumped version:', next); " - - name: Commit & Push (only if changed) + - name: Sync UI exports to dist/shared/index.d.ts + run: | + node -e " + const fs = require('fs'); + const path = require('path'); + const root = 'dist/shared'; + const indexPath = path.join(root, 'index.d.ts'); + const uiRoot = path.join(root, 'ui'); + const indexContent = fs.existsSync(indexPath) + ? fs.readFileSync(indexPath, 'utf8') + : ''; + function findIndexFiles(dir) { + const results = []; + for (const file of fs.readdirSync(dir)) { + const full = path.join(dir, file); + const stat = fs.statSync(full); + if (stat.isDirectory()) results.push(...findIndexFiles(full)); + else if (file === 'index.d.ts') results.push(full); + } + return results; + } + const uiFiles = findIndexFiles(uiRoot); + const exportsToAdd = []; + for (const file of uiFiles) { + const content = fs.readFileSync(file, 'utf8'); + const relPath = './' + path.relative(root, file).replace(/\\\\/g, '/').replace(/\\/g, '/'); + const exports = [...content.matchAll(/export\\s+\\{([^}]+)\\}\\s+from\\s+'\\.\\/([^']+)'/g)]; + for (const match of exports) { + const names = match[1].trim(); + const from = match[2].trim(); + const exportLine = \`export { \${names} } from '\${relPath.replace(/\\/index\\.d\\.ts$/, '')}/\${from}';\`; + if (!indexContent.includes(names)) { + exportsToAdd.push(exportLine); + } + } + } + if (exportsToAdd.length > 0) { + const newContent = indexContent.trim() + '\\n' + exportsToAdd.join('\\n') + '\\n'; + fs.writeFileSync(indexPath, newContent); + console.log('Added new exports:', exportsToAdd); + } else { + console.log('No new exports found.'); + } + " + + - name: Commit & Push (if version or export changed) run: | if git diff --quiet; then echo "No changes to commit. Skipping." exit 0 fi - git config user.name "github-actions[bot]" git config user.email "github-actions[bot]@users.noreply.github.com" - - git add package.json - git commit -m "chore: bump version on merge to main [skip ci]" + git add package.json dist/shared/index.d.ts + git commit -m "chore: bump version and sync UI exports [skip ci]" git push From 5cccbd8bab953bddcd866adfca8d3ca194af3d83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=8B=AC=EC=9C=A0=EC=A7=84?= Date: Sun, 19 Oct 2025 20:42:39 +0900 Subject: [PATCH 3/9] =?UTF-8?q?fix:=20=EC=A4=91=EB=B3=B5=EB=90=9C=20?= =?UTF-8?q?=EA=B2=BD=EB=A1=9C,=20=EB=A1=9C=EA=B7=B8=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/auto-bump-version.yaml | 98 ++++++++++-------------- 1 file changed, 42 insertions(+), 56 deletions(-) diff --git a/.github/workflows/auto-bump-version.yaml b/.github/workflows/auto-bump-version.yaml index e271aed4..ba211f90 100644 --- a/.github/workflows/auto-bump-version.yaml +++ b/.github/workflows/auto-bump-version.yaml @@ -3,7 +3,6 @@ name: Auto Bump Version on Merge to main on: pull_request: types: [closed] - workflow_dispatch: permissions: contents: write @@ -20,44 +19,37 @@ jobs: uses: actions/checkout@v4 with: ref: main - fetch-depth: 0 - name: Setup Node uses: actions/setup-node@v4 with: node-version: '20' - - name: Check if version was changed in PR - id: check_version_change + - name: Detect if package.json version changed in PR + id: ver_changed uses: actions/github-script@v7 with: script: | - const prNumber = context.payload.pull_request.number; - const { data: files } = await github.rest.pulls.listFiles({ + const pr = context.payload.pull_request.number; + const files = await github.paginate(github.rest.pulls.listFiles, { owner: context.repo.owner, repo: context.repo.repo, - pull_number: prNumber, - per_page: 250 + pull_number: pr, + per_page: 100 }); - const pkg = files.find(f => f.filename === 'package.json'); - let versionChanged = false; - if (pkg && pkg.patch) { - const touched = pkg.patch.includes('"version"'); - if (touched) versionChanged = true; - } - core.setOutput('version_changed_in_pr', versionChanged ? 'true' : 'false'); + const touched = files.some(f => f.filename === 'package.json' && /"version"\s*:/.test(f.patch || '')); + core.setOutput('changed', touched ? 'true' : 'false'); - name: Bump patch version (+0.0.1) if not changed in PR - if: steps.check_version_change.outputs.version_changed_in_pr != 'true' + if: steps.ver_changed.outputs.changed != 'true' run: | node -e " const fs = require('fs'); - const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8')); - const [maj, min, pat] = pkg.version.split('.').map(Number); - const next = [maj, min, (pat || 0) + 1].join('.'); - pkg.version = next; - fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2) + '\n'); - console.log('Bumped version:', next); + const pkg = JSON.parse(fs.readFileSync('package.json','utf8')); + const [a,b,c] = pkg.version.split('.').map(Number); + pkg.version = [a,b,(c||0)+1].join('.'); + fs.writeFileSync('package.json', JSON.stringify(pkg,null,2)+'\n'); + console.log('Bumped to', pkg.version); " - name: Sync UI exports to dist/shared/index.d.ts @@ -65,54 +57,48 @@ jobs: node -e " const fs = require('fs'); const path = require('path'); + const posix = path.posix; const root = 'dist/shared'; - const indexPath = path.join(root, 'index.d.ts'); - const uiRoot = path.join(root, 'ui'); - const indexContent = fs.existsSync(indexPath) - ? fs.readFileSync(indexPath, 'utf8') - : ''; - function findIndexFiles(dir) { - const results = []; - for (const file of fs.readdirSync(dir)) { - const full = path.join(dir, file); - const stat = fs.statSync(full); - if (stat.isDirectory()) results.push(...findIndexFiles(full)); - else if (file === 'index.d.ts') results.push(full); - } - return results; - } + const indexPath = posix.join(root, 'index.d.ts'); + const uiRoot = posix.join(root, 'ui'); + if (!fs.existsSync(uiRoot)) { console.log('No dist/shared/ui found. Skip.'); process.exit(0); } + const indexContent = fs.existsSync(indexPath) ? fs.readFileSync(indexPath,'utf8') : ''; + const findIndexFiles = (dir) => { + return fs.readdirSync(dir, { withFileTypes: true }).flatMap(d => { + const p = posix.join(dir, d.name); + if (d.isDirectory()) return findIndexFiles(p); + return d.name === 'index.d.ts' ? [p] : []; + }); + }; const uiFiles = findIndexFiles(uiRoot); - const exportsToAdd = []; - for (const file of uiFiles) { - const content = fs.readFileSync(file, 'utf8'); - const relPath = './' + path.relative(root, file).replace(/\\\\/g, '/').replace(/\\/g, '/'); - const exports = [...content.matchAll(/export\\s+\\{([^}]+)\\}\\s+from\\s+'\\.\\/([^']+)'/g)]; - for (const match of exports) { - const names = match[1].trim(); - const from = match[2].trim(); - const exportLine = \`export { \${names} } from '\${relPath.replace(/\\/index\\.d\\.ts$/, '')}/\${from}';\`; - if (!indexContent.includes(names)) { - exportsToAdd.push(exportLine); - } + const adds = []; + for (const f of uiFiles) { + const content = fs.readFileSync(f, 'utf8'); + for (const m of content.matchAll(/export\s+\{([^}]+)\}\s+from\s+'\.\/([^']+)'/g)) { + const names = m[1].trim(); + const fromRel = m[2].trim(); + const base = f.replace(/\/index\.d\.ts$/, ''); + const line = \`export { \${names} } from '\${base.replace(root,'').replace(/^\//,'').length ? './' + base.slice(root.length+1) : '.'}/\${fromRel}';\`; + if (!indexContent.includes(names)) adds.push(line); } } - if (exportsToAdd.length > 0) { - const newContent = indexContent.trim() + '\\n' + exportsToAdd.join('\\n') + '\\n'; - fs.writeFileSync(indexPath, newContent); - console.log('Added new exports:', exportsToAdd); + if (adds.length) { + const next = (indexContent.trim() ? indexContent.trim()+'\n' : '') + adds.join('\n') + '\n'; + fs.writeFileSync(indexPath, next); + console.log('Added exports:', adds); } else { console.log('No new exports found.'); } " - - name: Commit & Push (if version or export changed) + - name: Commit & Push run: | if git diff --quiet; then - echo "No changes to commit. Skipping." + echo "No changes to commit." exit 0 fi git config user.name "github-actions[bot]" git config user.email "github-actions[bot]@users.noreply.github.com" - git add package.json dist/shared/index.d.ts + git add package.json dist/shared/index.d.ts || true git commit -m "chore: bump version and sync UI exports [skip ci]" git push From 0b6ff7d358aa1e0e9762988aab2029c62c1ba06c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=8B=AC=EC=9C=A0=EC=A7=84?= Date: Tue, 28 Oct 2025 20:01:44 +0900 Subject: [PATCH 4/9] =?UTF-8?q?fix:=20PR=EC=A0=9C=EB=AA=A9=20=EA=B8=B0?= =?UTF-8?q?=EB=B0=98=20=EB=B2=84=EC=A0=80=EB=8B=9D=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/auto-bump-version.yaml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/auto-bump-version.yaml b/.github/workflows/auto-bump-version.yaml index ba211f90..186a2053 100644 --- a/.github/workflows/auto-bump-version.yaml +++ b/.github/workflows/auto-bump-version.yaml @@ -45,9 +45,18 @@ jobs: run: | node -e " const fs = require('fs'); + const pr_title = context.payload.pull_request.title; const pkg = JSON.parse(fs.readFileSync('package.json','utf8')); const [a,b,c] = pkg.version.split('.').map(Number); - pkg.version = [a,b,(c||0)+1].join('.'); + let new_version; + + if (pr_title.toLowerCase().startsWith('feat')) { + new_version = [a,b+1,0].join('.'); + } else { + new_version = [a,b,c+1].join('.'); + } + + pkg.version = new_version; fs.writeFileSync('package.json', JSON.stringify(pkg,null,2)+'\n'); console.log('Bumped to', pkg.version); " From 416db69b29b653ee3f150263e7a823cf032b7bbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=8B=AC=EC=9C=A0=EC=A7=84?= Date: Wed, 29 Oct 2025 13:18:27 +0900 Subject: [PATCH 5/9] =?UTF-8?q?fix:=20npm=20publish,=20build,=20dependenci?= =?UTF-8?q?es=20=EC=84=A4=EC=B9=98=20=EB=8B=A8=EA=B3=84=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/auto-bump-version.yaml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/auto-bump-version.yaml b/.github/workflows/auto-bump-version.yaml index 186a2053..ca792561 100644 --- a/.github/workflows/auto-bump-version.yaml +++ b/.github/workflows/auto-bump-version.yaml @@ -24,6 +24,7 @@ jobs: uses: actions/setup-node@v4 with: node-version: '20' + registry-url: 'https://registry.npmjs.org' - name: Detect if package.json version changed in PR id: ver_changed @@ -61,6 +62,12 @@ jobs: console.log('Bumped to', pkg.version); " + - name: Install dependencies + run: npm ci + + - name: Build package + run: npm run build + - name: Sync UI exports to dist/shared/index.d.ts run: | node -e " @@ -111,3 +118,8 @@ jobs: git add package.json dist/shared/index.d.ts || true git commit -m "chore: bump version and sync UI exports [skip ci]" git push + + - name: Publish to npm + run: npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} From 56cf88f1fc8d95ec04e44978ebfd804df831ea06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=8B=AC=EC=9C=A0=EC=A7=84?= Date: Wed, 29 Oct 2025 13:44:58 +0900 Subject: [PATCH 6/9] =?UTF-8?q?fix=20Sync=20exports=20to=20index.ts=20?= =?UTF-8?q?=EB=A1=9C=EC=A7=81=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/auto-bump-version.yaml | 80 ++++++++++++++---------- 1 file changed, 46 insertions(+), 34 deletions(-) diff --git a/.github/workflows/auto-bump-version.yaml b/.github/workflows/auto-bump-version.yaml index ca792561..54e265a9 100644 --- a/.github/workflows/auto-bump-version.yaml +++ b/.github/workflows/auto-bump-version.yaml @@ -65,48 +65,60 @@ jobs: - name: Install dependencies run: npm ci - - name: Build package - run: npm run build - - - name: Sync UI exports to dist/shared/index.d.ts + - name: Sync exports to src/shared/index.ts (Revised) run: | node -e " const fs = require('fs'); const path = require('path'); - const posix = path.posix; - const root = 'dist/shared'; - const indexPath = posix.join(root, 'index.d.ts'); - const uiRoot = posix.join(root, 'ui'); - if (!fs.existsSync(uiRoot)) { console.log('No dist/shared/ui found. Skip.'); process.exit(0); } + const root = 'src/shared'; + const indexPath = path.join(root, 'index.ts'); const indexContent = fs.existsSync(indexPath) ? fs.readFileSync(indexPath,'utf8') : ''; - const findIndexFiles = (dir) => { - return fs.readdirSync(dir, { withFileTypes: true }).flatMap(d => { - const p = posix.join(dir, d.name); - if (d.isDirectory()) return findIndexFiles(p); - return d.name === 'index.d.ts' ? [p] : []; - }); - }; - const uiFiles = findIndexFiles(uiRoot); + const existingExports = new Set((indexContent.match(/from\\s+['\\\"](\\.\\/|\\.\\.\\/)([^'\\\"]+)['\\\"]/g) || []) + .map(line => line.match(/from\\s+['\\\"]([^'\\\"]+)['\\\"]/)[1])); + const adds = []; - for (const f of uiFiles) { - const content = fs.readFileSync(f, 'utf8'); - for (const m of content.matchAll(/export\s+\{([^}]+)\}\s+from\s+'\.\/([^']+)'/g)) { - const names = m[1].trim(); - const fromRel = m[2].trim(); - const base = f.replace(/\/index\.d\.ts$/, ''); - const line = \`export { \${names} } from '\${base.replace(root,'').replace(/^\//,'').length ? './' + base.slice(root.length+1) : '.'}/\${fromRel}';\`; - if (!indexContent.includes(names)) adds.push(line); - } + + const uiRoot = path.join(root, 'ui'); + const componentFiles = []; + + if (fs.existsSync(uiRoot)) { + fs.readdirSync(uiRoot, { withFileTypes: true }) + .filter(d => d.isDirectory()) + .forEach(dir => { + const dirPath = path.join(uiRoot, dir.name); + const innerItems = fs.readdirSync(dirPath, { withFileTypes: true }); + + for (const item of innerItems) { + if (item.isFile() && (item.name.endsWith('.ts') || item.name.endsWith('.tsx')) && item.name !== 'index.ts') { + componentFiles.push(path.join(dir.name, item.name)); + } + }); } - if (adds.length) { - const next = (indexContent.trim() ? indexContent.trim()+'\n' : '') + adds.join('\n') + '\n'; - fs.writeFileSync(indexPath, next); - console.log('Added exports:', adds); - } else { - console.log('No new exports found.'); + + for (const relativeFilePath of componentFiles) { + const componentName = path.basename(relativeFilePath, path.extname(relativeFilePath)); + const exportPath = './ui/' + relativeFilePath.replace(path.extname(relativeFilePath), ''); + + if (existingExports.has(exportPath)) { + continue; + } + const line = \`export { \${componentName} } from '\${exportPath}'\`; + adds.push(line); } + + + if (adds.length) { + const next = (indexContent.trim() ? indexContent.trim()+'\\n' : '') + adds.join(';\\n') + ';\\n'; + fs.writeFileSync(indexPath, next); + console.log('Added exports to index.ts:', adds); + } else { + console.log('No new files found to export.'); + } " + - name: Build package + run: npm run build + - name: Commit & Push run: | if git diff --quiet; then @@ -115,8 +127,8 @@ jobs: fi git config user.name "github-actions[bot]" git config user.email "github-actions[bot]@users.noreply.github.com" - git add package.json dist/shared/index.d.ts || true - git commit -m "chore: bump version and sync UI exports [skip ci]" + git add package.json src/shared/index.ts || true + git commit -m "chore: bump version and sync shared exports [skip ci]" git push - name: Publish to npm From cc75c0ac9d09281992b19a581a3ed98d61c026dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=8B=AC=EC=9C=A0=EC=A7=84?= Date: Wed, 29 Oct 2025 14:00:10 +0900 Subject: [PATCH 7/9] =?UTF-8?q?fix:=20=EA=B4=84=ED=98=B8=20=EB=88=84?= =?UTF-8?q?=EB=9D=BD=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/auto-bump-version.yaml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/auto-bump-version.yaml b/.github/workflows/auto-bump-version.yaml index 54e265a9..d288a6d3 100644 --- a/.github/workflows/auto-bump-version.yaml +++ b/.github/workflows/auto-bump-version.yaml @@ -75,12 +75,9 @@ jobs: const indexContent = fs.existsSync(indexPath) ? fs.readFileSync(indexPath,'utf8') : ''; const existingExports = new Set((indexContent.match(/from\\s+['\\\"](\\.\\/|\\.\\.\\/)([^'\\\"]+)['\\\"]/g) || []) .map(line => line.match(/from\\s+['\\\"]([^'\\\"]+)['\\\"]/)[1])); - const adds = []; - const uiRoot = path.join(root, 'ui'); const componentFiles = []; - if (fs.existsSync(uiRoot)) { fs.readdirSync(uiRoot, { withFileTypes: true }) .filter(d => d.isDirectory()) @@ -92,8 +89,9 @@ jobs: if (item.isFile() && (item.name.endsWith('.ts') || item.name.endsWith('.tsx')) && item.name !== 'index.ts') { componentFiles.push(path.join(dir.name, item.name)); } - }); - } + } + }); + } for (const relativeFilePath of componentFiles) { const componentName = path.basename(relativeFilePath, path.extname(relativeFilePath)); From 6491be569be0d5f6536fa3536cc919bb11981915 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=8B=AC=EC=9C=A0=EC=A7=84?= Date: Sun, 2 Nov 2025 18:13:00 +0900 Subject: [PATCH 8/9] =?UTF-8?q?style:=20=EC=9B=8C=ED=81=AC=ED=94=8C?= =?UTF-8?q?=EB=A1=9C=EC=9A=B0=20=ED=8F=AC=EB=A7=B7=ED=8C=85=20=EA=B0=9C?= =?UTF-8?q?=EC=84=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/auto-bump-version.yaml | 78 ++++++++++++------------ 1 file changed, 40 insertions(+), 38 deletions(-) diff --git a/.github/workflows/auto-bump-version.yaml b/.github/workflows/auto-bump-version.yaml index d288a6d3..0aab9399 100644 --- a/.github/workflows/auto-bump-version.yaml +++ b/.github/workflows/auto-bump-version.yaml @@ -2,7 +2,8 @@ name: Auto Bump Version on Merge to main on: pull_request: - types: [closed] + types: + - closed permissions: contents: write @@ -47,18 +48,18 @@ jobs: node -e " const fs = require('fs'); const pr_title = context.payload.pull_request.title; - const pkg = JSON.parse(fs.readFileSync('package.json','utf8')); - const [a,b,c] = pkg.version.split('.').map(Number); + const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8')); + const [a, b, c] = pkg.version.split('.').map(Number); let new_version; if (pr_title.toLowerCase().startsWith('feat')) { - new_version = [a,b+1,0].join('.'); - } else { - new_version = [a,b,c+1].join('.'); + new_version = [a, b + 1, 0].join('.'); + } else { + new_version = [a, b, c + 1].join('.'); } pkg.version = new_version; - fs.writeFileSync('package.json', JSON.stringify(pkg,null,2)+'\n'); + fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2) + '\n'); console.log('Bumped to', pkg.version); " @@ -72,46 +73,47 @@ jobs: const path = require('path'); const root = 'src/shared'; const indexPath = path.join(root, 'index.ts'); - const indexContent = fs.existsSync(indexPath) ? fs.readFileSync(indexPath,'utf8') : ''; - const existingExports = new Set((indexContent.match(/from\\s+['\\\"](\\.\\/|\\.\\.\\/)([^'\\\"]+)['\\\"]/g) || []) - .map(line => line.match(/from\\s+['\\\"]([^'\\\"]+)['\\\"]/)[1])); + const indexContent = fs.existsSync(indexPath) ? fs.readFileSync(indexPath, 'utf8') : ''; + const existingExports = new Set( + (indexContent.match(/from\\s+['\\\"](\\.\\/|\\.\\.\\/)([^'\\\"]+)['\\\"]/g) || []) + .map(line => line.match(/from\\s+['\\\"]([^'\\\"]+)['\\\"]/)[1]) + ); const adds = []; const uiRoot = path.join(root, 'ui'); const componentFiles = []; if (fs.existsSync(uiRoot)) { - fs.readdirSync(uiRoot, { withFileTypes: true }) - .filter(d => d.isDirectory()) - .forEach(dir => { - const dirPath = path.join(uiRoot, dir.name); - const innerItems = fs.readdirSync(dirPath, { withFileTypes: true }); - - for (const item of innerItems) { - if (item.isFile() && (item.name.endsWith('.ts') || item.name.endsWith('.tsx')) && item.name !== 'index.ts') { - componentFiles.push(path.join(dir.name, item.name)); + fs.readdirSync(uiRoot, { withFileTypes: true }) + .filter(d => d.isDirectory()) + .forEach(dir => { + const dirPath = path.join(uiRoot, dir.name); + const innerItems = fs.readdirSync(dirPath, { withFileTypes: true }); + + for (const item of innerItems) { + if (item.isFile() && (item.name.endsWith('.ts') || item.name.endsWith('.tsx')) && item.name !== 'index.ts') { + componentFiles.push(path.join(dir.name, item.name)); } - } - }); - } + } + }); + } for (const relativeFilePath of componentFiles) { - const componentName = path.basename(relativeFilePath, path.extname(relativeFilePath)); - const exportPath = './ui/' + relativeFilePath.replace(path.extname(relativeFilePath), ''); - - if (existingExports.has(exportPath)) { - continue; - } - const line = \`export { \${componentName} } from '\${exportPath}'\`; - adds.push(line); + const componentName = path.basename(relativeFilePath, path.extname(relativeFilePath)); + const exportPath = './ui/' + relativeFilePath.replace(path.extname(relativeFilePath), ''); + + if (existingExports.has(exportPath)) { + continue; + } + const line = \`export { \${componentName} } from '\${exportPath}'\`; + adds.push(line); } - - if (adds.length) { - const next = (indexContent.trim() ? indexContent.trim()+'\\n' : '') + adds.join(';\\n') + ';\\n'; - fs.writeFileSync(indexPath, next); - console.log('Added exports to index.ts:', adds); - } else { - console.log('No new files found to export.'); - } + if (adds.length) { + const next = (indexContent.trim() ? indexContent.trim() + '\\n' : '') + adds.join(';\\n') + ';\\n'; + fs.writeFileSync(indexPath, next); + console.log('Added exports to index.ts:', adds); + } else { + console.log('No new files found to export.'); + } " - name: Build package From a3e0c91e178562b851dd807fbcf18debfe053b11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=8B=AC=EC=9C=A0=EC=A7=84?= Date: Tue, 4 Nov 2025 18:16:58 +0900 Subject: [PATCH 9/9] =?UTF-8?q?feat:=20major=EB=B2=84=EC=A0=84=20=EC=97=85?= =?UTF-8?q?=20=EA=B8=B0=EC=A4=80=20=EC=B6=94=EA=B0=80=20=EB=B0=8F=20?= =?UTF-8?q?=EB=A1=9C=EA=B7=B8=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/auto-bump-version.yaml | 47 ++++++++++++++++++++---- 1 file changed, 39 insertions(+), 8 deletions(-) diff --git a/.github/workflows/auto-bump-version.yaml b/.github/workflows/auto-bump-version.yaml index 0aab9399..ef277764 100644 --- a/.github/workflows/auto-bump-version.yaml +++ b/.github/workflows/auto-bump-version.yaml @@ -42,26 +42,61 @@ jobs: const touched = files.some(f => f.filename === 'package.json' && /"version"\s*:/.test(f.patch || '')); core.setOutput('changed', touched ? 'true' : 'false'); - - name: Bump patch version (+0.0.1) if not changed in PR + - name: Detect if new UI folder added + id: new_ui_folder + uses: actions/github-script@v7 + with: + script: | + const pr = context.payload.pull_request.number; + const files = await github.paginate(github.rest.pulls.listFiles, { + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: pr, + per_page: 100 + }); + + const addedDirs = new Set(); + for (const f of files) { + if (f.status === 'added' && f.filename.startsWith('src/shared/ui/')) { + const parts = f.filename.split('/'); + if (parts.length > 3) { + addedDirs.add(parts.slice(0, 4).join('/')); // 예: src/shared/ui/Button + } + } + } + + core.setOutput('new_ui_folder', addedDirs.size > 0 ? 'true' : 'false'); + console.log('New UI folders detected:', Array.from(addedDirs)); + + - name: Bump version based on PR type if: steps.ver_changed.outputs.changed != 'true' run: | node -e " const fs = require('fs'); - const pr_title = context.payload.pull_request.title; + const pr_title = process.env.PR_TITLE; + const is_new_ui = process.env.NEW_UI_FOLDER === 'true'; const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8')); const [a, b, c] = pkg.version.split('.').map(Number); let new_version; - if (pr_title.toLowerCase().startsWith('feat')) { + if (is_new_ui) { + new_version = [a + 1, 0, 0].join('.'); + console.log('Major bump (new UI folder added)'); + } else if (pr_title.toLowerCase().startsWith('feat')) { new_version = [a, b + 1, 0].join('.'); + console.log('Minor bump (feat detected)'); } else { new_version = [a, b, c + 1].join('.'); + console.log('Patch bump (default)'); } pkg.version = new_version; fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2) + '\n'); console.log('Bumped to', pkg.version); " + env: + PR_TITLE: ${{ github.event.pull_request.title }} + NEW_UI_FOLDER: ${{ steps.new_ui_folder.outputs.new_ui_folder }} - name: Install dependencies run: npm ci @@ -87,7 +122,6 @@ jobs: .forEach(dir => { const dirPath = path.join(uiRoot, dir.name); const innerItems = fs.readdirSync(dirPath, { withFileTypes: true }); - for (const item of innerItems) { if (item.isFile() && (item.name.endsWith('.ts') || item.name.endsWith('.tsx')) && item.name !== 'index.ts') { componentFiles.push(path.join(dir.name, item.name)); @@ -99,10 +133,7 @@ jobs: for (const relativeFilePath of componentFiles) { const componentName = path.basename(relativeFilePath, path.extname(relativeFilePath)); const exportPath = './ui/' + relativeFilePath.replace(path.extname(relativeFilePath), ''); - - if (existingExports.has(exportPath)) { - continue; - } + if (existingExports.has(exportPath)) continue; const line = \`export { \${componentName} } from '\${exportPath}'\`; adds.push(line); }