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-reporter

v0.2.0

Published

A lib that generates issue reports for unexcepted errors.

Downloads

7,116

Readme

A lib that generates issue reports for unexcepted errors.

🏠 Homepage

Prerequisites

  • npm >=5.5.0
  • node >=10.0.0

Install

yarn add issue-reporter

Usage

const issueReporter = require('issue-reporter')

async function main() {
  try {
    throw new Error('Some unexcepted error')
  } catch (e) {
    await issueReporter({
      error: e,
      user: 'frinyvonnick',
      repo: 'issue-reporter',
    })
  }
}

Output

issue-reporter's output depends on your environment:

If you terminal supports Hyperlinks it will print a friendly error message with a clickable link that opens a form to create a new issue with a prefilled error report on your project.

If your terminal doesn't support Hyperlinks, issue-reporter will copy the error report in your clipboard and print an url that opens a new issue on your project so you can directly paste the report on the issue template.

In case of a CI it will print an url that opens a new issue on your project followed by a full report error in markdown you can copy paste in the issue body.

Options

| option | description | type | required | |-------------------------|-------------------------------------------------------------------------------------------------|----------------------------|-------------| | error | An Error instance | Error | required | | user | You GitHub handle | string | required | | repo | The repository name of your project | string | required | | envinfo | A configuration object that is passed down to envinfo | Object | optional | | sections | Custom sections to add in the error report | Array | optional | | formatReport | A function that allows to write your own error report template | function | optional |

Advanced examples

With sections

issue-reporter takes an extra option called sections that let you add information specific to your project. You can add as many sections as you want.

const issueReporter = require('issue-reporter')

async function main() {
  try {
    throw new Error('Some unexcepted error')
  } catch (e) {
    await issueReporter({
      error: e,
      user: 'frinyvonnick',
      repo: 'issue-reporter',
      sections: [
        {
          title: "My project specific information",
          content: {
            version: "1.0.1",
            release: "2.0.0",
            commit: "qwej79qwjeqw8euqo8wj8eq8"
          }
        }
      ]
    })
  }
}

With custom formatter

issue-reporter has a default markdown formatter. If you want a more flexible way to format your error reporter you can provide your own formatting function.

const issueReporter = require('issue-reporter')

async function main() {
  try {
    throw new Error('Some unexcepted error')
  } catch (e) {
    await issueReporter({
      error: e,
      user: 'frinyvonnick',
      repo: 'issue-reporter',
      formatReport: (errorReport) => {
        return `## ${errorReport.error.title}
        
        ${errorReport.error.stack}
        
        ## ${errorReport.environment.title}
        
        ${errorReport.environment.markdown}
        `
      },
    })
  }
}

Run tests

yarn run test

Author

👤 Yvonnick FRIN

👤 Franck ABGRALL

🤝 Contributing

Contributions, issues and feature requests are welcome!Feel free to check issues page.

Show your support

Give a ⭐️ if this project helped you!

📝 License

Copyright © 2019 Yvonnick FRIN. This project is Apache--2.0 licensed.


This README was generated with ❤️ by readme-md-generator