Merged
Conversation
esbuild の define オプションで __THEME__ をビルド時に注入し、 styles.ts 内のカラー定義をライト/ダーク別に分離した。 dead code elimination により各バンドルに不要なテーマ色は含まれない。 - src/styles.ts: LIGHT_COLORS / DARK_COLORS を named export し __THEME__ で切り替え - esbuild.config.ts: --dark フラグで outfile と define.__THEME__ を切り替え - package.json: build:dark / build:all スクリプトを追加 - vitest.config.ts: define に __THEME__ = "light" を追加 - test/styles.test.ts: ライト/ダーク両カラー定数のテストを新規追加 - README.md: ダークモードの使い方とビルドコマンドを追記
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.
Summary
src/styles.ts:LIGHT_COLORS/DARK_COLORSを named export し、ビルド時定数__THEME__で切り替え。dead code elimination により各バンドルに不要なテーマ色は含まれないesbuild.config.ts:--darkフラグでoutfileとdefine.__THEME__を切り替えpackage.json:build:dark/build:allスクリプトを追加vitest.config.ts:defineに__THEME__ = "light"を追加test/styles.test.ts: ライト/ダーク両カラー定数のテストを新規追加README.md: ダークモードの使い方とビルドコマンドを追記Test plan
npm test— 全テスト passnpm run build—dist/git-code-embed.min.jsがライトカラーのみ含むnpm run build:dark—dist/git-code-embed-dark.min.jsがダークカラーのみ含む