Skip to content

Commit 99ebaad

Browse files
authored
Merge pull request #60 from Team-Senifit/release-1.0.0
Release 1.0.0
2 parents 1c49e05 + 359cd05 commit 99ebaad

File tree

229 files changed

+27288
-3460
lines changed

Some content is hidden

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

229 files changed

+27288
-3460
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
* @Team-Senifit/senifit-frontend
1+
* @Team-Senifit/senifit-frontend
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Chromatic — develop full build
2+
3+
on:
4+
push:
5+
branches: [develop]
6+
7+
concurrency:
8+
group: chromatic-develop-${{ github.ref }}
9+
cancel-in-progress: true
10+
11+
jobs:
12+
chromatic:
13+
runs-on: ubuntu-latest
14+
env:
15+
TZ: Asia/Seoul
16+
steps:
17+
- uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
- uses: actions/setup-node@v4
21+
with:
22+
node-version: 20
23+
24+
- run: npm ci
25+
26+
- name: Run Chromatic (full build, auto-accept)
27+
run: >
28+
npx chromatic
29+
--project-token "${{ secrets.CHROMATIC_PROJECT_TOKEN }}"
30+
--force-rebuild
31+
--auto-accept-changes
32+
--exit-zero-on-changes
33+
--exit-once-uploaded

.github/workflows/chromatic-pr.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Chromatic — PR patch build
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened, ready_for_review]
6+
7+
concurrency:
8+
group: chromatic-pr-${{ github.event.pull_request.number }}
9+
cancel-in-progress: true
10+
11+
jobs:
12+
chromatic:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 0
18+
# PR 이벤트에선 head 리비전으로 체크아웃+환경변수 설정이 권장됨
19+
ref: ${{ github.event.pull_request.head.ref }}
20+
- uses: actions/setup-node@v4
21+
with:
22+
node-version: 20
23+
- run: npm ci
24+
25+
# Chromatic CLI로 patch build 실행
26+
- name: Run Chromatic (patch build)
27+
run: >
28+
npx chromatic
29+
--project-token "${{ secrets.CHROMATIC_PROJECT_TOKEN }}"
30+
--patch-build "${{ github.event.pull_request.head.ref }}...${{ github.event.pull_request.base.ref }}"
31+
--only-changed
32+
--exit-zero-on-changes
33+
env:
34+
# PR 이벤트에서의 베이스라인 꼬임 방지를 위해 권장 세팅
35+
CHROMATIC_BRANCH: ${{ github.event.pull_request.head.ref || github.ref_name }}
36+
CHROMATIC_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
37+
CHROMATIC_SLUG: ${{ github.repository }}

