Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(pack): add pack-gzip-level #6406

Conversation

jankaifer
Copy link
Contributor

@jankaifer jankaifer commented Apr 16, 2023

This options allows specifying custom compression level.
Underlying node implementation enforces correct number ranges,
but silently ignores NaN, so we explicitly check that provided value is valid.

More information about this level option can be found in node docs and zlib specs.

Supported values are (6 is default in node):

// Compression levels.
#define Z_NO_COMPRESSION         0
#define Z_BEST_SPEED             1
#define Z_BEST_COMPRESSION       9
#define Z_DEFAULT_COMPRESSION  (-1)

I didn't add any test but I tested manually
that compressing with -1, 0 and 1 create an installable package.

Also tested manually that using pnpm config set pack-gzip-level 0 and --pack-gzip-level=0 both work as expected.

fix #6393

This options allows specifying custom compression level.
Underlying node implementation enforces correct number ranges,
but silently ignores `NaN`, so we explicitly check that provided value is valid.

fix pnpm#6393
@jankaifer jankaifer requested a review from zkochan as a code owner April 16, 2023 14:04
@welcome
Copy link

welcome bot commented Apr 16, 2023

💖 Thanks for opening this pull request! 💖
Please be patient and we will get back to you as soon as we can.

@zkochan zkochan changed the title feat(pack): add PNPM_PACK_GZIP_LEVEL feat(pack): add pack-gzip-level Apr 16, 2023
Copy link
Contributor Author

@jankaifer jankaifer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zkochan zkochan force-pushed the jankaifer/6393-make-pnpm-pack-complersion-configurable branch from 21b5e8d to feb3254 Compare April 16, 2023 18:46
@zkochan zkochan enabled auto-merge (squash) April 16, 2023 19:08
@zkochan zkochan merged commit 32f8e08 into pnpm:main Apr 16, 2023
8 checks passed
@welcome
Copy link

welcome bot commented Apr 16, 2023

Congrats on merging your first pull request! 🎉🎉🎉

@jankaifer
Copy link
Contributor Author

jankaifer commented Apr 16, 2023

Thanks a bunch for your help.

@@ -30,6 +30,9 @@ export function rcOptionsTypes () {
export function cliOptionsTypes () {
return {
'pack-destination': String,
...pick([
'pack-gzip-level',

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider also adding this to help() below so it shows up in pnpm pack --help for discoverability?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[pnpm pack] Add option to allow setting custom compression level
3 participants