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

@lx-frontend/report

v0.4.1

Published

Sentry excepiton report.

Downloads

22

Readme

@lx-frontend/report

开发

1. 安装依赖

npm run bootstrap

2. 构建

npm run build

3. 发布

npm run publish

使用

1. 安装

npm install --save @lx-frontend/report

2. 初始化

使用:

import { init } from '@lx-frontend/report'

init({
  enable: process.env.RUN_ENV === 'production',
  platform: 'mp',
  dsn: 'https://[email protected]/20',
  release: '',
  environment: process.env.RUN_ENV
})

参数说明:

  • enable (boolean):是否开启 sentry 上报
  • platform (string):运行平台,传入 mp 或者 web,目前只支持 mp
  • dsn (string):sentry 密钥
  • release (string):项目版本
  • environment (string):运行环境

3. 上报 http 异常

使用:

import { reportHttpException,  } from '@lx-frontend/report'

const { config, data, header, statusCode } = res

const request = {
  url: config.url,
  method: config.method,
  header: config.header,
  body: config.body,
  timeout: config.timeout,
  custom: config.custom
}

const response = {
  status: statusCode,
  header,
  data
}

const tags = {
  user_id: 99
}

const extra = {
  test: 'hello'
}

reportHttpException({
  request,
  response,
  tags,
  extra
})

参数说明:

  • request (object)
    • url (string):请求链接
    • method (string):请求方法
    • header (object):请求头部
    • body (any):请求参数
    • timeout (number):请求超时时间(可选)
    • custom (object):自定义请求配置(可选)
  • response (object)
    • status (number):响应状态码
    • header (object):响应头部
    • data (any):响应数据
  • tags (object):自定义标签(可选)
  • extra (any):额外携带数据(可选)

4. 上报业务异常

使用:

import { reportBusinessException } from '@lx-frontend/report'

const extra = {
  test: 'hello'
}

reportBusinessException('上报业务异常', extra)

参数说明:

  • 参数一 (string):异常描述
  • 参数二 (any):额外携带数据(可选)

5. 上报 socket 异常

使用:

import { reportSocketException } from '@lx-frontend/report'

const extra = {
  test: 'hello'
}

reportSocketException('上报 socket 异常', extra)

参数说明:

  • 参数一 (string):异常描述
  • 参数二 (any):额外携带数据(可选)