Skip to content

Commit 5697585

Browse files
authored
v1.0.0
- Re-release v1.0.0
2 parents c6c0c84 + 6e308e0 commit 5697585

File tree

443 files changed

+20854
-7720
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

443 files changed

+20854
-7720
lines changed

.eslintrc.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
"extends": [
1313
"eslint:recommended",
1414
"plugin:@typescript-eslint/recommended",
15-
"next/core-web-vitals"
15+
"next/core-web-vitals",
16+
"plugin:storybook/recommended"
1617
],
1718
"rules": {
1819
"@typescript-eslint/no-unused-vars": [

.github/ISSUE_TEMPLATE/issue-template.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name: Issue template
33
about: 프로덕트 백로그를 등록합니다.
44
title: ''
5-
labels: [🐥 프론트, ✨ feature]
5+
labels: [🐥 프론트, ✨ feature, 🔥 v.1.0]
66
assignees: ''
77
---
88

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
const core = require('@actions/core');
2+
3+
try {
4+
// 점수 지표 파일 정보
5+
const fs = require('fs');
6+
const results = JSON.parse(fs.readFileSync('./lhci_reports/manifest.json'));
7+
const totalReports = results.length;
8+
9+
// LightHouse 점수 지표
10+
const averageScores = {
11+
performance: 0,
12+
accessibility: 0,
13+
'best-practices': 0,
14+
seo: 0,
15+
pwa: 0,
16+
};
17+
const auditSummaries = {
18+
'first-contentful-paint': 0,
19+
'largest-contentful-paint': 0,
20+
interactive: 0,
21+
'total-blocking-time': 0,
22+
'cumulative-layout-shift': 0,
23+
};
24+
25+
// 점수 평균
26+
results.forEach(result => {
27+
const { summary } = result;
28+
29+
for (const key in averageScores) {
30+
averageScores[key] += summary[key];
31+
}
32+
33+
const details = JSON.parse(fs.readFileSync(result.jsonPath));
34+
[
35+
'first-contentful-paint',
36+
'largest-contentful-paint',
37+
'interactive',
38+
'total-blocking-time',
39+
'cumulative-layout-shift',
40+
].forEach(auditName => {
41+
if (details.audits[auditName]) {
42+
const auditDetails = details.audits[auditName];
43+
auditSummaries[auditName] += parseFloat(auditDetails.displayValue) || 0;
44+
}
45+
});
46+
});
47+
48+
// 점수 색상 표시
49+
const formatScore = res => (res >= 90 ? '🟢' : res >= 70 ? '🟠' : '🔴');
50+
51+
// 상세 지표 점수 색상 표시
52+
const detailScore = (value, metric) => {
53+
switch (metric) {
54+
case 'first-contentful-paint':
55+
return value <= 1.8 ? '🟢' : value <= 3 ? '🟠' : '🔴';
56+
case 'largest-contentful-paint':
57+
return value <= 2.5 ? '🟢' : value <= 4 ? '🟠' : '🔴';
58+
case 'interactive':
59+
return value <= 3.8 ? '🟢' : value <= 7.3 ? '🟠' : '🔴';
60+
case 'total-blocking-time':
61+
return value <= 300 ? '🟢' : value <= 600 ? '🟠' : '🔴';
62+
case 'cumulative-layout-shift':
63+
return value <= 0.1 ? '🟢' : value <= 0.25 ? '🟠' : '🔴';
64+
default:
65+
return '🔴'; // Default to red if metric is unknown
66+
}
67+
};
68+
69+
// comments 파싱
70+
let comments =
71+
'⚡️ Lighthouse Average Scores Across Reports:\n| Category | Score |\n| --- | --- |\n';
72+
Object.keys(averageScores).forEach(key => {
73+
const avgScore = Math.round((averageScores[key] / totalReports) * 100);
74+
comments += `| ${formatScore(avgScore)} ${key.replace(
75+
/-/g,
76+
' '
77+
)} | ${avgScore} |\n`;
78+
});
79+
80+
comments +=
81+
'\n⚡️ Average Details Across All Reports:\n| Category | Score |\n| --- | --- |\n';
82+
Object.keys(auditSummaries).forEach(auditName => {
83+
const average = auditSummaries[auditName] / totalReports;
84+
const formattedName = auditName.replace(/-/g, ' ');
85+
const colorCode = detailScore(average, auditName);
86+
const unit =
87+
auditName === 'total-blocking-time'
88+
? 'ms'
89+
: auditName === 'cumulative-layout-shift'
90+
? ''
91+
: 's';
92+
comments += `| ${colorCode} ${formattedName} | ${average.toFixed(
93+
1
94+
)}${unit} |\n`;
95+
});
96+
97+
// comments 내보내기
98+
core.setOutput('comments', comments);
99+
} catch (error) {
100+
console.error(error);
101+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name: 'get-score-comments'
2+
description: 'Get Score Comments'
3+
4+
outputs:
5+
comments:
6+
description: 'Comments that Parsed Scores'
7+
8+
runs:
9+
using: 'node16'
10+
main: 'action.js'

.github/workflows/chromatic.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Storybook Deployment
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
8+
jobs:
9+
chromatic-deploy:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout repository
13+
uses: actions/checkout@v3
14+
with:
15+
fetch-depth: 0
16+
17+
- uses: actions/setup-node@v3
18+
with:
19+
node-version: 18
20+
cache: 'yarn'
21+
22+
- name: Install Dependency
23+
run: yarn install --immutable
24+
25+
- name: Set .env
26+
run: echo "${{ vars.DEVELOPMENT_ENV }}" > .env.local
27+
28+
- name: Publish Chromatic
29+
id: chromatic
30+
uses: chromaui/action@v1
31+
with:
32+
projectToken: ${{ secrets.CHROMATIC_TOKEN }}
33+
34+
- name: Find Comment
35+
if: github.event_name == 'pull_request'
36+
uses: peter-evans/find-comment@v2
37+
id: find_comment
38+
with:
39+
issue-number: ${{ github.event.pull_request.number }}
40+
comment-author: 'github-actions[bot]'
41+
body-includes: 🚀 Storybook
42+
43+
- name: Create or update comment
44+
if: github.event_name == 'pull_request'
45+
uses: peter-evans/create-or-update-comment@v2
46+
with:
47+
comment-id: ${{ steps.find_comment.outputs.comment-id }}
48+
issue-number: ${{ github.event.pull_request.number }}
49+
body: '🚀 Storybook: ${{ steps.chromatic.outputs.storybookUrl }}'
50+
edit-mode: replace

.github/workflows/lighthouse.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: LightHouse CI
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
8+
jobs:
9+
lhci:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v3
14+
15+
- name: Use Node.js 18
16+
uses: actions/setup-node@v3
17+
with:
18+
node-version: 18
19+
cache: 'yarn'
20+
21+
- name: Install packages
22+
run: yarn install && yarn global add @lhci/[email protected] && yarn add @actions/core
23+
24+
- name: Set .env
25+
run: echo "${{ vars.DEVELOPMENT_ENV }}" > .env.local
26+
27+
- name: Build
28+
run: yarn build
29+
30+
- name: Run Lighthouse CI
31+
run: lhci autorun
32+
env:
33+
LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }}
34+
35+
- name: Get Score Comments
36+
id: get-score-comments
37+
uses: ./.github/actions/get-score-comments
38+
39+
- name: Find Comment
40+
if: github.event_name == 'pull_request'
41+
uses: peter-evans/find-comment@v2
42+
id: find_comment
43+
with:
44+
issue-number: ${{ github.event.pull_request.number }}
45+
comment-author: 'github-actions[bot]'
46+
body-includes: ⚡️ Lighthouse Average Scores Across Reports
47+
48+
- name: Create or update comment
49+
if: github.event_name == 'pull_request'
50+
uses: peter-evans/create-or-update-comment@v2
51+
with:
52+
comment-id: ${{ steps.find_comment.outputs.comment-id }}
53+
issue-number: ${{ github.event.pull_request.number }}
54+
body: ${{ steps.get-score-comments.outputs.comments }}
55+
edit-mode: replace

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,12 @@ yarn-error.log*
3434
# typescript
3535
*.tsbuildinfo
3636
next-env.d.ts
37+
38+
# auto generated pwa files
39+
# Auto Generated PWA files
40+
**/public/sw.js
41+
**/public/workbox-*.js
42+
**/public/worker-*.js
43+
**/public/sw.js.map
44+
**/public/workbox-*.js.map
45+
**/public/worker-*.js.map
File renamed without changes.

.storybook/main.ts

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import type { StorybookConfig } from '@storybook/nextjs';
2+
const config: StorybookConfig = {
3+
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'],
4+
staticDirs: ['../public'],
5+
addons: [
6+
'@storybook/addon-links',
7+
'@storybook/addon-essentials',
8+
'@storybook/addon-interactions',
9+
'@storybook/addon-styling',
10+
],
11+
framework: {
12+
name: '@storybook/nextjs',
13+
options: {},
14+
},
15+
docs: {
16+
autodocs: 'tag',
17+
},
18+
webpackFinal: async config => {
19+
const imageRule = config.module?.rules?.find(rule => {
20+
const test = (rule as { test: RegExp }).test;
21+
22+
if (!test) {
23+
return false;
24+
}
25+
26+
return test.test('.svg');
27+
}) as { [key: string]: any };
28+
29+
imageRule.exclude = /\.svg$/;
30+
31+
config.module?.rules?.push({
32+
test: /\.svg$/,
33+
use: ['@svgr/webpack'],
34+
});
35+
36+
return config;
37+
},
38+
};
39+
export default config;

0 commit comments

Comments
 (0)