@fsouza/prettierd

中文文档
0.29.0发布于 2026/07/26ISC构建来源已验证近 30 天下载 2.5万

prettier, as a daemon

原始使用文档
文档目录11 节
  1. Installation guide
  2. Using in the command line with node.js
  3. Supported languages / plugins
  4. Additional plugins
  5. Provide Default Configuration
  6. Local Instance
  7. Editor integration
  8. Vim / Neovim
  9. Sublime Text
  10. Zed
  11. Other editors

prettierd

Build Status

Wanna run prettier in your editor, but fast? Welcome to prettierd!

This is built on top of core_d.js and integrates with prettier.

Installation guide

$ npm install -g @fsouza/prettierd

NOTE: npm comes builtin to node.

Alternatively, users may also use homebrew:

$ brew install prettierd

Using in the command line with node.js

The prettierd script always takes the file in the standard input and the positional parameter with the name of the file:

$ cat file.ts | prettierd file.ts

Supported languages / plugins

Many parsers ship with prettierd, including JavaScript, TypeScript, GraphQL, CSS, HTML and YAML. Please notice that starting with version 0.12.0, prettierd now supports invoking the local version of prettier, so instead of adding new languages to prettierd, you should rely on that feature to use it locally with your custom version of prettier and enabled plugins.

Additional plugins

Additional plugins can be supported by installing them and adding them to the prettier configuration. For example, to use the Ruby plugin, install @prettier/plugin-ruby and add it to your configuration:

{
  // ... other settings
  "plugins": ["@prettier/plugin-ruby"],
}

Then formatting Ruby files should be possible.

Provide Default Configuration

You can provide a default configuration for the prettier via setting the environment variable PRETTIERD_DEFAULT_CONFIG to the exact path of the prettier configuration file.

Local Instance

If you have locally installed prettier in your package, it will use that. Otherwise, it will use the one bundled with the package itself.

If you want to use prettierd exclusively with the locally installed prettier package, you can set the environment variable PRETTIERD_LOCAL_PRETTIER_ONLY (any truthy value will do, good examples are true or 1).

Editor integration

Vim / Neovim

I use this directly with neovim's LSP client, via efm-langserver:

local prettier = {
  formatCommand = 'prettierd "${INPUT}"',
  formatStdin = true,
  env = {
    string.format('PRETTIERD_DEFAULT_CONFIG=%s', vim.fn.expand('~/.config/nvim/utils/linter-config/.prettierrc.json')),
  },
}

Alternatively, you can use prettierme to integrate directly with other editors.

Or, as a third option for users of Vim/Neovim plugins such as formatter.nvim or vim-codefmt, you can configure prettierd in the stdin mode. Below is an example with formatter.nvim:

require('formatter').setup({
  logging = false,
  filetype = {
    javascript = {
        -- prettierd
       function()
          return {
            exe = "prettierd",
            args = {vim.api.nvim_buf_get_name(0)},
            stdin = true
          }
        end
    },
    -- other formatters ...
  }
})

Sublime Text

Prettierd Format

You can use Prettierd Format to format your files with prettierd. After installation, it enables format-on-save for any file supported by Prettier by default.

Fmt

Alternatively, if you're looking for something more advanced that supports multiple formatters, you can use Fmt and configure prettierd for each language scope you wish to format:

{
  "rules": [
    {
      "selector": "source.ts",
      "cmd": ["prettierd", "--stdin-filepath", "$file"],
      "format_on_save": true,
    },
    {
      "selector": "source.json",
      // ...
    },
    // ...
  ],
}

Zed

To use Prettierd with Zed, you need to configure the language_overrides adding a format_on_save command for each of the languages you wish to be handling.

[!NOTE] Configuration below assumes you have installed prettierd and gives an example of its path from Homebrew installation. You can check path on your system by running which prettierd.

Example configuration:

{
  "language_overrides": {
    "TypeScript": {
      "format_on_save": {
        "external": {
          "command": "/opt/homebrew/bin/prettierd",
          "arguments": ["--stdin-filepath", "{buffer_path}"]
        }
      }
    }
  }
}

Save your configuration file, and provided you've installed and set the correct path to prettierd program, Zed will start formatting your files on save action.

Other editors

I don't know much about other editors, but feel free to send a pull requests on instructions.

版本与发布记录

@fsouza/prettierd 共发布 67 个版本,首次发布于 2020/07/19;过去 12 个月发布了 3 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.29.0latest2026/07/263 个月前
0.28.02026/05/285 个月前
0.27.02026/02/079 个月前
0.26.22025/08/251.2 年前
0.26.12025/01/181.8 年前
0.26.02025/01/041.9 年前

关于 @fsouza/prettierd 的常见问题

@fsouza/prettierd 是什么?

prettier, as a daemon

如何安装 @fsouza/prettierd?

在项目目录运行 npm install @fsouza/prettierd,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 prettierd,可以用 npx prettierd 直接运行。

@fsouza/prettierd 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/fsouza__prettierd 是否存在。

@fsouza/prettierd 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=22。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@fsouza/prettierd 可以商用吗?

@fsouza/prettierd 使用 ISC 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@fsouza/prettierd 的下载量有多少?

根据 npm 官方下载统计,@fsouza/prettierd 在 2026/10/16 – 2026/11/14 这 30 天内被下载 25,041 次,日均约 835 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@fsouza/prettierd 还在维护吗?

最新版本 0.29.0 发布于 2026/07/26(3 个月前);至今共发布 67 个版本,其中过去 12 个月发布了 3 个;首次发布于 2020/07/19。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。