1.2.3 • Published 3 years ago

sentry-autoc-webpack-plugin v1.2.3

Weekly downloads
-
License
GPL
Repository
github
Last release
3 years ago

sentry autoc webpack plugin

基于 @sentry/webpack-plugin 改造, 适用于 vue 项目 sentry 监控集成.

前置依赖

  1. vue 2.x, 3.x 等待官方插件支持

Usage

install

  1. 执行 yarn add sentry-autoc-webpack-plugin --dev 安装插件
  2. 注: 如果是非 vue 2.x 项目, 需要额外安装 yarn add @sentry/browser. 注意: 此时将没有针对框架特性的支持.
const { SentryAutocWebpackPlugin } = require('sentry-autoc-webpack-plugin')

// 通过 configureWebpack 配置
module.exports = {
    configureWebpack: {
        plugins: [
           new SentryAutocWebpackPlugin(),
           // other plugins ...
        ]
    }
}

// or 通过 chainWebpack 配置

module.exports = {
   chainWebpack: (config) => {
      // add plugin
      config
         .plugin('SentryAutocPlugin')
         .use(new SentryAutocWebpackPlugin({ /* options ... */ }))
   }
}
  1. configure:
    1. 创建配置文件, 配置内容如下.
      1. 根目录下创建 ./sentryclirc.js, 参数文档参考: 说明书
      2. 官方配置文档: docs
      3. 配置模板
[auth]
## sentry用户 auth token.
token=
## project dsn -  可在项目设置或创建项目时查看.
dsn=
[defaults]
## sentry 服务地址, 如: https://sentry.io
url=
## 注意是用户的org
org=
## project name
project=
[log]
# 日志等级, 一般不管
level=info

命令行参数

  1. (1.2.1 新增) 执行编译命令时, 如果命令行增加参数 --tag=[git tag], 则直接采用 git tag 名称作为 sentry 版本号, 且不再提交备份的 git tag.

杂项

插件构造函数参数

/** sentry-autoc 配置 */
export interface SentryAutocPluginOptions {
    /** 主动禁用sentry插件 */
    disable?: boolean
    /** 禁用 git tag 备份 */
    disableGitTagBackup?: boolean

    /** sentry cli 配置 */

    /** sentry 项目dsn内容, 必填 */
    dsn: string
    /** sentry 要提交哪些文件, 默认值: './dist'  */
    include?: string | Array<string>

    /** 手工指定版本号 */
    release?: string
    /** sentry 服务地址 */
    url?: string
    /** sentry user auth token */
    authToken?: string
    /** user Organization slug */
    org?: string
    /** sentry project name */
    project?: string
    /** VCS remote name, 作用位置 */
    vcsRemote?: string

    /**
     * Determines whether processed release should be automatically finalized after artifacts upload.
     * Defaults to `true`.
     */
    finalize?: boolean

    /** 手工指定 @sentry/cli 配置文件.
     *
     * @doc https://docs.sentry.io/learn/cli/configuration/#properties-files.
     */
    configFilePath?: string
}

release 生成规则

  1. 当指定命令行参数 --tag=[tag name]时, 直接采用 tag 参数作为 sentry.release 版本号. 且不再提交备份 tag.
  2. 当未指定 --tag 参数,
    1. 存在 git repo 时, 生成 sentry_[month][day][index], 例: sentry_033001. 并推送同名 tag
    2. 不存在 git repo 时, 使用 package.json 中的 version 字段作为版本号. (此时版本号不会自动更新)

版本日志

起步版本, 1.1.0 以上版本忽略.

v1.2.1

  1. 更新 sentry.release 生成规则. 引入命令行参数 --tag

v1.1.2

  1. 重写 @sentry/webpack-plugin, 简化不常用的配置项.
  2. 增加 release 字段自动生成. 但最好使用 git tag 来作为版本标记.
  3. 增加 自定义 git tag 备份.
  4. 主动注入 sentry runtime code, 但是要注意, 这个版本并未做去重处理. 请移除手工引入的 sentry.
1.2.3

3 years ago

1.2.2

3 years ago

1.1.6

3 years ago

1.1.5

3 years ago

1.1.4

3 years ago

1.1.3

3 years ago

1.2.1

3 years ago

1.1.1

3 years ago

1.0.2

3 years ago

1.1.0

3 years ago

1.1.2

3 years ago

1.0.3

3 years ago

1.0.1

3 years ago