Skip to content

deno clean -e / deno clean --prod #27229

Open
@lucacasonato

Description

It would be great to add a mode to deno clean where it only cleans some of the DENO_DIR / node_modules folder. I am imagining a deno clean -e that has the same behaviour as deno clean && rm -rf node_modules && deno install -e, and a deno clean --prod which has the same behaviour as deno clean && rm -rf node_modules && deno install --prod. Unlike the mentioned alternatives, this would not require re-downloading and untarring a bunch of packages however (this is slow!).

This would be very useful for Docker setups:

FROM denoland/deno

COPY . .

# install dependencies (including dev), to perform the build
RUN deno install
RUN deno task build

# remove all the dev dependencies
RUN deno clean -e main.ts # or RUN deno clean --prod

# warmup code cache
RUN timeout 2s deno run --cached-only -A main.ts || true

ENTRYPOINT ["deno", "run", "--cached-only", "-A", "main.ts"]

Right now this requires a multi step build, which is really annoying because it adds significant overhead because dependencies need to be installed twice.

Metadata

Labels

clirelated to cli/ dirinstallsuggestionsuggestions for new features (yet to be agreed)

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions