Verdaccio

Verdaccio

  • Docs
  • Blog
  • Twitter
  • Help
  • GitHub
  • Team
  • 支持我们
  • Languages icon中文
    • English
    • Español
    • Français
    • Russian
    • Yoruba
    • 帮助翻译

›Features

Introduction

  • Verdaccio是什么?
  • 安装
  • 命令行工具
  • Using a private registry
  • 谁在使用 Verdaccio?
  • Security Policy
  • Logotype
  • Uses Cases

    • End to End testing
    • Caching strategies
    • GitHub Actions
    • 链接远程Registry

    Talks & Articles

    • Articles
    • Talks

Features

  • 配置文件
  • 上行链路
  • 包的访问
  • Authentication
  • 通知
  • 记录器
  • Web 用户界面

Server

  • 服务器配置
  • 逆向代理服务器设置
  • 设置SSL 证书
  • 作为 Windows 服务安装
  • IIS server上进行安装

Development

  • 插件
  • 插件开发
  • Dev Guides

    • Plugin Generator
    • Authentication Plugin(认证插件)
    • Middleware Plugin(Middleware 插件)
    • Storage Plugin(存储插件)
  • Node API

DevOps

  • Docker
  • Kubernetes
  • 持续集成
  • Cloud

    • 亚马逊Web服务

    Tools

    • Ansible
    • Puppet
    • Chef Cookbook

Guides

  • Best Practices
  • 保护包
  • Amazon Web Services
Translate

通知

Notify was built primarily to use with Slack's Incoming webhooks, but will also deliver a simple payload to any endpoint. This is currently only active for the npm publish command.

使用

HipChat, Stride 和 Google Hangouts Chat hook的一个范例:

Verdaccio supports any API, feel free to add more examples.

单个通知

notify:
  method: POST
  headers: [{'Content-Type': 'application/json'}]
  endpoint: https://usagge.hipchat.com/v2/room/3729485/notification?auth_token=mySecretToken
  content: '{"color":"green","message":"New package published: * {{ name }}*","notify":true,"message_format":"text"}'

多通知

notify:
  'example-google-chat':
    method: POST
    headers: [{'Content-Type': 'application/json'}]
    endpoint: https://chat.googleapis.com/v1/spaces/AAAAB_TcJYs/messages?key=myKey&token=myToken
    content: '{"text":"New package published: `{{ name }}{{#each versions}} v{{version}}{{/each}}`"}'
  'example-hipchat':
     method: POST
     headers: [{'Content-Type': 'application/json'}]
     endpoint: https://usagge.hipchat.com/v2/room/3729485/notification?auth_token=mySecretToken
     content: '{"color":"green","message":"New package published: * {{ name }}*","notify":true,"message_format":"text"}'
  'example-stride':
     method: POST
     headers: [{'Content-Type': 'application/json'}, {'authorization': 'Bearer secretToken'}]
     endpoint: https://api.atlassian.com/site/{cloudId}/conversation/{conversationId}/message
     content: '{"body": {"version": 1,"type": "doc","content": [{"type": "paragraph","content": [{"type": "text","text": "New package published: * {{ name }}* Publisher name: * {{ publisher.name }}"}]}]}}'

模板

我们用Handlebars 作为主要模板引擎。

格式范例

# iterate all versions
{{ name }}{{#each versions}} v{{version}}{{/each}}

# publisher and `dist-tag` package published
{{ publisher.name }} has published {{ publishedPackage }}

属性

通过模板进入的属性列表

  • 元数据
  • 发表者(在发表的人)
  • 已发布的包(包@1.0.0)

元数据

模板可以访问的包元数据

{
    "_id": "@test/pkg1",
    "name": "@test/pkg1",
    "description": "",
    "dist-tags": {
        "beta": "1.0.54"
    },
    "versions": {
        "1.0.54": {
            "name": "@test/pkg1",
            "version": "1.0.54",
            "description": "some description",
            "main": "index.js",
            "scripts": {
                "test": "echo \"Error: no test specified\" && exit 1"
            },
            "keywords": [],
            "author": {
                "name": "Author Name",
                "email": "author@domain.com"
            },
            "license": "MIT",
            "dependencies": {
                "webpack": "4.12.0"
            },
            "readmeFilename": "README.md",
            "_id": "@ test/pkg1@1.0.54",
            "_npmVersion": "6.1.0",
            "_nodeVersion": "9.9.0",
            "_npmUser": {},
            "dist": {
                "integrity": "sha512-JlXWpLtMUBAqvVZBvH7UVLhXkGE1ctmXbDjbH/l0zMuG7wVzQ7GshTYvD/b5C+G2vOL2oiIS1RtayA/kKkTwKw==",
                "shasum": "29c55c52c1e76e966e706165e5b9f22e32aa9f22",
                "tarball": "http://localhost:4873/@test/pkg1/-/@test/pkg1-1.0.54.tgz"
            }
        }
    },
    "readme": "# test",
    "_attachments": {
        "@test/pkg1-1.0.54.tgz": {
            "content_type": "application/octet-stream",
            "data": "H4sIAAAAAAAAE+y9Z5PjyJIgOJ ...",
            "length": 33112
        }
    },
    "time": {}
}

发表人

You can get access to the package publisher information in the content of a webhook using the publisher object.

请参阅以下publisher object(对象)类别:

{
  name: string,
  groups: string[],
  real_groups: string[]
}

范例:

notify:
  method: POST
  headers: [{'Content-Type': 'application/json'}]
  endpoint: https://usagge.hipchat.com/v2/room/3729485/notification?auth_token=mySecretToken
  content: '{"color":"green","message":"New package published: * {{ name }}*. Publisher name: * {{ publisher.name }} *.","notify":true,"message_format":"text"}'

请注意: 如果 package.json 文件已经有publisher属性,是不可能再拿到发表人信息的。

已发布包

You can access to the package is being published with the keyword {{publishedPackage}} as follows.

{{ publisher.name }} has published {{ publishedPackage }}

配置

属性类型必填支持默认描述
methodstringNoallHTTP verb
packagePatternstringNoall仅当包名字和正规表达式匹配时才运行此通知
packagePatternFlagsstringNoall任何与正规表达式一起使用的标记
headersarray/objectYesall如果此端点需要特定的标头,请把它们设置为键数组:value objects(值对象)。
endpointstringYesall设置此调用的URL 端点
contentstringYesall任何Handlebar表达式
← Authentication记录器 →
  • 使用
  • 模板
    • 格式范例
    • 属性
    • 元数据
    • 发表人
    • 已发布包
  • 配置
Verdaccio
Docs
Getting StartedDockerConfigurationLogos
Community
User ShowcaseStack OverflowProject ChatFollow Verdaccio on Twitter
More
BlogGitHubStar