Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[turborepo] Prune is no longer copying package.json to full directory #5768

Closed
Xiot opened this issue Aug 21, 2023 · 4 comments · Fixed by #5769
Closed

[turborepo] Prune is no longer copying package.json to full directory #5768

Xiot opened this issue Aug 21, 2023 · 4 comments · Fixed by #5769
Assignees
Labels
kind: bug Something isn't working owned-by: turborepo

Comments

@Xiot
Copy link

Xiot commented Aug 21, 2023

What version of Turborepo are you using?

1.10.10

What package manager are you using / does the bug impact?

Yarn v2/v3 (node_modules linker only)

What operating system are you using?

Mac

Describe the Bug

Running turbo prune --scope=X --docker properly pairs down the list of packages, however the root package.json doesn't seem to be copied into the full folder.

This causes yarn to think that there are 0 packages and it generates an empty lock file.

According to the docs, there should be a package.json in the full directory.
https://turbo.build/repo/docs/reference/command-line-reference/prune#--docker

Expected Behavior

Copy the package.json into the full directory as well as the json directory

To Reproduce

turbo prune --scope=motion-dashboard --docker --out-dir ~/tmp/prune-test

root directory
CleanShot 2023-08-21 at 13 39 20

json directory
CleanShot 2023-08-21 at 13 40 01

full directory
CleanShot 2023-08-21 at 13 38 31

With 1.10.9

root directory
CleanShot 2023-08-21 at 13 42 55

json directory
CleanShot 2023-08-21 at 13 43 16

full directory
CleanShot 2023-08-21 at 13 43 37

Reproduction Repo

No response

@Xiot Xiot added kind: bug Something isn't working needs: triage New issues get this label. Remove it after triage owned-by: turborepo labels Aug 21, 2023
@Xiot Xiot changed the title [turborepo] Prune is removing all dependencies [turborepo] Prune is no longer copying package.json to full directory Aug 21, 2023
@chris-olszewski chris-olszewski self-assigned this Aug 21, 2023
@chris-olszewski chris-olszewski removed the needs: triage New issues get this label. Remove it after triage label Aug 21, 2023
@chris-olszewski
Copy link
Member

Thanks for the issue, #5769 should fix it.

@Xiot
Copy link
Author

Xiot commented Aug 21, 2023

Nice.

Currently I also need to copy over the .yarnrc file as well in order for the yarn install to work properly with the options that I have set up.

It looks like .npmrc is copied, but not the .yarnrc
https://github.com/vercel/turbo/pull/5531/files#diff-e61927c5381f3d8584b69c7437092722217c73789ef148ec0495faefbe59358aR49

I also just noticed that in either versions the .yarn/releases or .yarn/plugins were copied over either.

@chris-olszewski
Copy link
Member

I'd be open to look into if we could copy over .yarnrc without making it a breaking change, but I'm pretty hesitant to start copying over more parts of .yarn.

I don't think that there's platform dependent code in .yarn/releases or .yarn/plugins, but if there is then just copying it as part of prune could lead to undesired behavior in the Docker container. I think having RUN yarn set version and RUN yarn plugin import in the Dockerfile would probably be less error-prone.

@Xiot
Copy link
Author

Xiot commented Aug 21, 2023

That sounds good. And I'll look at explicitly calling set version and plugin import in my scripts.

I just need the .yarnrc for the linker config.

I'm fine copying the files over manually for my setup though.
Just wanted to raise it here since it was sort of related to my original issue.

chris-olszewski added a commit that referenced this issue Aug 22, 2023
### Description

Fixes #5768

We were copying the root `package.json` into `out` and not `out/full` as
intended if the `--docker` flag was used. This behavior would only
appear if the root `package.json` contained patches the needed to be
pruned. This PR gets us back to the Go behavior.

### Testing Instructions

Started also tracking the contents of `out/full` in an integration test


Closes TURBO-1227

---------

Co-authored-by: Chris Olszewski <Chris Olszewski>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: bug Something isn't working owned-by: turborepo
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants