I am trying to replicate the behavior of npm pack
because it has a limitation where it does not write to stdout, it can only write to a local file (see this issue: https://github.com/npm/npm/issues/12039)
Now, I can tar the current directory and write to stdout like so:
tar --exclude='./node_modules/' -cv . | gzip > archive.tar.gz
however, when you extract npm pack
tarballs, all the contents of a your package should be in a directory called 'package'
.
So my question is - how can I tarball the current directory, but put the current directory inside a directory called 'package'
before it gets archived?
Is there some tar -flag that lets you do that?