Add a new parameter option for prefix
The prefix paramter would function just the same as git archive prefex=<prefix> --> Prepend <prefix>/ to each filename in the archive.
In order to use npm install the module must be in directory of the tarball. You can see from this issue on npm using git archive the solution is to add --prefix=project/ https://github.com/npm/npm/issues/2250
If there is a better way of being able to do NPM install using Stash, please let me know, but adding this functionality should fix the issue.
Comments (8)
-
-
This also works and is the default way tarballs are created from the cli.
git archive --format=tar master --prefix=./ | gzip > tarball.tar.gz
We can't deploy npm modules from stash due to this.
-
- changed status to open
-
glad to see I'm not the only one.
Finally dug around and found the mandatory
strip: 1
that basically forces npm to select an arbitrary subdirectory instead of just extracting everything.please keep me posted on this one, it is a huge miss for anyone using npm.
-
@tpettersen it looks like there's an active PR waiting to be merged here, is there any reason we can't get it into master?
-
Account Deactivated - changed status to resolved
When 2.1 is released to Marketplace, you'll be able to add
?prefix=whatever
to your URLs as requested.Note that
git archive --prefix
does not add a trailing / to your value. That means if you rungit archive --prefix=example
you end up with an archive that has "example" prepended directly to all files and directories, essentially "corrupting" their names. That is not howprefix
is implemented here. If theprefix
query parameter does not have a trailing /, one is added by the system automatically. That means all prefixes are treated as directories. -
Account Deactivated 2.1.0 is now available from Marketplace.
-
@bpturner awesome, thanks!
- Log in to comment
Great idea! I hadn't thought of installing NPM modules directly from Stash. I'll take a look at this when I get a chance. Otherwise pull requests are gratefully accepted if you feel like digging into some java.