diff --git a/.github/workflows/README.md b/.github/workflows/README.md index 0b3f007..1930219 100644 --- a/.github/workflows/README.md +++ b/.github/workflows/README.md @@ -26,7 +26,7 @@ GitHub Actionsの実行時間短縮を目的として、Node.jsとPlaywrightが **基盤**: Ubuntu 24.04 LTS **Node.js**: v24 (flake.nixの`nodejs_24`に準拠) **追加パッケージ**: curl, unzip, git, google-cloud-cli(gcloud / gsutil) -**パッケージ管理**: pnpm 10.10.0(corepack経由) +**パッケージ管理**: pnpm(corepack経由) **用途**: @@ -39,13 +39,13 @@ GitHub Actionsの実行時間短縮を目的として、Node.jsとPlaywrightが **Node.js**: v24 (flake.nixの`nodejs_24`に準拠) **Playwright**: プリインストール(ブラウザ込み) **追加パッケージ**: curl, git -**パッケージ管理**: pnpm 10.10.0(corepack経由) +**パッケージ管理**: pnpm(corepack経由) **特徴**: - Playwright関連依存関係を事前インストール - ブラウザバイナリ(Chromium)を含有 -- `npx playwright install --with-deps`実行済み +- `pnpm exec playwright install --with-deps`実行済み **用途**: @@ -62,12 +62,11 @@ GitHub Actionsの実行時間短縮を目的として、Node.jsとPlaywrightが ```bash # Node.jsイメージのビルド -cd .github/workflows/images -docker build -f Dockerfile.node -t ghcr.io/ano333333/ongeki-score-fetch/node:24.04 . +docker build -f .github/workflows/images/Dockerfile.node -t ghcr.io/ano333333/ongeki-score-fetch/node:24.04 . docker push ghcr.io/ano333333/ongeki-score-fetch/node:24.04 # Playwrightイメージのビルド -docker build -f Dockerfile.playwright -t ghcr.io/ano333333/ongeki-score-fetch/playwright:24.04 . +docker build -f .github/workflows/images/Dockerfile.playwright -t ghcr.io/ano333333/ongeki-score-fetch/playwright:24.04 . docker push ghcr.io/ano333333/ongeki-score-fetch/playwright:24.04 ``` diff --git a/.github/workflows/build-chromeex/action.yaml b/.github/workflows/build-chromeex/action.yaml index 4551a2c..a17b14b 100644 --- a/.github/workflows/build-chromeex/action.yaml +++ b/.github/workflows/build-chromeex/action.yaml @@ -27,7 +27,7 @@ runs: working-directory: ./chrome-extension shell: bash run: | - npm install + pnpm install --frozen-lockfile - name: Build id: build @@ -35,7 +35,7 @@ runs: shell: bash continue-on-error: true run: | - npm run build + pnpm run build - name: Set result id: set-result diff --git a/.github/workflows/images/Dockerfile.node b/.github/workflows/images/Dockerfile.node index 3fbeebc..244ebe4 100644 --- a/.github/workflows/images/Dockerfile.node +++ b/.github/workflows/images/Dockerfile.node @@ -26,4 +26,4 @@ RUN echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages. && rm -rf /var/lib/apt/lists/* # flake.nix/devShellと揃えるため、pnpmを有効化 -RUN corepack enable && corepack prepare pnpm@10.10.0 --activate +RUN corepack enable && corepack prepare pnpm@11.1.2 --activate diff --git a/.github/workflows/images/Dockerfile.playwright b/.github/workflows/images/Dockerfile.playwright index e6a1fb5..e44f5d5 100644 --- a/.github/workflows/images/Dockerfile.playwright +++ b/.github/workflows/images/Dockerfile.playwright @@ -15,32 +15,23 @@ RUN curl -fsSL https://deb.nodesource.com/setup_24.x -o nodesource_setup.sh \ && rm -rf /var/lib/apt/lists/* # flake.nix/devShellと揃えるため、pnpmを有効化 -RUN corepack enable && corepack prepare pnpm@10.10.0 --activate +RUN corepack enable && corepack prepare pnpm@11.1.2 --activate # Playwright環境変数の設定 ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright -# 最小限のNodeプロジェクトを作成 +# chrome-extension の依存関係を使って Playwright をインストール WORKDIR /opt/playwright-project -# package.jsonを作成 -RUN echo '{\ - "name": "playwright-container",\ - "version": "1.0.0",\ - "type": "module",\ - "devDependencies": {\ - "@vitest/browser": "^3.1.4",\ - "playwright": "^1.52.0",\ - "vitest": "^3.1.4",\ - "vitest-browser-vue": "^0.2.0"\ - }\ -}' > package.json +COPY chrome-extension/package.json ./ +COPY chrome-extension/pnpm-lock.yaml ./ +COPY chrome-extension/pnpm-workspace.yaml ./ # 依存関係のインストール -RUN npm install +RUN pnpm install --frozen-lockfile # Playwrightブラウザのインストール(chromiumを明示的に指定) -RUN npx playwright install chromium --with-deps +RUN pnpm exec playwright install chromium --with-deps # プロジェクトディレクトリを削除(ブラウザはグローバルにインストール済み) RUN rm -rf /opt/playwright-project diff --git a/.github/workflows/test-chromeex/action.yaml b/.github/workflows/test-chromeex/action.yaml index afd3106..eba28e4 100644 --- a/.github/workflows/test-chromeex/action.yaml +++ b/.github/workflows/test-chromeex/action.yaml @@ -27,7 +27,7 @@ runs: working-directory: ./chrome-extension shell: bash run: | - npm install + pnpm install --frozen-lockfile - name: Test id: test @@ -35,7 +35,7 @@ runs: shell: bash continue-on-error: true run: | - npm run test:ci + pnpm run test:ci - name: Set result id: set-result diff --git a/chrome-extension/package.json b/chrome-extension/package.json index ed6d8ce..40bd9bf 100644 --- a/chrome-extension/package.json +++ b/chrome-extension/package.json @@ -3,6 +3,7 @@ "private": true, "version": "0.0.0", "type": "module", + "packageManager": "pnpm@11.1.2", "scripts": { "dev": "vite", "build": "vue-tsc && vite build", diff --git a/chrome-extension/pnpm-workspace.yaml b/chrome-extension/pnpm-workspace.yaml new file mode 100644 index 0000000..663e57c --- /dev/null +++ b/chrome-extension/pnpm-workspace.yaml @@ -0,0 +1,4 @@ +allowBuilds: + esbuild: true + +trustPolicy: no-downgrade diff --git a/flake.lock b/flake.lock index c04500a..77748eb 100644 --- a/flake.lock +++ b/flake.lock @@ -2,11 +2,11 @@ "nodes": { "nixpkgs": { "locked": { - "lastModified": 1760103332, - "narHash": "sha256-BMsGVfKl4Q80Pr9T1AkCRljO1bpwCmY8rTBVj8XGuhA=", + "lastModified": 1779536132, + "narHash": "sha256-q+fF42iv/geEbHfgSzy3tS0FF/EyD6XTZ98E6yxiBO8=", "owner": "nixos", "repo": "nixpkgs", - "rev": "870493f9a8cb0b074ae5b411b2f232015db19a65", + "rev": "3d8f0f3f72a6cd4d93d0ad13203f2ea1cb7e1456", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index e4345f5..6de82c9 100644 --- a/flake.nix +++ b/flake.nix @@ -24,7 +24,7 @@ default = pkgs.mkShell { packages = with pkgs; [ nodejs_24 - nodePackages.pnpm + pnpm playwright-driver.browsers terraform diff --git a/gcp/sheet-scraper/Dockerfile b/gcp/sheet-scraper/Dockerfile index 0585e1b..6602f5b 100644 --- a/gcp/sheet-scraper/Dockerfile +++ b/gcp/sheet-scraper/Dockerfile @@ -4,11 +4,11 @@ RUN apt-get update RUN apt-get install -y curl RUN curl -fsSL https://deb.nodesource.com/setup_22.x -o nodesource_setup.sh RUN bash nodesource_setup.sh +RUN corepack enable && corepack prepare pnpm@11.1.2 --activate RUN mkdir /usr/src/app WORKDIR /usr/src/app COPY ./package.json ./ COPY ./pnpm-lock.yaml ./ -RUN npm install -g pnpm RUN pnpm i --frozen-lockfile COPY ./codes ./codes diff --git a/gcp/sheet-scraper/package.json b/gcp/sheet-scraper/package.json index 4bd16b8..88dc1b7 100644 --- a/gcp/sheet-scraper/package.json +++ b/gcp/sheet-scraper/package.json @@ -4,7 +4,7 @@ "description": "", "main": "codes/index.js", "scripts": { - "build": "npx tsc", + "build": "tsc", "dev": "node --env-file .env -r ts-node/register codes/index.ts", "test": "jest" }, @@ -13,7 +13,7 @@ "nodeVersion": "22.15.0" } }, - "packageManager": "pnpm@10.10.0", + "packageManager": "pnpm@11.1.2", "author": "", "license": "ISC", "devDependencies": {