diff --git a/docs/src/pages/docs/advantages/reliability.en.mdx b/docs/src/pages/docs/advantages/reliability.en.mdx new file mode 100644 index 00000000..67921160 --- /dev/null +++ b/docs/src/pages/docs/advantages/reliability.en.mdx @@ -0,0 +1,14 @@ +--- +title: reliability +--- + +import Reliability from './reliability.tsx'; + +# πŸ’― Providing High Reliability + +`es-hangul` has achieved 100% test coverage by adopting a testing framework. This means that all features of the library have been thoroughly verified, minimizing unexpected errors. Built on high reliability, it offers stable and predictable performance, so you can confidently incorporate it into your projects. Experience a new standard in Hangul processing by utilizing `es-hangul` now! + +
+
+ + diff --git a/docs/src/pages/docs/advantages/reliability.ko.mdx b/docs/src/pages/docs/advantages/reliability.ko.mdx new file mode 100644 index 00000000..3fe04428 --- /dev/null +++ b/docs/src/pages/docs/advantages/reliability.ko.mdx @@ -0,0 +1,14 @@ +--- +title: reliability +--- + +import Reliability from './reliability.tsx'; + +# πŸ’― 높은 μ‹ λ’°μ„± 제곡 + +`es-hangul`은 ν…ŒμŠ€νŒ… ν”„λ ˆμž„μ›Œν¬λ₯Ό λ„μž…ν•˜μ—¬ ν…ŒμŠ€νŠΈ 컀버리지 100%λ₯Ό λ‹¬μ„±ν•˜μ˜€μŠ΅λ‹ˆλ‹€. μ΄λŠ” 라이브러리의 λͺ¨λ“  κΈ°λŠ₯이 μ² μ €ν•˜κ²Œ κ²€μ¦λ˜μ—ˆμŒμ„ μ˜λ―Έν•˜λ©°, 예기치 μ•Šμ€ 였λ₯˜λ₯Ό μ΅œμ†Œν™”ν•©λ‹ˆλ‹€. 높은 신뒰성을 λ°”νƒ•μœΌλ‘œ μ•ˆμ •μ μ΄κ³  예츑 κ°€λŠ₯ν•œ μ„±λŠ₯을 μ œκ³΅ν•˜λ―€λ‘œ, μ•ˆμ‹¬ν•˜κ³  ν”„λ‘œμ νŠΈμ— λ„μž…ν•˜μ‹€ 수 μžˆμŠ΅λ‹ˆλ‹€. μ§€κΈˆ `es-hangul`을 ν™œμš©ν•˜μ—¬ ν•œκΈ€ 처리의 μƒˆλ‘œμš΄ 기쀀을 κ²½ν—˜ν•΄ λ³΄μ„Έμš”! + +
+
+ + diff --git a/docs/src/pages/docs/advantages/reliability.tsx b/docs/src/pages/docs/advantages/reliability.tsx new file mode 100644 index 00000000..e7d932f9 --- /dev/null +++ b/docs/src/pages/docs/advantages/reliability.tsx @@ -0,0 +1,162 @@ +import coverageJSON from '../../../../../coverage/coverage-summary.json'; + +type Locale = 'ko' | 'en'; + +interface TypeSupportTableProps { + locale: Locale; +} + +export default function Reliability({ locale }: TypeSupportTableProps) { + const isKorean = locale === 'ko'; + const statements = isKorean ? 'λ¬Έμž₯' : 'Statements'; + const branches = isKorean ? '브랜치' : 'Branches'; + const functions = isKorean ? 'ν•¨μˆ˜' : 'Functions'; + const lines = isKorean ? '라인' : 'Lines'; + + const { total: totalCoverage, ...fileEntries } = coverageJSON; + + const isValidFilePath = (filePath: string): boolean => { + // src λ’€ 2-depthκΉŒμ§€μ˜ 경둜λ₯Ό ν•„ν„°λ§ν•˜λ©°, anything.something.ts λ“±μ˜ λͺ…칭을 가진 νŒŒμΌλ“€μ€ λ°˜ν™˜λ˜μ§€ μ•Šλ„λ‘ `.ts`둜 λλ‚˜λ˜ μΆ”κ°€ 점(`.`)이 μ—†λŠ” 경우만 ν—ˆμš© + const regex = /\/src\/[^/]+\/[^/]+(? { + return filePath.split('/').pop()?.split('.')[0]; + }; + + const filterValidFileEntries = (coverageFileEntries: typeof fileEntries) => { + return Object.entries(coverageFileEntries) + .filter(([filePath]) => isValidFilePath(filePath)) + .flatMap(([filePath, info]) => { + const filename = extractFileName(filePath); + + return filename != null ? [[filename, info] as const] : []; + }); + }; + + return ( +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ {isKorean ? 'es-hangul의 ν…ŒμŠ€νŠΈ 컀버리지 ν•­λͺ©' : "es-hangul's test coverage item"} +
+ {isKorean ? 'ν…ŒμŠ€νŠΈ 컀버리지 ν•­λͺ©' : 'Test coverage item'} + + {isKorean ? '컀버리지 λΉ„μœ¨' : 'Coverage percentage'} +
+ {statements} +
+ + ℹ️  + {isKorean + ? 'μ½”λ“œμ—μ„œ μ‹€ν–‰ κ°€λŠ₯ν•œ λͺ¨λ“  λ¬Έμž₯이 ν…ŒμŠ€νŠΈμ—μ„œ μ‹€ν–‰λ˜μ—ˆλŠ”μ§€' + : 'Whether all executable statements in the code have been executed during testing'} + +
βœ… ({totalCoverage.statements.pct}%)
+ {branches} +
+ + ℹ️  + {isKorean + ? '쑰건문(if, else, switch λ“±)μ—μ„œ λ°œμƒν•˜λŠ” λͺ¨λ“  λΆ„κΈ° κ²½λ‘œκ°€ ν…ŒμŠ€νŠΈλ˜μ—ˆλŠ”μ§€' + : 'Whether all branching paths in conditional statements (if, else, switch, etc.) have been tested'} + +
βœ… ({totalCoverage.branches.pct}%)
+ {functions} +
+ + ℹ️  + {isKorean + ? 'μ½”λ“œ λ‚΄μ˜ λͺ¨λ“  ν•¨μˆ˜κ°€ ν…ŒμŠ€νŠΈμ—μ„œ ν˜ΈμΆœλ˜μ—ˆλŠ”μ§€' + : 'Whether all functions within the code have been called during testing'} + +
βœ… ({totalCoverage.functions.pct}%)
+ {lines} +
+ + ℹ️  + {isKorean + ? 'μ†ŒμŠ€ μ½”λ“œμ˜ 각 라인이 ν…ŒμŠ€νŠΈμ—μ„œ μ‹€ν–‰λ˜μ—ˆλŠ”μ§€' + : 'Whether each line of the source code has been executed during testing'} + +
βœ… ({totalCoverage.lines.pct}%)
+
+ +
+ + + + + + + + + + + + + + + {filterValidFileEntries(fileEntries).map(([filename, info]) => ( + + + + + + + + + ))} + +
+ {isKorean ? 'es-hangul의 ν…ŒμŠ€νŠΈ 컀버리지 ν˜„ν™©' : "es-hangul's test coverage status"} +
+ API + + {statements} + + {branches} + + {functions} + + {lines} +
+ {filename} πŸ”— + βœ… ({info.statements.pct}%)βœ… ({info.branches.pct}%)βœ… ({info.functions.pct}%)βœ… ({info.lines.pct}%)
+
+
+ ); +} diff --git a/docs/src/pages/docs/introduction.ko.mdx b/docs/src/pages/docs/introduction.ko.mdx index d2defa6d..384ee7f2 100644 --- a/docs/src/pages/docs/introduction.ko.mdx +++ b/docs/src/pages/docs/introduction.ko.mdx @@ -24,7 +24,7 @@ ECMAScript Modulesλ₯Ό μ΄μš©ν•˜μ—¬ μ‚¬μš©ν•˜λŠ” ν•¨μˆ˜λ§Œ μ• ν”Œλ¦¬μΌ€μ΄μ…˜μ— ### μ‹ λ’°ν•  수 μžˆμŠ΅λ‹ˆλ‹€ -μš°λ¦¬λŠ” 컀버리지 100%λ₯Ό λͺ©ν‘œλ‘œ λͺ¨λ“  κΈ°λŠ₯을 ν…ŒμŠ€νŠΈν•˜κΈ° μœ„ν•΄ λ…Έλ ₯ν•˜κ³  μžˆμŠ΅λ‹ˆλ‹€. +μš°λ¦¬λŠ” 컀버리지 100%λ₯Ό λͺ©ν‘œλ‘œ λͺ¨λ“  κΈ°λŠ₯을 ν…ŒμŠ€νŠΈν•˜κΈ° μœ„ν•΄ [λ…Έλ ₯ν•˜κ³  μžˆμŠ΅λ‹ˆλ‹€](./advantages/reliability). [![codecov](https://codecov.io/gh/toss/es-hangul/branch/main/graph/badge.svg?token=ν† ν°μΆ”κ°€κ°€ν•„μš”ν•©λ‹ˆλ‹€)](https://codecov.io/gh/toss/es-hangul) ### TypeScriptλ₯Ό μ§€μ›ν•©λ‹ˆλ‹€ diff --git a/src/days/days.constants.ts b/src/days/constants.ts similarity index 100% rename from src/days/days.constants.ts rename to src/days/constants.ts diff --git a/src/days/days.ts b/src/days/days.ts index ee00c736..43cf69c5 100644 --- a/src/days/days.ts +++ b/src/days/days.ts @@ -1,5 +1,5 @@ import { hasProperty } from '../_internal'; -import { DAYS_MAP, DAYS_ONLY_TENS_MAP } from './days.constants'; +import { DAYS_MAP, DAYS_ONLY_TENS_MAP } from './constants'; export function days(num: number): string { return getNumberWord(num); diff --git a/src/standardizePronunciation/standardizePronunciation.constants.ts b/src/standardizePronunciation/constants.ts similarity index 100% rename from src/standardizePronunciation/standardizePronunciation.constants.ts rename to src/standardizePronunciation/constants.ts diff --git a/src/standardizePronunciation/rules/transform12th.ts b/src/standardizePronunciation/rules/transform12th.ts index 77841f94..a99ebb04 100644 --- a/src/standardizePronunciation/rules/transform12th.ts +++ b/src/standardizePronunciation/rules/transform12th.ts @@ -5,7 +5,7 @@ import { λ°œμŒλ³€ν™˜_μ²«μ†Œλ¦¬_γ…Ž, λ°œμŒλ³€ν™˜_μ²«μ†Œλ¦¬_γ…Ž_발음, μŒκ°€κ°€_μ—†λŠ”_자음, -} from '../standardizePronunciation.constants'; +} from '../constants'; import { Nullable, NullableReturnSyllables, ReturnSyllables, Syllable } from './rules.types'; import { replaceλ°›μΉ¨γ…Ž } from './rules.utils'; diff --git a/src/standardizePronunciation/rules/transform13And14th.ts b/src/standardizePronunciation/rules/transform13And14th.ts index 651dcea7..2ff5184c 100644 --- a/src/standardizePronunciation/rules/transform13And14th.ts +++ b/src/standardizePronunciation/rules/transform13And14th.ts @@ -1,5 +1,5 @@ import { arrayIncludes } from '../../_internal'; -import { μŒκ°€κ°€_μ—†λŠ”_자음 } from '../standardizePronunciation.constants'; +import { μŒκ°€κ°€_μ—†λŠ”_자음 } from '../constants'; import { ReturnSyllables, Syllable } from './rules.types'; const λ°›μΉ¨μ˜κΈΈμ΄ = { diff --git a/src/standardizePronunciation/rules/transform16th.ts b/src/standardizePronunciation/rules/transform16th.ts index 5622b6a1..69b05027 100644 --- a/src/standardizePronunciation/rules/transform16th.ts +++ b/src/standardizePronunciation/rules/transform16th.ts @@ -1,10 +1,5 @@ import { arrayIncludes } from '../../_internal'; -import { - μŒκ°€κ°€_μ—†λŠ”_자음, - νŠΉλ³„ν•œ_ν•œκΈ€_자λͺ¨, - νŠΉλ³„ν•œ_ν•œκΈ€_자λͺ¨μ˜_발음, - ν•œκΈ€_자λͺ¨, -} from '../standardizePronunciation.constants'; +import { μŒκ°€κ°€_μ—†λŠ”_자음, νŠΉλ³„ν•œ_ν•œκΈ€_자λͺ¨, νŠΉλ³„ν•œ_ν•œκΈ€_자λͺ¨μ˜_발음, ν•œκΈ€_자λͺ¨ } from '../constants'; import { ReturnSyllables, Syllable } from './rules.types'; type Apply16ν•­ = { diff --git a/src/standardizePronunciation/rules/transform17th.ts b/src/standardizePronunciation/rules/transform17th.ts index a98f9a94..16cb3999 100644 --- a/src/standardizePronunciation/rules/transform17th.ts +++ b/src/standardizePronunciation/rules/transform17th.ts @@ -1,5 +1,5 @@ import { hasProperty } from '../../_internal'; -import { 음의_동화_λ°›μΉ¨ } from '../standardizePronunciation.constants'; +import { 음의_동화_λ°›μΉ¨ } from '../constants'; import { ReturnSyllables, Syllable } from './rules.types'; /** diff --git a/src/standardizePronunciation/rules/transform18th.ts b/src/standardizePronunciation/rules/transform18th.ts index 4d806e73..e108e993 100644 --- a/src/standardizePronunciation/rules/transform18th.ts +++ b/src/standardizePronunciation/rules/transform18th.ts @@ -1,5 +1,5 @@ import { arrayIncludes } from '../../_internal'; -import { λΉ„μŒν™”_λ°›μΉ¨_γ„΄_λ³€ν™˜, λΉ„μŒν™”_λ°›μΉ¨_ㅁ_λ³€ν™˜, λΉ„μŒν™”_λ°›μΉ¨_γ…‡_λ³€ν™˜ } from '../standardizePronunciation.constants'; +import { λΉ„μŒν™”_λ°›μΉ¨_γ„΄_λ³€ν™˜, λΉ„μŒν™”_λ°›μΉ¨_ㅁ_λ³€ν™˜, λΉ„μŒν™”_λ°›μΉ¨_γ…‡_λ³€ν™˜ } from '../constants'; import { ReturnSyllables, Syllable } from './rules.types'; /** diff --git a/src/standardizePronunciation/rules/transform19th.ts b/src/standardizePronunciation/rules/transform19th.ts index 6406705a..2038e400 100644 --- a/src/standardizePronunciation/rules/transform19th.ts +++ b/src/standardizePronunciation/rules/transform19th.ts @@ -1,5 +1,5 @@ import { arrayIncludes } from '../../_internal'; -import { μžμŒλ™ν™”_λ°›μΉ¨_γ„΄_λ³€ν™˜ } from '../standardizePronunciation.constants'; +import { μžμŒλ™ν™”_λ°›μΉ¨_γ„΄_λ³€ν™˜ } from '../constants'; import { ReturnSyllables, Syllable } from './rules.types'; /** diff --git a/src/standardizePronunciation/rules/transform9And10And11th.ts b/src/standardizePronunciation/rules/transform9And10And11th.ts index df77a217..b2f2e97b 100644 --- a/src/standardizePronunciation/rules/transform9And10And11th.ts +++ b/src/standardizePronunciation/rules/transform9And10And11th.ts @@ -1,5 +1,5 @@ import { hasProperty } from '../../_internal'; -import { λ°›μΉ¨_λŒ€ν‘œμŒ_발음, μŒκ°€κ°€_μ—†λŠ”_자음 } from '../standardizePronunciation.constants'; +import { λ°›μΉ¨_λŒ€ν‘œμŒ_발음, μŒκ°€κ°€_μ—†λŠ”_자음 } from '../constants'; import { Nullable, ReturnSyllables, Syllable } from './rules.types'; /** diff --git a/src/standardizePronunciation/rules/transformHardConversion.ts b/src/standardizePronunciation/rules/transformHardConversion.ts index 2b856f08..0319ca44 100644 --- a/src/standardizePronunciation/rules/transformHardConversion.ts +++ b/src/standardizePronunciation/rules/transformHardConversion.ts @@ -1,6 +1,5 @@ -import { arrayIncludes } from '../../_internal'; -import { hasProperty } from '../../_internal'; -import { λœμ†Œλ¦¬, λœμ†Œλ¦¬_λ°›μΉ¨, μ–΄κ°„_λ°›μΉ¨ } from '../standardizePronunciation.constants'; +import { arrayIncludes, hasProperty } from '../../_internal'; +import { λœμ†Œλ¦¬, λœμ†Œλ¦¬_λ°›μΉ¨, μ–΄κ°„_λ°›μΉ¨ } from '../constants'; import { ReturnSyllables, Syllable } from './rules.types'; /** diff --git a/src/standardizePronunciation/rules/transformNLAssimilation.ts b/src/standardizePronunciation/rules/transformNLAssimilation.ts index 22910c98..b1385cbb 100644 --- a/src/standardizePronunciation/rules/transformNLAssimilation.ts +++ b/src/standardizePronunciation/rules/transformNLAssimilation.ts @@ -4,7 +4,7 @@ import { ㄴㄹ이_λ§λ‚˜λŠ”_ν›„μ†μŒμ ˆ_λͺ¨μŒ, ㄴㄹ이_λ§λ‚˜μ„œ_λ°›μΉ¨_γ„΄_λ³€ν™˜, ㄴㄹ이_λ§λ‚˜μ„œ_λ°›μΉ¨_γ„Ή_λ³€ν™˜, -} from '../standardizePronunciation.constants'; +} from '../constants'; import { ReturnSyllables, Syllable } from './rules.types'; /** diff --git a/vitest.config.mts b/vitest.config.mts index 744c61b0..d0abb3c7 100644 --- a/vitest.config.mts +++ b/vitest.config.mts @@ -1,6 +1,6 @@ +import path from 'path'; import { defineConfig } from 'vitest/config'; import packageJson from './package.json'; -import path from 'path'; export default defineConfig({ resolve: { @@ -13,6 +13,7 @@ export default defineConfig({ globals: true, coverage: { provider: 'istanbul', + reporter: ['json-summary', 'text'], include: ['src/**/*'], }, },