{"id":16992256,"url":"https://github.com/tf63/node-ci-exp","last_synced_at":"2026-04-15T14:37:12.173Z","repository":{"id":247203800,"uuid":"825252295","full_name":"tf63/node-ci-exp","owner":"tf63","description":"NodeのCIのパターンを整理する","archived":false,"fork":false,"pushed_at":"2024-07-15T07:42:28.000Z","size":726,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-27T05:39:07.167Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tf63.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-07T08:58:21.000Z","updated_at":"2024-07-15T07:50:09.000Z","dependencies_parsed_at":"2024-07-07T10:46:10.402Z","dependency_job_id":"5c437411-875b-4778-94d9-8e8b93996d44","html_url":"https://github.com/tf63/node-ci-exp","commit_stats":null,"previous_names":["tf63/node-ci-exp"],"tags_count":0,"template":false,"template_full_name":"tf63/next-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tf63%2Fnode-ci-exp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tf63%2Fnode-ci-exp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tf63%2Fnode-ci-exp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tf63%2Fnode-ci-exp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tf63","download_url":"https://codeload.github.com/tf63/node-ci-exp/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244907382,"owners_count":20529851,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-14T03:28:46.241Z","updated_at":"2026-04-15T14:37:07.130Z","avatar_url":"https://github.com/tf63.png","language":"TypeScript","readme":"# NodeのCIを試すだけ\n\n### キャッシュ無し\n\n-   ベースライン\n\n### `actions/setup-node@v3`を使う\n\nhttps://github.com/actions/setup-node/tree/main\n\n-   `.npm`をキャッシュする\n\n```\n    - uses: actions/checkout@v3\n    - uses: actions/setup-node@v3\n        with:\n            node-version: '20'\n            cache: 'npm'\n    - run: npm ci\n```\n\n### node_modulesをキャッシュする\n\n-   `setup-node`はデフォルトでキャッシュを作成しない\n-   `with \u003e cache`を指定しないようにすれば環境を作れる\n\n```\n    - uses: actions/checkout@v3\n    - uses: actions/setup-node@v3\n        with:\n            node-version: '20'\n    - uses: actions/cache@v3\n        id: node_modules_cache\n        with:\n            path: '**/node_modules'\n            key: ${{ runner.os }}-node-modules-${{ hashFiles('**/package-lock.json') }}\n            restore-keys: |\n                ${{ runner.os }}-node-modules-\n    - run: npm ci\n```\n\n### pnpmを使う\n\n`pnpm/action-setup`を使わずとも`corepack enable`するだけでよい\n\nhttps://zenn.dev/longrun_jp/articles/hello-corepack-goodbye-pnpm-action-setup\n\n```\n    - uses: actions/checkout@v4\n    - run: corepack enable\n    - uses: actions/setup-node@v4\n        with:\n            node-version: '20'\n            cache: 'pnpm'\n    - run: pnpm install --frozen-lockfile\n```\n\n-   `npm ci`の代わりに`pnpm install --frozen-lockfile`を使う (`--frozen-lockfile`はなくてもよいかも)\n\nhttps://stackoverflow.com/questions/70154568/pnpm-equivalent-command-for-npm-ci\n\nhttps://pnpm.io/npmrc#prefer-frozen-lockfile\n\n## キャッシュの再検証\n\nキャッシュのキーに`package-lock.json`のハッシュ値を使用している\n\n![alt text](img/README.png)\n\n## 備考\n\n**npm installは`package-lock.json`を更新する**\n\n-   `npm ci`を使った方が良い\n-   `setup-node`のサンプルでも`npm ci`を使っている\n    https://qiita.com/mstssk/items/8759c71f328cab802670\n\n**npm ciはnode_modulesを一度削除する**\n\n-   `npm ci`の実行時に`node_modules`が存在する場合，一度削除してから`node_modules`を入れ直すらしい\n-   `node_modules`をキャッシュしても削除されてしまいそう\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftf63%2Fnode-ci-exp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftf63%2Fnode-ci-exp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftf63%2Fnode-ci-exp/lists"}