pnpm icon indicating copy to clipboard operation
pnpm copied to clipboard

`ignore-scripts` option to `pnpm prune`

Open seonglae opened this issue 3 years ago • 7 comments

Describe the user story

As a developer, I tried to remove dev deps in docker image. My workspace modules have some lifecycle script like prepare, postinstall using dev dependencies in build time. I don't need them in build time so I use pnpm prune. However that runs all lifecycle scripts with error. So I had to remove whole node_modules and reinstall with pnpm install --prod --ignore-scripts which takes long time. I think ignore-scripts option is needed to pnpm pruen either in this use case like pnpm install

Describe the solution you'd like

Similar implementation of ignore-scripts option to pnpm prune

Describe the drawbacks of your solution

Maybe no drawbacks

Describe alternatives you've considered

pnpm install --prod --prune option for minimized node_modules for runtime

seonglae avatar Jul 25 '22 05:07 seonglae

Do you want ignore-scripts to be true by default when running pnpm prune?

zkochan avatar Jul 31 '22 00:07 zkochan

It can be by default according to pnpm policy My opinion is appending cli option ignore-scripts to pnpm prune like pnpm install for above problem

seonglae avatar Jul 31 '22 11:07 seonglae

Try this as a workaround: pnpm prune --config.ignore-scripts=true

kazuare avatar Aug 18 '22 15:08 kazuare

@kazuare Thank you. It works!

However, contrary to the purpose of reducing the size of my docker image, pnpm prune does not reduce the size of node_modules folder.

seonglae avatar Aug 21 '22 13:08 seonglae

Related: https://github.com/pnpm/pnpm/issues/4770

danmichaelo avatar Aug 03 '23 13:08 danmichaelo

Hello ! @seonglae this work for me ! https://typicode.github.io/husky/how-to.html#ci-server-and-docker

By the way you need to specify the NODE_ENV=production in your Dockerfile, and also make sure you install both prod and dev dependencies before the build pnpm install --prod=false, this is the whole command i'm using : pnpm install --prod=false --ignore-scripts --frozen-lockfile

wilfriedago avatar Jan 31 '24 01:01 wilfriedago