Add a new parameter option for prefix

Issue #6 resolved
Jordan Rousseau created an issue

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)

  1. Timothy Pettersen

    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.

  2. dwells

    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.

  3. Drew Covi

    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.

  4. Bryan Turner Account Deactivated

    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 run git 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 how prefix is implemented here. If the prefix query parameter does not have a trailing /, one is added by the system automatically. That means all prefixes are treated as directories.

  5. Log in to comment