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
126 changes: 0 additions & 126 deletions .github/workflows/ci.yml

This file was deleted.

6 changes: 0 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1 @@
node_modules/
.DS_Store

fixtures/*/node_modules/
fixtures/*/.pnp.*
fixtures/*/.yarn/install-state.gz
fixtures/*/.yarn/cache/
12 changes: 4 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ steps:
| Input | Default | Description |
| --- | --- | --- |
| `node-version` | `22.x` | Node.js version to install with `actions/setup-node` |
| `package-manager` | `""` | Explicit override for `npm`, `pnpm`, or `yarn` |
| `package-manager` | `""` | Optional override for `npm`, `pnpm`, or `yarn`; by default the action follows the package manager inferred from `package.json` and the lockfile present |
| `working-directory` | `"."` | Repository-relative directory containing `package.json` and the lockfile |
| `cache-key-suffix` | `""` | Optional suffix appended to the dependency cache key when you want to namespace cache entries |
| `lookup-only` | `"false"` | When `true`, only checks whether the cache exists and skips downloading it |
Expand Down Expand Up @@ -100,19 +100,15 @@ The first release targets Yarn repositories that install into `node_modules`.

- Yarn 2+ uses `yarn install --immutable`
- Yarn 1 uses `yarn install --frozen-lockfile`
- the fixture coverage in this repository uses Yarn 4 with `nodeLinker: node-modules`
- the dogfood coverage in `pwrdrvr/configure-nodejs-test` uses Yarn 4 with `nodeLinker: node-modules`

Plug'n'Play-specific caching is intentionally out of scope for `v1`.

## Development

This repository includes three end-to-end fixtures under `fixtures/`:
Dogfood coverage for this action lives in [`pwrdrvr/configure-nodejs-test`](https://github.com/pwrdrvr/configure-nodejs-test).

- `fixtures/npm-basic`
- `fixtures/pnpm-basic`
- `fixtures/yarn-basic`

The CI workflow runs local unit tests plus end-to-end matrix coverage for those fixtures, followed by cache-lookup verification in a second matrix job.
That repository checks out `pwrdrvr/configure-nodejs` at a configurable ref, runs the unit tests for the helper scripts, and exercises npm, pnpm, and Yarn fixtures through the action entrypoint.

## Releases

Expand Down
23 changes: 21 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ inputs:
description: "Node.js version to install"
default: "22.x"
package-manager:
description: "Explicit package manager override (npm, yarn, pnpm)"
description: "Optional override for npm, yarn, or pnpm; defaults to the package manager inferred from package.json and lockfiles"
default: ""
working-directory:
description: "Repository-relative directory containing package.json and lockfile"
Expand Down Expand Up @@ -84,7 +84,7 @@ runs:

- name: Restore dependencies from cache
id: cache-node-modules
uses: actions/cache@v5
uses: actions/cache/restore@v5
with:
path: ${{ steps.resolve-cache-paths.outputs.cachePaths }}
key: node-modules-${{ inputs.node-version }}-${{ runner.os }}-${{ runner.arch }}-${{ steps.resolve-cache-paths.outputs.workingDirectoryKey }}-${{ steps.resolve-package-manager.outputs.managerCacheKey }}-${{ steps.resolve-package-manager.outputs.lockfileSha }}${{ steps.resolve-cache-paths.outputs.cacheKeySuffixSegment }}
Expand All @@ -95,3 +95,22 @@ runs:
shell: bash
working-directory: ${{ steps.resolve-cache-paths.outputs.workingDirectory }}
run: ${{ steps.resolve-package-manager.outputs.installCommand }}

- name: Detect cacheable dependency paths
id: detect-cache-paths
if: steps.cache-node-modules.outputs.cache-hit != 'true'
shell: bash
working-directory: ${{ steps.resolve-cache-paths.outputs.workingDirectory }}
run: |
if find . -type d -name node_modules -print -quit | grep -q .; then
echo "exists=true" >> "$GITHUB_OUTPUT"
else
echo "exists=false" >> "$GITHUB_OUTPUT"
fi

- name: Save dependencies to cache
if: steps.cache-node-modules.outputs.cache-hit != 'true' && steps.detect-cache-paths.outputs.exists == 'true'
uses: actions/cache/save@v5
with:
path: ${{ steps.resolve-cache-paths.outputs.cachePaths }}
key: node-modules-${{ inputs.node-version }}-${{ runner.os }}-${{ runner.arch }}-${{ steps.resolve-cache-paths.outputs.workingDirectoryKey }}-${{ steps.resolve-package-manager.outputs.managerCacheKey }}-${{ steps.resolve-package-manager.outputs.lockfileSha }}${{ steps.resolve-cache-paths.outputs.cacheKeySuffixSegment }}
7 changes: 0 additions & 7 deletions fixtures/npm-basic/check.mjs

This file was deleted.

19 changes: 0 additions & 19 deletions fixtures/npm-basic/package-lock.json

This file was deleted.

8 changes: 0 additions & 8 deletions fixtures/npm-basic/package.json

This file was deleted.

7 changes: 0 additions & 7 deletions fixtures/pnpm-basic/check.mjs

This file was deleted.

9 changes: 0 additions & 9 deletions fixtures/pnpm-basic/package.json

This file was deleted.

22 changes: 0 additions & 22 deletions fixtures/pnpm-basic/pnpm-lock.yaml

This file was deleted.

1 change: 0 additions & 1 deletion fixtures/yarn-basic/.yarnrc.yml

This file was deleted.

7 changes: 0 additions & 7 deletions fixtures/yarn-basic/check.mjs

This file was deleted.

9 changes: 0 additions & 9 deletions fixtures/yarn-basic/package.json

This file was deleted.

21 changes: 0 additions & 21 deletions fixtures/yarn-basic/yarn.lock

This file was deleted.

10 changes: 0 additions & 10 deletions package-lock.json

This file was deleted.

8 changes: 0 additions & 8 deletions package.json

This file was deleted.

Loading