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

gitlab-issue-status

v0.2.2

Published

get icons for gitlab issue status

Downloads

6

Readme

gitlab-issue-status

get embeddable status badges for gitlab issues 🦊 🏷

Example

Issue in state opened:

![](http://localhost:8080\?issue\=/group-milestones/something/issues/1)

Issue in state closed:

![](http://localhost:8080\?issue\=group-milestones/something/issues/2)

With added hyperlink:

[![](http://localhost:8080\?issue\=group-milestones/something/issues/2)](https://gitlab.com/group-milestones/something/issues/2)

Issue with title and larger font size: ![](http://localhost:8080/?issue=/group-milestones/issues/issues/1)

Usage

The small server coming with the package can be configured via ENV variables. Otherwise the exposed API can be used to create custom workflows.

Since node-canvas and underlying modules currently have issues with emojis they are loaded as png images into the canvas image.

API

canvas.loadIcons(iconArray)

Load an array of icons for later use in the image creation. Will return a Promise resolving to Object for use in canvas.createImage.

iconArray

Type: Array

An array of {key: 'string', path: './icon.png'} objects specifying an icon name/key and its path to load.

canvas.createImage(issue, icons)

issue

Type: Object

Representation of a GitLab issue including the keys id, title, tag, labels, state. Best to use gitlab.getIssue()

icons

Type: Object

An object listing different canvas.image elements using a specific key. Best to be created using the canvas.loadIcons() method.

gitlab.tagToUrl(issueTag, baseUrl)

Create a full URL given a GitLab issue tag project#12 and a baseUrl (e.g. gitlab.com/api/v4)

issueTag

Type: string

A short link for an issue e.g. group/project#12

baseUrl

Type: string

Full API baseUrl of the GitLab server e.g. https://gitlab.com/api/v4

gitlab.UrlToTag(issueUrl)

Convert a full issue URL to a short tag like project#12

issueUrl

Type: string

Full issue URl e.g. https://gitlab.com/api/v4/projects/myproject/issues/12

gitlab.getIssueStatus(issueUrl, apiToken)

Fetch isue status from GitLab server.

issueUrl

Type: string

Full issue URL e.g. https://gitlab.com/api/v4/projects/myproject/issues/12

apiToken

Type: string

Valid API Token for the GitLab instance referred to in issueUrl

Server

The package comes with a default node server bundled that can be started using

const gitlabIssues = require('gitlab-issue-status')
gitlabIssues.app(options) // start the server

Where options is an Object containing any of the following settings:

{
  iconArray: [{key: 'opened', path: 'full/path/to/png/resource/with/16by16.png'}], // an array containing icon resources and the key = issue state
  baseUrl: 'https://gitlab.com/api/v4', // base URL of the gitlab server API
  token: 'myPersonalAccessToken', // gitlab token with API rights for above server
  port: 8080, // the port to start the server on
  fontsize: 14, // font size of the first element (title if active, otherwise tag)
  showTitle: true // show title of the issue as well as issue tag
}

The following environment variables take precedence over the above options object:

GITLAB_API_URL: overwrites options.baseUrl
GITLAB_ACCESS_KEY: overwrites options.token
PORT

Include in markdown

Having the server deployed with a GITLAB_ACCESS_KEY and GITLAB_API_URL defined issue badges can be used in markdown with

[![asdf](http://localhost:8080\?issue\=/group/project/issues/5)](http://gitlab-url.com/group/project/issues/5)

Cache policy

By default the images have a cache age of 30 seconds which should keep load off the server but still offer near realtime updates of issue states.

License

Licensed under MIT by Andreas Offenhaeuser