Skip to content

feat: add DPRINT_AUTO_INSTALL env var - #1466

Merged
dsherret merged 4 commits into
dprint:mainfrom
DawnofGenX:feat/skip-auto-install-env-1411
Nov 30, 2026
Merged

dsherret merged 4 commits into
dprint:mainfrom
DawnofGenX:feat/skip-auto-install-env-1411

Conversation

@DawnofGenX

@DawnofGenX DawnofGenX commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Adds a DPRINT_AUTO_INSTALL environment variable for controlling which plugins dprint installs automatically:

  • 1 or true - Automatically install plugins (default when not set or empty).
  • wasm (case insensitive) - Only automatically install Wasm plugins and not process plugins.
  • Anything else (ex. 0, false) - Don't automatically install plugins.

Only the exact values above allow installing, so a typo or a value this version doesn't know about never installs anything.

When a plugin isn't installed and can't be installed automatically, dprint errors and says to run dprint install.

  • This is checked where a plugin is set up, so it also applies to a cached plugin that's corrupt or missing files, the executable of a process plugin in node_modules, and --reload (which says to run dprint install --reload).
  • A Wasm plugin that's a local file is still used because it only needs to be compiled. A local process plugin needs to be installed because setting it up runs it.
  • It doesn't apply to the commands for changing the plugins (dprint install, dprint add, dprint init, and dprint config update).
  • Editors don't ask about a download that this prevents.

This only prevents installing plugins. Remote configuration files are still downloaded and a process plugin that's already installed is still used, so it doesn't make it safe to run dprint with an untrusted configuration file.

Fixes #1411.

DawnofGenX and others added 3 commits November 24, 2026 18:10
…ppen

- don't download when a cached plugin is corrupt or missing files, for the
  executable of a local or node_modules process plugin, or to suggest a version
- allow `dprint install <plugin>`, `dprint add`, `dprint init`, and
  `dprint config update` to install plugins
- say to run `dprint install --reload` when using `--reload`
- don't ask in editors about a download that won't happen
- add to the help text and say to run `dprint install` in the docs
@dsherret dsherret changed the title feat: add DPRINT_SKIP_AUTO_INSTALL env var (#1411) feat: add DPRINT_NO_AUTO_INSTALL env var (#1411) Nov 30, 2026
- `1` and `true` install plugins automatically (default), `wasm` only
  installs Wasm plugins, and anything else installs nothing
- don't set up a local process plugin automatically when process plugins
  aren't, because setting it up runs it
@dsherret dsherret changed the title feat: add DPRINT_NO_AUTO_INSTALL env var (#1411) feat: add DPRINT_AUTO_INSTALL env var Nov 30, 2026

@dsherret dsherret left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks!

@dsherret
dsherret merged commit c8ce7cb into dprint:main Nov 30, 2026
5 of 6 checks passed
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.

Add env var for forcing explicit install

2 participants