Unverified Commit 741f8300 authored by Jiwon Choi's avatar Jiwon Choi Committed by GitHub

next-codemod: add empty `pnpm-workspace.yaml` to test fixtures to bypass PNPM…

next-codemod: add empty `pnpm-workspace.yaml` to test fixtures to bypass PNPM workspace checks (#71726)

### Why?

Since dep installation within next-codemod runs `pnpm install` on the
Next.js repo, it installs in the workspace root scope during testing. We
could add a layer for testing like adding a flag `--no-workspace`, but
it will reduce confidence between the actual running and testing.
Therefore added an empty `pnpm-workspace.yaml` file to each fixture.

### How?

By doing this, both installation and testing will have same environment
of running, `pnpm install` only. To prevent created `pnpm-lockfile` to
be shipped, gitignored it.

This way, we keep things simple and make sure tests match real-world use
better. The empty `pnpm-workspace.yaml` files make `pnpm` treat each
fixture separately, which is closer to how it'll work for users.
parent aed6c4c0
...@@ -11,7 +11,7 @@ cd "$1" || exit 1 ...@@ -11,7 +11,7 @@ cd "$1" || exit 1
# We're only interested in the changes the upgrade command does. # We're only interested in the changes the upgrade command does.
git add -A . git add -A .
rm -rf node_modules rm -rf node_modules
pnpm install --ignore-workspace --no-lockfile pnpm install
node "$NEXT_CODEMOD_BIN" upgrade "${@:2}" node "$NEXT_CODEMOD_BIN" upgrade "${@:2}"
git --no-pager diff . git --no-pager diff .
git restore . git restore .
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment