chore: ドキュメントサイトを apps/ 配下へ移動し Vercel デプロイ設定を追加 - #119
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: 2e71b94 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.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.
概要
ドキュメントサイトを
app/ginga-ui.comからapps/ginga-ui.comへ移動し、あわせて Vercel にデプロイできる状態にします。変更内容
1.
app/→apps/への移動git mvでディレクトリをリネームし、パスを参照していた 5 ファイルを更新しました。pnpm-workspace.yaml— workspace globpackage.json—docsスクリプトtsconfig.json—#/*パスエイリアスknip.json— workspaces エントリAGENTS.md— モノレポ構造の説明.changeset/config.jsonはパッケージ名ベース、.github/・turbo.json・.storybook/・lint 系設定はパス非依存のため変更不要でした。2. Node.js バージョンを 24.x に統一
Vercel が選べる Node.js は 24.x / 22.x / 20.x のみ(26.x は Vercel Sandbox 専用)のため、
devEngines.runtime.versionを26.8.1→24.21.0に変更しました。actions/setup-nodeもnode-version-file: "package.json"を参照しているため、CI も Node 24 に揃います。3. Vercel のビルド設定を追加
apps/ginga-ui.com/vercel.json{ "buildCommand": "cd ../.. && pnpm exec turbo run build --filter=ginga-ui.com" }@ginga-ui/core/@ginga-ui/utilsはdist/を exports しているため、next buildの前に tsdown ビルドが必要です。turbo のdependsOn: ["^build"]により依存パッケージが先にビルドされます。apps/ginga-ui.com/turbo.jsonルート
turbo.jsonのbuild.outputsはdist/**のみで Next.js の.next/**が漏れており、turbo キャッシュがヒットすると成果物が復元されず Vercel が失敗します。パッケージ単位でoutputsを上書きしました。4.
pnpm docs→pnpm run docspnpm docsは pnpm 12 の組み込みコマンドと衝突してスクリプトが実行されないため、AGENTS.md の記載を修正しました。5. テーマ生成 API の API キー取り扱いを修正
/api/generate-themeはリクエストごとにprocess.env[envKey]を書き換えてThemeClientを生成し、finallyで復元していました。サーバーレス環境で同一インスタンスに並行リクエストが来ると、あるユーザーの API キーが別のユーザーのリクエストで使われうる状態でした。ThemeClientのコンストラクタにapiKeyを追加し(AI SDK のcreateOpenAI/createGoogleGenerativeAI/createAnthropicを使用)、ルートからprocess.envの書き換えを削除しました。apiKeyを省略した場合は従来どおり環境変数が使われるため、既存の呼び出し側に影響はありません。@ginga-ui/utilsの minor として changeset を追加しています。6. next dev の自動生成ファイルを追跡対象から外す
next devがapps/ginga-ui.com/AGENTS.mdとCLAUDE.mdを自動生成していたため、next.config.tsにagentRules: falseを追加して無効化しました(Next.js 16 の正式オプション)。リポジトリルートに既にAGENTS.mdがあるので、サブディレクトリにもう一組を置かない方針です。あわせて
next-env.d.tsを.gitignoreに追加し、git rm --cachedで追跡から外しました。Next.js 16 の公式ドキュメント(next/dist/docs/01-app/03-api-reference/05-config/02-typescript.md)に「Next.js が管理する実装詳細なので.gitignoreに追加し、追跡済みなら Git から削除する」と明記されています。実際next devとnext buildでこのファイルの中身が.next/dev/types/...と.next/types/...の間で往復し、毎回差分が出ていました。安全性は実測済みです。
next-env.d.tsと.nextの両方が存在しない状態(CI の新規チェックアウト相当)でもpnpm exec tsc --noEmitは通り、next buildがこのファイルを再生成します。検証
pnpm exec tsc --noEmit/pnpm run lint/pnpm run format/pnpm run stylelint/pnpm run knip— すべてパスpnpm exec turbo run build --filter=ginga-ui.com—@ginga-ui/utils→@ginga-ui/core→ginga-ui.comの順に 3 タスク成功.nextを削除して再実行し、FULL TURBO キャッシュから.nextが復元されることを確認//components/button/quick-start/theme-generationがいずれも 200/api/generate-themeの挙動:apiKeyなしAPIキーとプロンプトが必要ですprovider: "browser"不明なプロバイダーです: browserprovider: "openai"Incorrect API key provided: sk-inval********-key3 つ目で、ローカル
.envの実キーではなくリクエストボディのキーが使われていることを確認しました。マージ後の作業(Vercel ダッシュボード)
newt239/ginga-uiを Import し、Root Directory をapps/ginga-ui.comに設定vercel.jsonから適用される)ENABLE_EXPERIMENTAL_COREPACK=1を追加(必須)ロックファイルは
lockfileVersion: '9.0'のため Vercel は pnpm 9/10 を選びますが、本リポジトリのロックファイルには pnpm 12 固有のpackageManagerDependencies:/configDependencies:、pnpm-workspace.yamlには pnpm 11+ のallowBuilds/minimumReleaseAgeExcludePruneが含まれており、pnpm 9/10 では install が失敗します24.xに設定アプリケーション用の環境変数は不要です。
🤖 Generated with Claude Code