Skip to content

Commit

Permalink
Merge branch 'main' into chore/update-eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
froggy1014 committed Jan 26, 2025
2 parents 7ea8abd + 5c593bb commit cf09ad0
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 32 deletions.
3 changes: 2 additions & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
* @kimdaeyeobbb @hy57in @developerjhp @bae-sh @noahluftyang @froggy1014 @heeji289 @synuns @yeojini @SEMIN-97
* @kimdaeyeobbb @hy57in @developerjhp @bae-sh @noahluftyang @froggy1014 @heeji289 @synuns @yeojini @SEMIN-97 @jiji-hoon96

10 changes: 5 additions & 5 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,11 @@ Before proposing changes, please **open an issue** to discuss the bug or feature
```
We recommend following the Conventional Commits standard for clear and consistent commit messages. Below is the suggested structure:

| Element | Requirement | Description |
|--------------|--------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `<type>` | **Required** | Describes the purpose of the commit. Examples: `feat`, `fix`, `docs`, `style`, `refactor`, `test`. |
| `<scope>` | **Optional** | Specifies the affected module, file, or functionality. Limited to **20 characters** (e.g., `auth`, `header`). |
| `<subject>` | **Required** | A concise summary of the changes:<br/> - Starts with a lowercase letter.<br/> - Avoid ending with a period (`.`).<br/> - Limited to **50 characters**. - Written in **English**. |
| Element | Requirement | Description |
|--------------|--------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `<type>` | **Required** | Describes the purpose of the commit. Examples: `feat`, `fix`, `docs`, `style`, `refactor`, `test` |
| `<scope>` | **Optional** | Specifies the affected module, file, or functionality. Limited to **20 characters** (e.g., `auth`, `header`). |
| `<subject>` | **Required** | A concise summary of the changes<br/> - Starts with a lowercase letter<br/> - Avoid ending with a period (.)<br/> - Limited to **50 characters**<br/> - Must contain only English characters, numbers, and basic punctuation (!@#$%^&*(),.?":{}|<>_-)<br/> - Cannot be empty |



Expand Down
20 changes: 19 additions & 1 deletion .github/workflows/chromatic.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
name: Chromatic

on:
pull_request:
types: [opened, ready_for_review, synchronize]
branches:
- main
paths:
- '**/*.stories.@(js|jsx|ts|tsx)'
push:

branches:
- main
paths:
- '**/*.stories.@(js|jsx|ts|tsx)'

jobs:
chromatic:
runs-on: ubuntu-latest
Expand All @@ -23,6 +33,14 @@ jobs:
- name: Install dependencies
run: pnpm install
- name: Run Chromatic
id: chromatic
uses: chromaui/action@latest
with:
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
- name: comment PR
uses: thollander/actions-comment-pull-request@v1
if: ${{ github.event_name == 'pull_request' }}
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_BOT_TOKEN }}
with:
message: "💅 The Storybook has been updated! Click [here](${{ steps.chromatic.outputs.storybookUrl }}) to check it out."
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
id: changesets
uses: changesets/action@v1
with:
version: pnpm changeset version --ignore @sipe-team/package-name
version: pnpm changeset version
publish: pnpm changeset publish
commit: "chore(release): version packages"
env:
Expand Down
3 changes: 2 additions & 1 deletion .templates/component/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,6 @@
"./styles.css": "./dist/index.css"
}
},
"sideEffects": false
"sideEffects": false,
"private": true
}
38 changes: 15 additions & 23 deletions scripts/createComponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,7 @@ class CreateComponentCommand extends Command {
}
}

async copyRecursive(
source: string,
target: string,
kebabCaseName: string,
pascalCaseName: string,
) {
async copyRecursive(source: string, target: string, kebabCaseName: string, pascalCaseName: string) {
const currentFolder = path.basename(source);

if (this.excludePatterns.includes(currentFolder)) {
Expand All @@ -59,26 +54,28 @@ class CreateComponentCommand extends Command {
const sourcePath = path.join(source, entry.name);
const newName = entry.name.replaceAll('Component', pascalCaseName);
const targetPath = path.join(target, newName);
await this.copyRecursive(
sourcePath,
targetPath,
kebabCaseName,
pascalCaseName,
);
await this.copyRecursive(sourcePath, targetPath, kebabCaseName, pascalCaseName);
}
}
} else {
const content = await fs.readFile(source, 'utf-8');
const updatedContent = Object.entries(patterns).reduce(
(content, [search, replace]) =>
content.replace(new RegExp(search, 'g'), replace),
(content, [search, replace]) => content.replace(new RegExp(search, 'g'), replace),
content,
);

await fs.writeFile(target, updatedContent);
}
}

private async updatePackageJson(targetDir: string): Promise<void> {
const packageJsonPath = path.join(targetDir, 'package.json');
const packageJson = JSON.parse(await fs.readFile(packageJsonPath, 'utf-8'));

const { private: _, ...newPackageJson } = packageJson;
await fs.writeFile(packageJsonPath, JSON.stringify(newPackageJson, null, 2));
}

async execute() {
const loading = spinner();

Expand Down Expand Up @@ -109,22 +106,17 @@ class CreateComponentCommand extends Command {
const targetDir = path.join(process.cwd(), 'packages', kebabCaseName);

await this.validateTemplateDir(templateDir);
await this.copyRecursive(
templateDir,
targetDir,
kebabCaseName,
pascalCaseName,
);
await this.copyRecursive(templateDir, targetDir, kebabCaseName, pascalCaseName);

await this.updatePackageJson(targetDir);

loading.stop('템플릿 복사 완료! ✨');
outro(`${pascalCaseName} 컴포넌트가 성공적으로 생성되었습니다! 🎉`);

return 0;
} catch (error) {
loading.stop('오류 발생');
console.error(
`Error: ${error instanceof Error ? error.message : '알 수 없는 오류가 발생했습니다'}`,
);
console.error(`Error: ${error instanceof Error ? error.message : '알 수 없는 오류가 발생했습니다'}`);
return 1;
}
}
Expand Down

0 comments on commit cf09ad0

Please sign in to comment.