0.4.1 • Published 2 years ago

lit-issue-reporter v0.4.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

lit-issue-reporter

main branch parameter Downloads Version License Vercel deployment

This library allows anyone to submit issues directly from a web application.
It is made of web-component (lit), provided as an ES module, and can be used in various FWs and designs.

Vanilla JS, React, Vue, Svelte ...

DEMO

https://user-images.githubusercontent.com/3760515/183294974-fb73c893-357e-42c2-9b0c-f4e7f24e51b1.mp4

🤔 Why is this needed?

During application development, when reporting a problem, it may not be easy for a non-engineer to intuitively imagine the information needed for verification.

This library, in addition to GitHub's Issue Template feature, automatically supplements the user's environment information to aid reproducibility.

✨ Features

  • 📝 Provide a form for the web application to submit a form (using GitHub API v4)
  • 🗂️ Issue Templates configured in the repository can be used
  • 🔦 Automatically adds information such as location, browser, OS, screen size, and monitor resolution
  • 🌏 All text in the form UI can be replaced with arbitrary text
  • 📸 Additional screenshot data can be added (available but in development)

📦 Install

yarn add lit-issue-reporter

🐣 Usage

Prepare

You must first issue a personal access token (PAT) with access permission to any repository from settings/tokens.

  • Please be careful when handling it, as it requires a repo scope!
  • It is recommended that PAT not be pushed to the remote side. for example, manage it in the .env variable and then ignore the build file.
    Also, be sure to use it in a restricted environment, as it will be embedded in your application.

Setup

if (process.env.NODE_ENV !== 'production') {
  import('lit-issue-reporter').then(({ createReporter }) => {
    createReporter({
      token: process.env.GITHUB_TOKEN,
      owner: '<GITHUB_USER_NAME>',
      repository: '<GITHUB_REPOSITORY_NAME>',
    })
  })
}

Then add to any position.

...
<issue-reporter></issue-reporter>
</body>

Finally, add a style.

@import 'lit-issue-reporter/dist/style.css';

Options

keytypedefaultdescription
lang'ja' \| 'en''ja'i18n by lit-translate
stringsLoader(lang) => Promise<Strings>(lang) => import(./locales/${lang}.json)Can be replaced by specifying any loader
noticeDurationnumber4000Notification time to open issues
insertFrombooleantrueThe following text will be inserted at the end of the body. Sent by lit-issue-repoter

License

lit-issue-reporter is available under the MIT License.