# @bigbinary/neeto-comments-frontend 中文文档

规范地址：https://npmcn.com/package/%40bigbinary/neeto-comments-frontend/

版本：2\.4\.3
npm 元数据更新时间：2026-11-05T08:53:51.276Z
中文译文更新时间：2026-11-08T02:24:05.957Z
软件包许可：UNLICENSED

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40bigbinary/neeto-comments-frontend
原文对照：https://npmcn.com/package/%40bigbinary/neeto-comments-frontend/?lang=original
项目主页：https://github.com/bigbinary/neeto-comments-nano

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：17 kB，52 个文件
- 模块格式：ESM + CJS
- TypeScript 类型：包内自带
- Node.js 要求：\>=22\.13
- 运行依赖：3 个
- peer 依赖：qs 6\.16\.2，url 0\.11\.4，yup 0\.32\.11，antd 5\.22\.1，util ^0\.12\.5，axios 1\.20\.0，ramda 0\.29\.0，react 18\.3\.1，buffer ^6\.0\.3，formik 2\.4\.6，i18next 22\.5\.1，zustand 4\.4\.2，dompurify 3\.4\.17，js-logger 1\.6\.1，react-dom 18\.3\.1，classnames 2\.5\.1，stream-http 3\.2\.0，tailwindcss ^4\.1\.17，react-helmet ^6\.1\.0，os-browserify 0\.3\.0，react-i18next 12\.3\.1，vm-browserify 1\.1\.2，@babel/runtime 7\.29\.7，react-toastify 8\.0\.2，tty-browserify 0\.0\.1，path-browserify ^1\.0\.1，https-browserify 1\.0\.0，mixpanel-browser ^2\.45\.0，react-router-dom 5\.3\.3，crypto-browserify 3\.12\.1，source-map-loader 4\.0\.1，stream-browserify ^3\.0\.0，@bigbinary/neetoui 8\.8\.3，@honeybadger-io/js 6\.10\.1，@bigbinary/neeto-cist 1\.0\.17，@honeybadger-io/react 6\.1\.25，@tanstack/react-query 5\.59\.20，@bigbinary/neeto-icons 1\.20\.89，@bigbinary/neeto-molecules 5\.12\.0，@tanstack/react-query-devtools 5\.59\.20，@bigbinary/neeto-commons-frontend 4\.15\.0，@bigbinary/neeto-filters-frontend 4\.7\.1
- 首次发布：2024-01-09T04:24:15.040Z
- 最新版本发布：2026-11-05T08:53:50.788Z
- 近 30 天下载量：3474（2026-10-08 至 2026-11-06，npm 官方下载统计）
- 已发布版本数：41（近 12 个月 23 个）

## 中文简介

一个回波作为新纳米结构,配置,数据等的真理来源.

## 安装

```sh
npm install @bigbinary/neeto-comments-frontend
```

也可以使用：`pnpm add @bigbinary/neeto-comments-frontend`、`yarn add @bigbinary/neeto-comments-frontend`、`bun add @bigbinary/neeto-comments-frontend`

## README

# 需要评论-nano

这个 `neeto-comments-nano` 管理应用程序中的评论, 通知 根据用户的喜好通过电子邮件提及用户.

## 目录

