Conversation
- src/utils/parse.ts: isRecord, toStringValue, toBooleanValue, toStringArray, parseArray(新規) - src/utils/naming.ts: toPascalCase, toTypePropertyName, getUniqueName(type-generatorから移動) - src/utils/error.ts: toErrorMessage - src/utils/index.ts: バレルエクスポート - management-api.ts: parseArray を利用して .map().filter() の重複パターンを解消 - config.ts: resolveRequiredConfig に重複する設定バリデーションを集約 - テストヘルパー(createSchema, createTarget)を __tests__/helpers.ts に抽出 - utils の各関数に対するユニットテストを追加 (35テスト追加) - shared.ts を削除 Co-authored-by: Ryusei Sugita <wato787@users.noreply.github.com>
|
Cursor Agent can help with this pull request. Just |
Co-authored-by: Ryusei Sugita <wato787@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
コードベースのリファクタリングを行い、可読性、保守性、再利用性を向上させました。汎用的なユーティリティ関数を
src/utils/フォルダに集約し、テストカバレッジを強化しています。背景 / 目的
ユーザーからのリファクタリング要望に応え、以下の目的を達成します。
src/utils/フォルダを新設し、将来のコマンド追加に備えた共通ユーティリティの整理。変更内容
src/utils/フォルダを新設し、汎用ユーティリティ関数(parse,naming,error関連)を移動・分離。management-api.ts内の.map(parser).filter(x => x !== null)パターンをparseArrayユーティリティで解消。config.tsのserviceDomainとapiKeyの重複バリデーションロジックをresolveRequiredConfig()ヘルパーに集約。type-generator.tsからgetUniqueNameをutils/naming.tsへ移動。createSchema,createTarget) を__tests__/helpers.tsに抽出。src/utils/配下のユーティリティ関数に対するユニットテスト(35ケース)を新規追加。src/commands/generate/types/shared.tsを削除。動作確認
bun run buildbun test: 全61テスト(既存26 + 新規35)が通過することを確認。bun run lint: lintエラーがないことを確認。影響範囲
補足
src/utils/への関数の分離と、parseArrayの導入による重複解消点を見ていただきたいです。utilsのユニットテストもご確認ください。