npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

semantic-release-telegram

v1.6.2

Published

semantic-release plugin. Provides notifications to Telegram chats

Downloads

1,737

Readme

Logo

semantic-release-telegram

semantic-release plugin. Provides notifications to Telegram chats.

Version Bundle size Downloads

CodeFactor SonarCloud Codacy Scrutinizer

Dependencies Security Build Status Coverage Status

Commit activity FOSSA License Made in Ukraine

🇺🇦 Help Ukraine

I woke up on my 26th birthday at 5 am from the blows of russian missiles. They attacked the city of Kyiv, where I live, as well as the cities in which my family and friends live. Now my country is a war zone.

We fight for democratic values, freedom, for our future! Once again Ukrainians have to stand against evil, terror, against genocide. The outcome of this war will determine what path human history is taking from now on.

💛💙 Help Ukraine! We need your support! There are dozen ways to help us, just do it!

Table of Contents

Requirements

Platform Status

To use library you need to have node and npm installed in your machine:

  • node >=10
  • npm >=6

Package is continuously tested on darwin, linux and win32 platforms. All active and maintenance LTS node releases are supported.

Installation

To install the library run the following command

  npm i --save semantic-release-telegram

Usage

The plugin can be configured in the semantic-release configuration file:

{
  "plugins": [
    "@semantic-release/commit-analyzer",
    "@semantic-release/release-notes-generator",
    [ "semantic-release-telegram", {
      "chats": [ 123456789, -987654321 ]
    } ]
  ]
}

This is a minimal usage sample with a default configuration. Next messages will be sent:

Usage Sample

Configuration

if needed, the configuration can be extended:

{
  "plugins": [
    "@semantic-release/commit-analyzer",
    "@semantic-release/release-notes-generator",
    ["semantic-release-telegram", {
      "name": "funny-app",
      "chats": [ 123456789 ],
      "templates": {
        "fail"    : "An error occured while trying to publish the new version of <b>{name}</b>.\n<pre><code class='language-javascript'>{error}</code></pre>",
        "success" : "A new version of <a href='{repository_url}'>{name}</a> has been released. Current version is <b>{version}</b>"
      }

    }]
  ]
}

Config attribute description:

| Option | Required | Type | Description | Default | |----|---|---|------------------------------------|------------------------------------| | name | no | string | Application name. | name from package.json | | chats | yes | array | List of chats for sending. The bot should have access to each chat. | | | templates.success | no | string | HTML template, send in case of success. | SUCCESS.html | | templates.fail | no | string | HTML template, send in case of fail. | FAIL.html | | assets | no | array | List of files to upload. See Assets | [] | | telegra.ph | no | object | Publish and attach Telegraph story | null |

Template variables:

| key | Templates | Description | Example | |----|---|-----------------------|--------| | repository_url | success, fail | The git repository URL. By default repository property in package.json or git origin url | https://github.com/pustovitDmytro/semantic-release-telegram | name | success, fail | application name | funny-app | version | success | new version | 1.0.0 | release_notes | success | generated notes | | release_type | success | | minor | commit | success | commit hash | 13b16914f2893fa09e9a39f1dcda78af1fff0dbd | branch | success, fail | | master | error | fail | thrown error | SemanticReleaseError: Cannot push to the Git repository

Authentication

To use this package, you need to register a new telegram bot. Then pass the next environment variables:

  TELEGRAM_BOT_ID=123456 
  TELEGRAM_BOT_TOKEN=ABC-DEF1234ghIkl-zyx57W2v1u123ew11

Assets

Can be glob or relative file path. name specifies file label in telegram. In the case of glob pattern, all files are uploaded in a single archive, name is required.

Example:

  "assets" : [
        { "path": "README.md" },
        { "glob": [ ".docs/*" ], "name": "Documentation.zip" }
    ]

Assets will be attached to release message as separate files.

Telegraph

Upload bulky markdowns, as telegra.ph stories. Use next api for this:

  "telegra.ph"  : {
    "title"   : "{name} v.{version}",
    "message" : "<a href='{telegraph_url}'>Release Notes</a>",
    "content" : "{release_notes}"
}

title and content represent story content.

message is a telegram message, sent to telegram chats (It is reasonable to include {telegraph_url} here). Success template is extended with new variables {telegraph_url} and {telegraph_title} when telegra.ph is used.

Contribute

Make the changes to the code and tests. Then commit to your branch. Be sure to follow the commit message conventions. Read Contributing Guidelines for details.