latest
hilja/prunerPrune unneeded file from node_modules before deploying
This package works with Node.jsIt is unknown whether this package works with Cloudflare Workers, Deno, Bun



JSR Score
64%
Published
a year ago (0.1.4)
Pruner
Will prune node_modules
so your final Docker images is smaller. Cuts about
10 to 20 percent off. Comes handy if you’re dealing with limited resources
or work at a scale of thousands of projects. Or you’re just obsessed with small
deployments.
Install
This package is hosted in jsr.dev, but you can install it with your normal tools:
pnpm dlx jsr add -D @antti/pruner
It’s a single JavaScript file with no deps, so you can just copy it to your project if you don’t want to install it.
Usage
pnpm dlx @antti/pruner --path=node_modules/.pnpm # Or pnpm pruner --path=node_modules/.pnpm
Example usage in Dockerfile:
FROM node:lts-alpine3.19 AS base RUN corepack enable WORKDIR /usr/src/app COPY pnpm-lock.yaml . RUN pnpm fetch COPY . . RUN pnpm i --offline --frozen-lockfile RUN pnpm build RUN pnpm -F=foo --prod deploy /myapp/foo # Run it as the last command step of the build step RUN pnpm pruner --path=/myapp/foo/node_modules/.pnpm # Enjoy slimmer image FROM node:lts-alpine3.19 AS foo COPY --from=base /myapp/foo /myapp/foo WORKDIR /myapp/foo CMD node build/server.js
Other packages
- npmprune (bash)
- node-prune (bash)
Add Package
deno add jsr:@antti/pruner
Import symbol
import * as pruner from "@antti/pruner";
Import directly with a jsr specifier
import * as pruner from "jsr:@antti/pruner";
Add Package
pnpm i jsr:@antti/pruner
pnpm dlx jsr add @antti/pruner
Import symbol
import * as pruner from "@antti/pruner";
Add Package
yarn add jsr:@antti/pruner
yarn dlx jsr add @antti/pruner
Import symbol
import * as pruner from "@antti/pruner";
Add Package
vlt install jsr:@antti/pruner
Import symbol
import * as pruner from "@antti/pruner";
Add Package
npx jsr add @antti/pruner
Import symbol
import * as pruner from "@antti/pruner";
Add Package
bunx jsr add @antti/pruner
Import symbol
import * as pruner from "@antti/pruner";