1.  [用主机应用程序开发](https://npmcn.com/package/%40bigbinary/neeto-comments-frontend/#readme-development-with-host-application)
    -   [发动机](https://npmcn.com/package/%40bigbinary/neeto-comments-frontend/#readme-engine)
        -   [安装](https://npmcn.com/package/%40bigbinary/neeto-comments-frontend/#readme-installation)
        -   [使用量](https://npmcn.com/package/%40bigbinary/neeto-comments-frontend/#readme-usage)
2.  [出版指令](https://npmcn.com/package/%40bigbinary/neeto-comments-frontend/#readme-instructions-for-publishing)

## 用主机应用程序开发

### 发动机

引擎处理注释表的后端并通知首选 在创建新评论时,用户通过电子邮件.

#### 安装

1.  将此行添加到您的应用程序的 Gemfile 中 :
    
    ```ruby
     source "NEETO_GEM_SERVER_URL" do
       # ..existing gems
    
       gem "neeto-comments-engine"
     end
    ```
    
2.  然后执行:
    
    ```shell
    bundle install
    ```
    
3.  将此行添加到您的应用程序 `config/routes.rb` 文件 :
    
    ```ruby
     mount NeetoCommentsEngine::Engine, at: "/neeto_comments"
    ```
    
4.  运行命令以将所需的全部迁移从引擎带入 主机应用程序 :
    
    ```shell
    bundle exec rails neeto_comments_engine:install:migrations
    ```
    
5.  添加迁移到数据库 :
    
    ```shell
    bundle exec rails db:migrate
    ```
    

### 使用量

#### 型号

#### Neeto 评论引擎: Comment ([源代码](https://github.com/bigbinary/neeto-comments-nano/blob/8261b62d38e598b58d52bfa6020429560f79d170/app/models/neeto_comments_engine/comment.rb)(中文(简体) )

这个模型有以下多态性关联

```ruby
belongs_to :commentable, polymorphic: true
belongs_to :creator, polymorphic: true
```

这里, `commentable` 是我们要添加评论的实体。 例如,在 `NeetoPlanner`, (中文(简体) ), `Task` 是可评论的实体。 我们可以在任务中添加注释如下: 如下:

```ruby
has_many :comments, as: :commentable, dependent: :destroy
```

同样 `creator` 是创建注释的实体.

在主机应用程序中,我们可以使用 `Comment` 模式的继承 如下:

```ruby
class Comment < NeetoCommentsEngine::Comment
  self.table_name = "neeto_comments_engine_comments"
end
```

主机应用程序的继承模式需要下列方法: 创建注释后立即通知注释中提到的用户 :

```ruby
    def email_data
      {
        preference_link:,      # Notification preference URL
        organization_name:,
        link_title:,           # Title
        subject:,              # Subject
        reply_to:              # Reply to email
      }
    end
```

这个 `get_mentioned_ids_from_content` 方法返回 提及需要通知和可以使用的用户如下:

```ruby
    def notifiable_users
      user_list = get_mentioned_ids_from_content(content)
      User.where(id: user_list)
    end
```

#### 主计长

#### Neeto 评论引擎: Api: V1:: 评论控制器( )[源代码](https://github.com/bigbinary/neeto-comments-nano/blob/8261b62d38e598b58d52bfa6020429560f79d170/app/controllers/neeto_comments_engine/api/v1/comments_controller.rb)(中文(简体) )

在主机应用程序中,我们可以继承 `CommentsController` 内容如下:

```ruby
class Api::V1::CommentsController < NeetoCommentsEngine::Api::V1::CommentsController
  private

    def load_commentable!
      # required method in the host application to load the commentable entity
    end
end
```

#### 关切

#### Neeto 评论引擎: 通知 首选项( E)[源代码](https://github.com/bigbinary/neeto-comments-nano/blob/8261b62d38e598b58d52bfa6020429560f79d170/app/models/concerns/neeto_comments_engine/notification_preferences.rb)(中文(简体) )

包括下列关切: `commentable` 模式

```ruby
include NeetoCommentsEngine::NotificationPreferences
```

这个 `notify_mentioned_user?(user)` 返回布尔值,以决定是否 发送电子邮件给用户与否。 默认返回方法 `true`这个 可被主机应用程序所覆盖.

```ruby
   def notify_mentioned_user?(user)
     true
   end
```

这个 `notify_mentions_via_email?` 返回布尔值,以决定是否 发送电子邮件给该可评论实体与否。 默认返回方法 `true`。这可以被主机应用程序所覆盖.

```ruby
    def notify_mentions_via_email?
      true
    end
```

# 出版指令

咨询 [构建和释放软件包](https://neeto-engineering.neetokb.com/articles/building-and-releasing-packages) 关于如何出版的详细指南.

## 常见问题

### @bigbinary/neeto-comments-frontend 是什么？

一个回波作为新纳米结构,配置,数据等的真理来源\.

### 如何安装 @bigbinary/neeto-comments-frontend？

在项目目录运行 npm install @bigbinary/neeto-comments-frontend，或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖：qs（6\.16\.2）、url（0\.11\.4）、yup（0\.32\.11）、antd（5\.22\.1）、util（^0\.12\.5）、axios（1\.20\.0）、ramda（0\.29\.0）、react（18\.3\.1）、buffer（^6\.0\.3）、formik（2\.4\.6）、i18next（22\.5\.1）、zustand（4\.4\.2）、dompurify（3\.4\.17）、js-logger（1\.6\.1）、react-dom（18\.3\.1）、classnames（2\.5\.1）、stream-http（3\.2\.0）、tailwindcss（^4\.1\.17）、react-helmet（^6\.1\.0）、os-browserify（0\.3\.0）、react-i18next（12\.3\.1）、vm-browserify（1\.1\.2）、@babel/runtime（7\.29\.7）、react-toastify（8\.0\.2）、tty-browserify（0\.0\.1）、path-browserify（^1\.0\.1）、https-browserify（1\.0\.0）、mixpanel-browser（^2\.45\.0）、react-router-dom（5\.3\.3）、crypto-browserify（3\.12\.1）、source-map-loader（4\.0\.1）、stream-browserify（^3\.0\.0）、@bigbinary/neetoui（8\.8\.3）、@honeybadger-io/js（6\.10\.1）、@bigbinary/neeto-cist（1\.0\.17）、@honeybadger-io/react（6\.1\.25）、@tanstack/react-query（5\.59\.20）、@bigbinary/neeto-icons（1\.20\.89）、@bigbinary/neeto-molecules（5\.12\.0）、@tanstack/react-query-devtools（5\.59\.20）、@bigbinary/neeto-commons-frontend（4\.15\.0）、@bigbinary/neeto-filters-frontend（4\.7\.1）。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖，Yarn 需要手动安装。

### @bigbinary/neeto-comments-frontend 支持 TypeScript 吗？

支持。包内自带 TypeScript 类型声明（package\.json 声明了 types 入口），安装后即可获得类型提示，无需再安装 @types 包。

### @bigbinary/neeto-comments-frontend 支持 ESM 还是 CommonJS？

同时提供 ES Module 与 CommonJS 入口，import 和 require\(\) 都可以使用，打包工具会自动选择合适的版本。

### @bigbinary/neeto-comments-frontend 需要什么版本的 Node\.js？

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

### @bigbinary/neeto-comments-frontend 可以商用吗？

@bigbinary/neeto-comments-frontend 使用 UNLICENSED 许可。作者声明为 UNLICENSED，即不授予公开使用许可（与公共领域的 Unlicense 不同）。使用前需获得作者授权。以上为概括，不构成法律意见，请以许可原文为准。

### @bigbinary/neeto-comments-frontend 的下载量有多少？

根据 npm 官方下载统计，@bigbinary/neeto-comments-frontend 在 2026/10/08 – 2026/11/06 这 30 天内被下载 3,474 次，日均约 116 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入，适合横向比较热度，不能直接等同于使用人数。

### @bigbinary/neeto-comments-frontend 还在维护吗？

最新版本 2\.4\.3 发布于 2026/11/05（3 天前）；至今共发布 41 个版本，其中过去 12 个月发布了 23 个；首次发布于 2024/01/09。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

