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

Yarn does not run prepack when installing Git dependencies #5047

Closed
wilg opened this issue Dec 5, 2017 · 7 comments
Closed

Yarn does not run prepack when installing Git dependencies #5047

wilg opened this issue Dec 5, 2017 · 7 comments
Assignees
Labels
cat-bug fixed-in-modern This issue has been fixed / implemented in Yarn 2+. help wanted triaged

Comments

@wilg
Copy link

wilg commented Dec 5, 2017

Do you want to request a feature or report a bug?
bug

What is the current behavior?
The dependency's prepack script is not run when installing a dependency that includes one.

If the current behavior is a bug, please provide the steps to reproduce.
Install a dependency via git that specifies a prepack script. NPM documentation specifically mentions this: https://docs.npmjs.com/misc/scripts

prepack: run BEFORE a tarball is packed (on npm pack, npm publish, and when installing git dependencies)

What is the expected behavior?
The prepack script is executed.

Please mention your node.js, yarn and operating system version.

› node -v
v8.1.4

› yarn -v
1.3.2

@ghost ghost assigned rally25rs Dec 5, 2017
@ghost ghost added the triaged label Dec 5, 2017
@aikar
Copy link

aikar commented Dec 6, 2017

This is a primary reason i've avoided git deps as a forking mechanism considering their behavior then changes due to differences in .gitignore vs .npmignore.

This idea sounds like a great solution to the primary concerns.

However, postpack also needs to be ran!!

I use this script I wrote in postpack: https://github.com/aikar/json-object/blob/master/build/postpack.sh

This modifies the tarball, moving all dist/* down a level so that non entry point imports can be clean import bar from "foo/bar"; instead of from "foo/dist/bar";

If my library was to be imported as a git repo, this would result in a different file structure.

@mgtitimoli
Copy link

Hey there,

I've just came across with this issue, @rally25rs you marked it with the label help wanted, does this mean that if anyone submits a PR to fix this, then it's gonna be merged and included in the next release?

@cocco3
Copy link

cocco3 commented Feb 28, 2019

Are there any plans on tackling this? Does anyone know if there is a work around?

bericp1 added a commit to Carimus/node-disks that referenced this issue Apr 5, 2019
Due to yarnpkg/yarn#5047, prepack doesnt get triggered with yarn so we cant do direct git installs
in a consistent way unfortunately.
@paul-soporan
Copy link
Member

Closing as it's been fixed in the v2.

https://yarnpkg.com/getting-started/migration

@paul-soporan paul-soporan added the fixed-in-modern This issue has been fixed / implemented in Yarn 2+. label Jan 2, 2021
@masaeedu
Copy link

@paul-soporan Would it make sense to reopen this issue and use it to track backporting a fix to yarn 1.x? Migrating to yarn 2 is great for when that can happen, but it doesn't seem like a trivial amount of effort.

@paul-soporan
Copy link
Member

@masaeedu 1.x is frozen, which means that only security fixes are going to be merged.

"backporting a fix to yarn 1.x" isn't really a thing as classic and modern are two entirely different codebases with different architectures, so such a fix would have to be implemented in an entirely different way for Yarn 1.x.

@Mistic92
Copy link

This is weird. On WSL2 ubuntu prepack is working and run build script. On Docker image node:12/14 slim/alpine it's not. I'm using yarn 3.0.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cat-bug fixed-in-modern This issue has been fixed / implemented in Yarn 2+. help wanted triaged
Projects
None yet
Development

No branches or pull requests

8 participants