-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
[FEATURE] new install protocol file+pack #1333
Comments
This should be an rfc for sure. It's a good idea, and one that might make my personal day to day work a bit easier. If so, I'd be eager to get it implemented 😂 Right now the workaround is to pack the dir, and then install the packed tarball. That of course works, but it's an extra step. The advantage there is that the installed dep only changes when the artifact is re-generated. The disadvantage, obviously, is the extra step. Some other thoughts:
|
Also, spelling of the protocol needs to be bikeshedded. I don't know off the top of my head any reason to prefer We might also explore something like |
Hi @isaacs, thanks a lot for the quick response and insightful feedback!
Didn't know what would the exact process, should I create the pull request to keep the discussion there?
Completely agree! I was just thinking about this some minutes ago 😄
That's a reasonable "caveat" then, I wouldn't like adding logic to publishing where npm would need to check dependency tree to refuse in case of such a dependency.
I thought about file+pack, mainly because the syntax I was using resembles or downright equals
I didn't think about this – and right now I can't think of a use case –, but I do like the idea of composable schemas. |
@isaacs created RFC pull request npm/rfcs#150 to continue discussion there! |
What / Why
Currently it's possible to install packages from a folder, which is quite nice for quickly prototyping of monorepos, but becomes problematic with linking dependencies and binaries when things progressively grow and build processes are required in between.
The request to have a protocol
file+pack
would be pretty much the same, except it triggersnpm pack
on the directory prior to linking it to the parent.This would allow hooking in with a
prepack
script to build/bundle the package before creating tar file.As an example, we could have a repository like:
With a dependency graph similar to this:
Being able to pack
@app/core
before it being installed inapp
,client
or@app/http
would compile sources to generate dist folder while also allowing the tgz package to be installed inapp
,client
or@app/http
with just runtime dependencies as usual in npm install flow.This may trigger multiple builds on packages which are repeated/shared between other dependencies. This could be solved by creating a dependency graph, keeping track of which packages were already built and building from leafs up.
It also means every single package is installable in isolation by default! No need for
lerna bootstrap
nor installing and hoisting all packages dependencies when just a few are required, which potentially improves CI times and splitting of builds.How
Not sure how the exact implementation for this would be, but given the following packages:
When resolving
file+pack
the following will happen:Related issues
#529 (comment)
#702
#459 (comment)
Possible caveats
file+pack
are usually intended for local usage / fixed versioning as part of monorepos and usually not meant to be published nor shared aroundThe text was updated successfully, but these errors were encountered: