Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,21 @@ ENV PATH="/home/vscode/.local/bin:/home/vscode/.claude/local/bin:${PATH}"
USER root

# Install other global npm packages
RUN CODEX_VERSION=$(node -pe "require('/tmp/npm-global.json').dependencies['@openai/codex'].version") \
# All versions are pinned from npm/global.json for reproducibility.
# --legacy-peer-deps is needed because typescript-language-server@5.x declares
# a peer dep of typescript@^5.x which conflicts with typescript@6.x.
# See: docs/adr/0004-npm-legacy-peer-deps-for-typescript6.md
RUN TS_VERSION=$(node -pe "require('/tmp/npm-global.json').dependencies['typescript'].version") \
&& TSS_VERSION=$(node -pe "require('/tmp/npm-global.json').dependencies['typescript-language-server'].version") \
&& CODEX_VERSION=$(node -pe "require('/tmp/npm-global.json').dependencies['@openai/codex'].version") \
&& VERCEL_VERSION=$(node -pe "require('/tmp/npm-global.json').dependencies['vercel'].version") \
&& GEMINI_CLI_VERSION=$(node -pe "require('/tmp/npm-global.json').dependencies['@google/gemini-cli'].version") \
&& HAPPY_CODER_VERSION=$(node -pe "require('/tmp/npm-global.json').dependencies['happy-coder'].version") \
&& DIFIT_VERSION=$(node -pe "require('/tmp/npm-global.json').dependencies['difit'].version") \
&& npm install -g eslint \
typescript \
typescript-language-server \
&& npm install -g --legacy-peer-deps \
eslint \
typescript@${TS_VERSION} \
typescript-language-server@${TSS_VERSION} \
@openai/codex@${CODEX_VERSION} \
vercel@${VERCEL_VERSION} \
@google/gemini-cli@${GEMINI_CLI_VERSION} \
Expand Down
29 changes: 29 additions & 0 deletions docs/adr/0004-npm-legacy-peer-deps-for-typescript6.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# ADR-0004: npm --legacy-peer-deps によるTypeScript 6.x ピア依存競合の解消

- **Date**: 2026-05-11
- **Status**: Accepted

## Context

`npm/global.json` の自動更新により `typescript@6.0.3`(メジャーバージョン)に更新された。
`typescript-language-server@5.x` は `peerDependencies` で `typescript@^5.x` を宣言しており、
`typescript@6.x` との組み合わせで `npm ERESOLVE` が発生し、Docker ビルドが失敗した。

失敗した CI: Container Security Scan on main (2026-05-11T13:06 UTC, commit c0470fc)

## Decision

Dockerfile の `npm install -g` に `--legacy-peer-deps` フラグを追加する。

合わせて、`typescript` と `typescript-language-server` を他のパッケージと同様に
`npm/global.json` からバージョンをピン留めして再現性を確保する。

## Consequences

- **良い点**: TypeScript メジャーバージョンアップ時にも typescript-language-server が
追従するまでの間、Docker ビルドが継続できる
- **良い点**: `npm/global.json` で全パッケージのバージョンを一元管理できる
- **悪い点**: `--legacy-peer-deps` はピア依存の不整合を隠蔽するため、
実際の互換性問題が実行時まで顕在化しない可能性がある
- **代替案**: `typescript-language-server` を TypeScript 6.x に対応した新版へ更新する
(更新版がリリースされた際に実施する)