yarn icon indicating copy to clipboard operation
yarn copied to clipboard

Yarn equivalent for "npm pack [package-name]"?

Open bitjson opened this issue 6 years ago • 2 comments

I think this is a feature request, but maybe I'm just missing some documentation.

What is the current behavior?

yarn pack doesn't accept an argument. So yarn pack matches npm pack, but there doesn't seem to be a way to replicate npm pack [package-identifier] with Yarn.

What is the expected behavior?

You can see the npm-pack documentation here.

For anything that’s installable (that is, a package folder, tarball, tarball url, name@tag, name@version, name, or scoped name), this command will fetch it to the cache, and then copy the tarball to the current working directory as -.tgz, and then write the filenames out to stdout.

If the same package is specified multiple times, then the file will be overwritten the second time.

If no arguments are supplied, then npm packs the current package folder.

The --dry-run argument will do everything that pack usually does without actually packing anything. Reports on what would have gone into the tarball.

Does Yarn have some CLI method of fetching the gzipped tarball? My workaround is: npm pack [identifier from yarn.lock]

I don't think Yarn needs to provide the same API as NPM here (especially because "pack" is a strange place to put a fetching function), but it would be helpful to have the option to pull the raw tarball out of Yarn without installing. Something like yarn fetch [identifier].

I'm on yarn version v1.13.0.

bitjson avatar Mar 11 '19 22:03 bitjson

We don't have one, but it would be very easy to implement a plugin on the v2

arcanis avatar Mar 15 '19 11:03 arcanis

I need this. I wonder why noone else reported here

raDiesle avatar Sep 16 '22 12:09 raDiesle

has this ever been added? I'm switching a project from npm to yarn now. The old version uses npm pack dist/ to build the project into the /dist folder. What would be the current equivalent of this for yarn?

furryboffin avatar Sep 30 '22 14:09 furryboffin