0.1.5 • Published 8 days ago

unplugin-build-notifier v0.1.5

Weekly downloads
-
License
MIT
Repository
github
Last release
8 days ago

unplugin-build-notifier

NPM version

English | 中文

系统通知构建结果,自动打开项目根目录。

特点
  • 💚 高优先级的系统通知,由 node-notifier 提供支持
  • ✨ 自动获取项目名称
  • 📂 自动打开文件资源管理器
  • 🔧 可配置的消息和点击行为
  • 🚀 获取构建时间
  • ⚡️ 支持 Vite、Webpack、Rspack、Vue CLI、Rollup、esbuild 等,由 unplugin 提供支持
  • 🦾 完全支持 TypeScript

安装

npm i unplugin-build-notifier -D
yarn add unplugin-build-notifier -D
pnpm add unplugin-build-notifier -D

使用示例

// vite.config.ts
import BuildNotifier from 'unplugin-build-notifier/vite'

export default defineConfig({
  plugins: [
    BuildNotifier({ /* options */ }),
  ],
})

Example: playground/

// rollup.config.js
import BuildNotifier from 'unplugin-build-notifier/rollup'

export default {
  plugins: [
    BuildNotifier({ /* options */ }),
  ],
}

// webpack.config.js
module.exports = {
  /* ... */
  plugins: [
    require('unplugin-build-notifier/webpack')({ /* options */ })
  ]
}

// nuxt.config.js
export default defineNuxtConfig({
  modules: [
    ['unplugin-build-notifier/nuxt', { /* options */ }],
  ],
})

This module works for both Nuxt 2 and Nuxt Vite

// vue.config.js
module.exports = {
  configureWebpack: {
    plugins: [
      require('unplugin-build-notifier/webpack')({ /* options */ }),
    ],
  },
}

// esbuild.config.js
import { build } from 'esbuild'
import BuildNotifier from 'unplugin-build-notifier/esbuild'

build({
  plugins: [BuildNotifier()],
})

Options

/**
 * 插件配置项。
 */
interface Options {
  /**
   * 在构建通知器中显示的消息。
   */
  message?: string

  /**
   * 在构建通知器中显示的图标的路径。
   */
  iconPath?: string

  /**
   * 当构建通知器被点击时执行的回调函数。
   */
  click?: () => void

  /**
   * 当构建通知器超时时执行的回调函数。
   */
  timeout?: () => void
}
0.1.5

8 days ago

0.1.4

16 days ago

0.1.3

21 days ago

0.1.2

25 days ago

0.1.1

27 days ago

0.1.0

27 days ago