yarnpkg / yarn

The 1.x line is frozen - features and bugfixes now happen on https://github.com/yarnpkg/berry
https://classic.yarnpkg.com
Other
41.39k stars 2.73k forks source link

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

Open bitjson opened 5 years ago

bitjson commented 5 years ago

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.

arcanis commented 5 years ago

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

raDiesle commented 2 years ago

I need this. I wonder why noone else reported here

furryboffin commented 1 year ago

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?