.github/workflows/deploy.yml

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
name: CI/CD Deploy
2+
3+
on:
4+
push:
5+
branches: ["develop"]
6+
workflow_dispatch: {}
7+
8+
concurrency:
9+
group: deploy-develop
10+
cancel-in-progress: true
11+
12+
jobs:
13+
build-and-deploy:
14+
runs-on: ubuntu-latest
15+
env:
16+
APP_DIR: /srv/senifit-front
17+
RELEASE_NAME: ${{ github.sha }}
18+
NODE_ENV: production
19+
NEXT_PUBLIC_API_BASE: ${{ secrets.NEXT_PUBLIC_API_BASE }}
20+
NEXT_PUBLIC_API_URL: ${{ secrets.NEXT_PUBLIC_API_URL }}
21+
API_PREFIX: ${{ secrets.API_PREFIX }}
22+
NEXT_PUBLIC_SITE_URL: ${{ secrets.NEXT_PUBLIC_SITE_URL }}
23+
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v4
27+
28+
- name: Setup Node
29+
uses: actions/setup-node@v4
30+
with:
31+
node-version: "22.x"
32+
cache: "npm"
33+
34+
- name: Install deps
35+
run: npm ci
36+
37+
- name: Build
38+
run: npm run build
39+
40+
# next는 dependencies에 있어야 함. devDeps는 제거해 산출물 슬림화
41+
- name: Prune devDependencies
42+
run: npm prune --omit=dev
43+
44+
- name: Create deploy package
45+
run: |
46+
set -euo pipefail
47+
mkdir -p deploy
48+
# 실행에 필요한 산출물만 포함 (.next, node_modules, 정적파일, 설정)
49+
cp -r .next node_modules package.json package-lock.json public next.config.* deploy/ 2>/dev/null || true
50+
tar -C deploy -czf release.tgz .
51+
52+
- name: Add SSH key
53+
uses: webfactory/ssh-agent@v0.9.0
54+
with:
55+
ssh-private-key: ${{ secrets.EC2_SSH_KEY }}
56+
57+
- name: Known hosts
58+
run: |
59+
set -euo pipefail
60+
mkdir -p ~/.ssh
61+
ssh-keyscan -H "${{ secrets.EC2_HOST }}" >> ~/.ssh/known_hosts
62+
63+
- name: Remote prep (cleanup & prepare)
64+
env:
65+
EC2_USER: ${{ secrets.EC2_USER }}
66+
EC2_HOST: ${{ secrets.EC2_HOST }}
67+
run: |
68+
ssh "$EC2_USER@$EC2_HOST" bash -se <<'PREP'
69+
set -euo pipefail
70+
APP_DIR="/srv/senifit-front"
71+
72+
mkdir -p "$APP_DIR/releases"
73+
cd "$APP_DIR/releases"
74+
75+
# 최신 3개만 보존
76+
ls -1t | tail -n +4 | xargs -r rm -rf
77+
78+
# current가 아닌 릴리즈의 캐시/모듈 정리 (추가 공간 확보)
79+
CURR="$(readlink -f "$APP_DIR/current" || true)"
80+
for d in "$APP_DIR"/releases/*; do
81+
[ -d "$d" ] || continue
82+
if [ "$(readlink -f "$d")" != "$CURR" ]; then
83+
rm -rf "$d/.next/cache" "$d/node_modules" || true
84+
fi
85+
done
86+
PREP
87+
88+
- name: Remote deploy (stream extract, swap, restart)
89+
env:
90+
EC2_USER: ${{ secrets.EC2_USER }}
91+
EC2_HOST: ${{ secrets.EC2_HOST }}
92+
RELEASE_NAME: ${{ env.RELEASE_NAME }}
93+
SERVICE_USER: ${{ secrets.SERVICE_USER }}
94+
run: |
95+
set -euo pipefail
96+
APP_DIR="/srv/senifit-front"
97+
REL="${RELEASE_NAME}"
98+
SVC="${SERVICE_USER:-ubuntu}"
99+
100+
cat release.tgz | ssh -o StrictHostKeyChecking=yes "$EC2_USER@$EC2_HOST" \
101+
"set -euo pipefail; APP_DIR='$APP_DIR'; REL='$REL'; \
102+
mkdir -p \"\$APP_DIR/releases/\$REL\"; \
103+
tar -xzf - -C \"\$APP_DIR/releases/\$REL\""
104+
105+
ssh -o StrictHostKeyChecking=yes "$EC2_USER@$EC2_HOST" \
106+
"set -euo pipefail; APP_DIR='$APP_DIR'; REL='$REL'; SVC='$SVC'; \
107+
chown -R \"\$SVC:\$SVC\" \"\$APP_DIR/releases/\$REL\"; \
108+
ln -sfn \"\$APP_DIR/releases/\$REL\" \"\$APP_DIR/current\"; \
109+
sudo systemctl daemon-reload; \
110+
sudo systemctl restart senifit-front"
111+
112+
- name: Public healthcheck (non-blocking)
113+
continue-on-error: true
114+
run: |
115+
curl -fsS -o /dev/null https://senifit.co.kr || echo "::warning::Public healthcheck failed"

.github/workflows/pr-checks.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: PR Checks (typecheck & lint)
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened, ready_for_review]
6+
branches: [ main, develop ]
7+
paths-ignore:
8+
- '**/*.md'
9+
- 'docs/**'
10+
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.ref }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
checks:
17+
if: github.event.pull_request.draft == false
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
24+
- name: Setup Node.js
25+
uses: actions/setup-node@v4
26+
with:
27+
node-version: '22.x'
28+
cache: 'npm'
29+
cache-dependency-path: package-lock.json
30+
31+
- name: Install deps
32+
run: npm ci
33+
34+
# ---- Typecheck ----
35+
- name: TypeScript typecheck
36+
if: ${{ hashFiles('tsconfig.json') != '' }}
37+
env:
38+
NEXT_TELEMETRY_DISABLED: 1
39+
run: |
40+
if npm run | grep -qE '^ *typecheck'; then
41+
npm run typecheck
42+
else
43+
npx -y typescript tsc --noEmit
44+
fi
45+
46+
# ---- Lint ----
47+
- name: ESLint (warnings allowed)
48+
env:
49+
NEXT_TELEMETRY_DISABLED: 1
50+
run: |
51+
if npm run | grep -qE '^ *lint'; then
52+
# 패키지 스크립트 내에 --max-warnings=0 이 있더라도 --quiet로 경고를 숨겨 통과
53+
npm run lint -- --quiet
54+
else
55+
# 스크립트가 없으면 직접 실행 (경고는 무시, 에러만 실패)
56+
npx -y eslint . --quiet
57+
fi

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,11 @@ yarn-error.log*
3939
# typescript
4040
*.tsbuildinfo
4141
next-env.d.ts
42+
43+
*storybook.log
44+
storybook-static
45+
46+
**/localhost-key.pem
47+
**/localhost.pem
48+
49+
/certs

.prettierrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"singleQuote": false,
3+
"jsxSingleQuote": false,
4+
"printWidth": 80
5+
}

.storybook/main.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import type { StorybookConfig } from "@storybook/nextjs";
2+
import TsconfigPathsPlugin from "tsconfig-paths-webpack-plugin";
3+
4+
const config: StorybookConfig = {
5+
stories: ["../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"],
6+
addons: ["@storybook/addon-docs"],
7+
docs: {
8+
defaultName: "Documentation",
9+
},
10+
framework: {
11+
name: "@storybook/nextjs",
12+
options: {},
13+
},
14+
staticDirs: ["../public"],
15+
webpackFinal: async (config) => {
16+
if (config.resolve) {
17+
config.resolve.plugins = [
18+
...(config.resolve.plugins || []),
19+
new TsconfigPathsPlugin({
20+
configFile: "./tsconfig.json",
21+
}),
22+
];
23+
}
24+
return config;
25+
},
26+
};
27+
export default config;

.storybook/preview.tsx

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { ThemeProvider } from "@mui/material";
2+
import type { Preview } from "@storybook/react";
3+
import SenifitThemeProvider from "../src/app/panel/SenifitThemeProvider.tsx";
4+
5+
const preview: Preview = {
6+
tags: ["autodocs"],
7+
parameters: {
8+
controls: {
9+
matchers: {
10+
color: /(background|color)$/i,
11+
date: /Date$/i,
12+
},
13+
},
14+
backgrounds: {
15+
options: {
16+
default: { name: "default", value: "#F5F7FA" },
17+
paper: { name: "paper", value: "#FFFFFF" },
18+
},
19+
},
20+
initialGlobals: {
21+
backgrounds: { value: "default" },
22+
},
23+
},
24+
decorators: [
25+
(Story) => (
26+
<SenifitThemeProvider>
27+
<Story />
28+
</SenifitThemeProvider>
29+
),
30+
],
31+
};
32+
33+
export default preview;

0 commit comments

Comments
 (0)