Skip to content

Commit 6491be5

Browse files
committed
style: 워크플로우 포맷팅 개선
1 parent cc75c0a commit 6491be5

1 file changed

Lines changed: 40 additions & 38 deletions

File tree

.github/workflows/auto-bump-version.yaml

Lines changed: 40 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ name: Auto Bump Version on Merge to main
22

33
on:
44
pull_request:
5-
types: [closed]
5+
types:
6+
- closed
67

78
permissions:
89
contents: write
@@ -47,18 +48,18 @@ jobs:
4748
node -e "
4849
const fs = require('fs');
4950
const pr_title = context.payload.pull_request.title;
50-
const pkg = JSON.parse(fs.readFileSync('package.json','utf8'));
51-
const [a,b,c] = pkg.version.split('.').map(Number);
51+
const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8'));
52+
const [a, b, c] = pkg.version.split('.').map(Number);
5253
let new_version;
5354
5455
if (pr_title.toLowerCase().startsWith('feat')) {
55-
new_version = [a,b+1,0].join('.');
56-
} else {
57-
new_version = [a,b,c+1].join('.');
56+
new_version = [a, b + 1, 0].join('.');
57+
} else {
58+
new_version = [a, b, c + 1].join('.');
5859
}
5960
6061
pkg.version = new_version;
61-
fs.writeFileSync('package.json', JSON.stringify(pkg,null,2)+'\n');
62+
fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2) + '\n');
6263
console.log('Bumped to', pkg.version);
6364
"
6465
@@ -72,46 +73,47 @@ jobs:
7273
const path = require('path');
7374
const root = 'src/shared';
7475
const indexPath = path.join(root, 'index.ts');
75-
const indexContent = fs.existsSync(indexPath) ? fs.readFileSync(indexPath,'utf8') : '';
76-
const existingExports = new Set((indexContent.match(/from\\s+['\\\"](\\.\\/|\\.\\.\\/)([^'\\\"]+)['\\\"]/g) || [])
77-
.map(line => line.match(/from\\s+['\\\"]([^'\\\"]+)['\\\"]/)[1]));
76+
const indexContent = fs.existsSync(indexPath) ? fs.readFileSync(indexPath, 'utf8') : '';
77+
const existingExports = new Set(
78+
(indexContent.match(/from\\s+['\\\"](\\.\\/|\\.\\.\\/)([^'\\\"]+)['\\\"]/g) || [])
79+
.map(line => line.match(/from\\s+['\\\"]([^'\\\"]+)['\\\"]/)[1])
80+
);
7881
const adds = [];
7982
const uiRoot = path.join(root, 'ui');
8083
const componentFiles = [];
8184
if (fs.existsSync(uiRoot)) {
82-
fs.readdirSync(uiRoot, { withFileTypes: true })
83-
.filter(d => d.isDirectory())
84-
.forEach(dir => {
85-
const dirPath = path.join(uiRoot, dir.name);
86-
const innerItems = fs.readdirSync(dirPath, { withFileTypes: true });
87-
88-
for (const item of innerItems) {
89-
if (item.isFile() && (item.name.endsWith('.ts') || item.name.endsWith('.tsx')) && item.name !== 'index.ts') {
90-
componentFiles.push(path.join(dir.name, item.name));
85+
fs.readdirSync(uiRoot, { withFileTypes: true })
86+
.filter(d => d.isDirectory())
87+
.forEach(dir => {
88+
const dirPath = path.join(uiRoot, dir.name);
89+
const innerItems = fs.readdirSync(dirPath, { withFileTypes: true });
90+
91+
for (const item of innerItems) {
92+
if (item.isFile() && (item.name.endsWith('.ts') || item.name.endsWith('.tsx')) && item.name !== 'index.ts') {
93+
componentFiles.push(path.join(dir.name, item.name));
9194
}
92-
}
93-
});
94-
}
95+
}
96+
});
97+
}
9598
9699
for (const relativeFilePath of componentFiles) {
97-
const componentName = path.basename(relativeFilePath, path.extname(relativeFilePath));
98-
const exportPath = './ui/' + relativeFilePath.replace(path.extname(relativeFilePath), '');
99-
100-
if (existingExports.has(exportPath)) {
101-
continue;
102-
}
103-
const line = \`export { \${componentName} } from '\${exportPath}'\`;
104-
adds.push(line);
100+
const componentName = path.basename(relativeFilePath, path.extname(relativeFilePath));
101+
const exportPath = './ui/' + relativeFilePath.replace(path.extname(relativeFilePath), '');
102+
103+
if (existingExports.has(exportPath)) {
104+
continue;
105+
}
106+
const line = \`export { \${componentName} } from '\${exportPath}'\`;
107+
adds.push(line);
105108
}
106109
107-
108-
if (adds.length) {
109-
const next = (indexContent.trim() ? indexContent.trim()+'\\n' : '') + adds.join(';\\n') + ';\\n';
110-
fs.writeFileSync(indexPath, next);
111-
console.log('Added exports to index.ts:', adds);
112-
} else {
113-
console.log('No new files found to export.');
114-
}
110+
if (adds.length) {
111+
const next = (indexContent.trim() ? indexContent.trim() + '\\n' : '') + adds.join(';\\n') + ';\\n';
112+
fs.writeFileSync(indexPath, next);
113+
console.log('Added exports to index.ts:', adds);
114+
} else {
115+
console.log('No new files found to export.');
116+
}
115117
"
116118
117119
- name: Build package

0 commit comments

Comments
 (0)