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

issue-maker

v1.0.1

Published

No, this will not be an issue maker. Promise.

Downloads

1

Readme

issue-maker

No, this will not be an issue maker. Promise.

npm Travis styled with prettier Built with generator-ts-np npm

inbox

What

Helps you to report issues to issue trackers like github or gitlab. Currently gitlab is the only supported service. You can improve this package to add multiple services like github/trello/jira etc.

Install

npm i --save issue-maker

You don't have to install type definitions for typescript. It's built in.

How it works

At present only gitlab is supported. This package access gitlab apis(v4) behind the scenes.

The real use comes when used with express

Normal Usage

import { IssueMaker } from 'issue-maker';
// or
const { IssueMaker } = require('issue-maker');

create an issue maker

const gitlab = new IssueMaker({
  service: 'gitlab', // only this service is supported now
  endPoint: 'https://gitlab.com_or_your_custom', // note: no defaults set. you've to provide this
  privateToken: 'XXXX', // can be created from profile/settings page
  projectId: 888, // gotten from project settings page
});

report a simple issue like

gitlab.reportIssue({
  title: '(required) this will be issue title',
  description: '(optional) markdown **supported issue description**',
  /**
   * labels: coma separated string OR array of labels.
   * all labels should be pre-created in the service. else fails.
   * (optional)
   **/
  labels: 'by-issue-maker',
  assignee_ids: [454], // optional
  milestone_id: 56, // optional
})
  .then(()=>console.log('issue-reported'))
  .catch(err=>console.log('err occurred', err));

For applications running in express

cat

Issue maker leverages its full superpower when used with express.

Features

  • Easily create an issue
  • Issue-maker comments on the same issue if the issue happens again. Will not create a new issue.
  • If a closed issue is again occurred, issue-maker reopen the issue and comments on it.

How

You need a common error format for this to work. Import that error class

import {
  IssueMaker, // the original class
  ExpressRequestError, // error class. all errors will be of this format.
  ExpressRequestErrorType, // select the type of error you have to throw
} from 'issue-maker';

below is a sample route in which you throw an error in express.

app.get('/send/cats/to/me/with/500', (req, res, next) =>
  next(
    new ExpressRequestError( // use the err class
      ExpressRequestErrorType.INTERNAL_SERVER_ERROR, // choose err type
      new Error('testing 500 with cats api'), // put err details. (type:any)
    ),
  ),
);

your common err handler looks like: (here is where you call the issue-maker)

// in the end
app.use(requestErrHandler);

function requestErrHandler(err, req, res, next){
  if (err.statusCode >= 500 && err instanceof ExpressRequestError) {
    gitlabIssue.expressReportError(req, err, {
      labels: 'by-issue-maker', // label already created
      resLocals: res.locals, // for showing in issue description.
      databaseHost: '<host>', // for showing in issue description.
      databaseName: '<name>', // for showing in issue description.
    })
      .then(()=>console.log('issue reported'))
      .catch(err=>console.log('oh no, err', err))
  }
  /**
   * rest of the code..
   * handle err or
   * res.status(err.statusCode).send({msg:'oops'})
   **/ 
}

Version of ts-np-generator used: used version of ts-np generator

Licence

MIT © Vajahath Ahmed