Skip to content

Commit

Permalink
fix: pack-gzip-level
Browse files Browse the repository at this point in the history
  • Loading branch information
zkochan committed Apr 16, 2023
1 parent dde3cc8 commit feb3254
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
1 change: 1 addition & 0 deletions releasing/plugin-commands-publishing/src/pack.ts
Expand Up @@ -113,6 +113,7 @@ export async function handler (
projectDir: dir,
embedReadme: opts.embedReadme,
modulesDir: path.join(opts.dir, 'node_modules'),
packGzipLevel: opts.packGzipLevel,
})
if (!opts.ignoreScripts) {
await _runScriptsIfPresent(['postpack'], entryManifest)
Expand Down
2 changes: 1 addition & 1 deletion releasing/plugin-commands-publishing/src/publish.ts
Expand Up @@ -133,7 +133,7 @@ export async function publish (
engineStrict?: boolean
recursive?: boolean
workspaceDir?: string
} & Pick<Config, 'allProjects' | 'gitChecks' | 'ignoreScripts' | 'publishBranch' | 'embedReadme'>,
} & Pick<Config, 'allProjects' | 'gitChecks' | 'ignoreScripts' | 'publishBranch' | 'embedReadme' | 'packGzipLevel'>,
params: string[]
) {
if (opts.gitChecks !== false && await isGitRepo()) {
Expand Down
17 changes: 14 additions & 3 deletions releasing/plugin-commands-publishing/test/pack.ts
Expand Up @@ -287,14 +287,25 @@ test('pack: custom pack-gzip-level', async () => {
version: '0.0.0',
})

await pack.handler({
const packOpts = {
...DEFAULT_OPTS,
argv: { original: [] },
dir: process.cwd(),
extraBinPaths: [],
}
await pack.handler({
...packOpts,
packGzipLevel: 9,
packDestination: path.resolve('../small'),
})

expect(await exists('test-publish-package.json-0.0.0.tgz')).toBeTruthy()
expect(await exists('package.json')).toBeTruthy()
await pack.handler({
...packOpts,
packGzipLevel: 0,
packDestination: path.resolve('../big'),
})

const tgz1 = fs.statSync(path.resolve('../small/test-publish-package.json-0.0.0.tgz'))
const tgz2 = fs.statSync(path.resolve('../big/test-publish-package.json-0.0.0.tgz'))
expect(tgz1.size).not.toEqual(tgz2.size)
})

0 comments on commit feb3254

Please sign in to comment.