feat: Add CI/CD pipeline and code quality improvements
- Add GitHub Actions workflow for automated CI/CD - Configure Node.js 18.x and 20.x matrix testing - Add TypeScript type checking step - Add ESLint code quality checks with enhanced rules - Add Prettier formatting verification - Add production build validation - Upload build artifacts for deployment - Set up automated testing on push/PR - Replace console.log with environment-aware logger - Add pre-commit hooks for code quality - Exclude archive folder from linting 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1,13 +1,23 @@
|
||||
|
||||
import { format, parse, addMonths, subMonths } from 'date-fns';
|
||||
import { ko } from 'date-fns/locale';
|
||||
import { format, parse, addMonths, subMonths } from "date-fns";
|
||||
import { logger } from "@/utils/logger";
|
||||
import { ko } from "date-fns/locale";
|
||||
|
||||
/**
|
||||
* 월 이름 배열 (한국어)
|
||||
*/
|
||||
export const MONTHS_KR = [
|
||||
'1월', '2월', '3월', '4월', '5월', '6월',
|
||||
'7월', '8월', '9월', '10월', '11월', '12월'
|
||||
"1월",
|
||||
"2월",
|
||||
"3월",
|
||||
"4월",
|
||||
"5월",
|
||||
"6월",
|
||||
"7월",
|
||||
"8월",
|
||||
"9월",
|
||||
"10월",
|
||||
"11월",
|
||||
"12월",
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -22,7 +32,7 @@ export const isValidMonth = (month: string): boolean => {
|
||||
* 현재 년월 가져오기
|
||||
*/
|
||||
export const getCurrentMonth = (): string => {
|
||||
return format(new Date(), 'yyyy-MM');
|
||||
return format(new Date(), "yyyy-MM");
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -31,19 +41,19 @@ export const getCurrentMonth = (): string => {
|
||||
export const getPrevMonth = (month: string): string => {
|
||||
// 입력값 검증
|
||||
if (!isValidMonth(month)) {
|
||||
console.warn('유효하지 않은 월 형식:', month);
|
||||
logger.warn("유효하지 않은 월 형식:", month);
|
||||
return getCurrentMonth();
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
// 월 문자열을 날짜로 파싱
|
||||
const date = parse(month, 'yyyy-MM', new Date());
|
||||
const date = parse(month, "yyyy-MM", new Date());
|
||||
// 한 달 이전
|
||||
const prevMonth = subMonths(date, 1);
|
||||
// yyyy-MM 형식으로 반환
|
||||
return format(prevMonth, 'yyyy-MM');
|
||||
return format(prevMonth, "yyyy-MM");
|
||||
} catch (error) {
|
||||
console.error('이전 월 계산 중 오류:', error);
|
||||
logger.error("이전 월 계산 중 오류:", error);
|
||||
return getCurrentMonth();
|
||||
}
|
||||
};
|
||||
@@ -54,19 +64,19 @@ export const getPrevMonth = (month: string): string => {
|
||||
export const getNextMonth = (month: string): string => {
|
||||
// 입력값 검증
|
||||
if (!isValidMonth(month)) {
|
||||
console.warn('유효하지 않은 월 형식:', month);
|
||||
logger.warn("유효하지 않은 월 형식:", month);
|
||||
return getCurrentMonth();
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
// 월 문자열을 날짜로 파싱
|
||||
const date = parse(month, 'yyyy-MM', new Date());
|
||||
const date = parse(month, "yyyy-MM", new Date());
|
||||
// 한 달 이후
|
||||
const nextMonth = addMonths(date, 1);
|
||||
// yyyy-MM 형식으로 반환
|
||||
return format(nextMonth, 'yyyy-MM');
|
||||
return format(nextMonth, "yyyy-MM");
|
||||
} catch (error) {
|
||||
console.error('다음 월 계산 중 오류:', error);
|
||||
logger.error("다음 월 계산 중 오류:", error);
|
||||
return getCurrentMonth();
|
||||
}
|
||||
};
|
||||
@@ -78,16 +88,16 @@ export const formatMonthForDisplay = (month: string): string => {
|
||||
try {
|
||||
// 입력값 검증
|
||||
if (!isValidMonth(month)) {
|
||||
console.warn('유효하지 않은 월 형식:', month);
|
||||
return format(new Date(), 'yyyy년 MM월', { locale: ko });
|
||||
logger.warn("유효하지 않은 월 형식:", month);
|
||||
return format(new Date(), "yyyy년 MM월", { locale: ko });
|
||||
}
|
||||
|
||||
|
||||
// 월 문자열을 날짜로 파싱
|
||||
const date = parse(month, 'yyyy-MM', new Date());
|
||||
const date = parse(month, "yyyy-MM", new Date());
|
||||
// yyyy년 MM월 형식으로 반환 (한국어 로케일)
|
||||
return format(date, 'yyyy년 MM월', { locale: ko });
|
||||
return format(date, "yyyy년 MM월", { locale: ko });
|
||||
} catch (error) {
|
||||
console.error('월 형식 변환 중 오류:', error);
|
||||
logger.error("월 형식 변환 중 오류:", error);
|
||||
return month;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user