Skip to content

Commit

Permalink
chore: release
Browse files Browse the repository at this point in the history
  • Loading branch information
hemengke1997 committed Apr 24, 2024
1 parent ed8f0e4 commit d0794b8
Show file tree
Hide file tree
Showing 14 changed files with 72 additions and 20 deletions.
6 changes: 6 additions & 0 deletions packages/istanbul-widget/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# istanbul-widget

## 1.3.3

### Patch Changes

- fix: float type

## 1.3.2

### Patch Changes
Expand Down
44 changes: 37 additions & 7 deletions packages/istanbul-widget/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,30 @@ npm install istanbul-widget
import { IstanbulWidget } from 'istanbul-widget'

const istanbulWidget = new IstanbulWidget({
report: {
onAction: async (coverage, config) => {
console.log('上报', coverage, config)
// 在这里你可以调用上报接口
// 如果接口报错,请在此抛出错误: throw new Error("你的错误信息")
defaultPosition: {
x: 0,
y: 100,
},
plugin: {
// 上报按钮
report: {
onReport(coverage) {
console.log('上报', coverage)
// throw new Error('上报失败') // 你可以控制失败的逻辑
},
},
// 设置插件
setting: {
requireReporter: true,
},
buttonGroup: [
{
text: '自定义按钮',
onClick(...args) {
console.log(...args)
},
},
],
},
})
```
Expand All @@ -36,7 +54,6 @@ const istanbulWidget = new IstanbulWidget({
</script>
```


## 配置项

```ts
Expand All @@ -53,10 +70,11 @@ interface IstanbulWidgetOptions {
target?: string | HTMLElement
/**
* 按钮悬浮
* @description false 则关闭悬浮
*/
float?: {
offsetX?: number
}
} | false
/**
* 按钮默认位置
* @default
Expand Down Expand Up @@ -103,3 +121,15 @@ interface IstanbulWidgetOptions {
pluginOrder?: (PluginName | string)[]
}
```


## 截图

### 入口按钮
![入口](./screenshots/entry.png)

### 深色主题
![深色主题](./screenshots/dark.png)

### 浅色主题
![浅色主题](./screenshots/light.png)
2 changes: 1 addition & 1 deletion packages/istanbul-widget/dev.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ myPlugin.event.on('init', () => {

const istanbulWidget = new IstanbulWidget({
defaultPosition: {
x: -100,
x: 0,
y: 100,
},
plugin: {
Expand Down
5 changes: 2 additions & 3 deletions packages/istanbul-widget/package.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
{
"name": "istanbul-widget",
"version": "1.3.2",
"version": "1.3.3",
"type": "module",
"files": [
"**"
],
"main": "./dist/istanbul-widget.min.js",
"main": "./dist/istanbul-widget.esm.js",
"module": "./dist/es/istanbul-widget.js",
"types": "./dist/istanbul-widget.d.ts",
"exports": {
"./package.json": "./package.json",
".": {
"types": "./dist/istanbul-widget.d.ts",
"require": "./dist/istanbul-widget.min.js",
"import": "./dist/es/istanbul-widget.js"
},
"./components": {
Expand Down
Binary file added packages/istanbul-widget/screenshots/dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added packages/istanbul-widget/screenshots/entry.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added packages/istanbul-widget/screenshots/light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 12 additions & 3 deletions packages/istanbul-widget/src/core/options.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,17 @@ export interface IstanbulWidgetOptions {
target?: string | HTMLElement
/**
* 按钮悬浮
* @description false 则关闭悬浮
* @default
* ```js
* { offsetX: 8 }
* ```
*/
float?: {
offsetX?: number
}
float?:
| {
offsetX?: number
}
| false
/**
* 按钮默认位置
* @default
Expand All @@ -36,6 +43,8 @@ export interface IstanbulWidgetOptions {

/**
* 默认开启的插件
* @default
* ['setting', 'buttonGroup']
*/
defaultPlugins?: ('setting' | 'buttonGroup')[]

Expand Down
7 changes: 7 additions & 0 deletions packages/vite-plugin-istanbul-widget/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# vite-plugin-istanbul-widget

## 1.3.3

### Patch Changes

- Updated dependencies
- istanbul-widget@1.3.3

## 1.3.2

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/vite-plugin-istanbul-widget/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vite-plugin-istanbul-widget",
"version": "1.3.2",
"version": "1.3.3",
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
Expand Down
5 changes: 2 additions & 3 deletions playground/react-app/report.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
async function report(coverage: any, ...args: any[]) {
async function report(coverage: any) {
const reponame = 'react-app'
console.log(args, 'args')
await fetch(`http://localhost:3000/${reponame}/coverage/client?v=temp_git_commit_id`, {
await fetch(`http://localhost:3000/${reponame}/coverage/client?v=${__GIT_COMMIT_ID__}`, {
body: JSON.stringify(coverage),
method: 'POST',
headers: {
Expand Down
1 change: 0 additions & 1 deletion playground/react-app/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ export default defineConfig((env) => ({
autoReport: false,
onLeavePage: true,
requireReporter: true,
text: '!设置文案!',
},
buttonGroup: [
{
Expand Down
2 changes: 1 addition & 1 deletion playground/vue-app/report.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
async function report(coverage: any) {
const reponame = 'vue-app'
fetch(`http://localhost:3000/${reponame}/coverage/client`, {
await fetch(`http://localhost:3000/${reponame}/coverage/client?v=${__GIT_COMMIT_ID__}`, {
body: JSON.stringify(coverage),
method: 'POST',
headers: {
Expand Down
3 changes: 3 additions & 0 deletions playground/vue-app/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
"extends": "@minko-fe/tsconfig/tsconfig.app.json",
"compilerOptions": {
"types": ["vite-plugin-istanbul-widget/client"]
},
"exclude": ["dist"]
}

0 comments on commit d0794b8

Please sign in to comment.