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 🙏

© 2026 – Pkg Stats / Ryan Hefner

koishi-plugin-ci

v4.0.1

Published

ci utils for koishi

Readme

Koishi Plugin CI

程序化部署您的插件

比如:可以通过插件的参数动态构建前端

安装

npm install koishi-plugin-ci
const { App } = require('koishi')
const app = new App()

app.plugin('koishi-plugin-ci')
// ...

功能

构建

plugin-that-requires-build.js

const fs = require('fs').promises
const existsSync = require('fs').existsSync

module.exports = {
  apply(ctx, opt) {
    ctx.using(['ci'], ({ ci }) => {
      ci.build.use(() => {
        const buildPath = path.resolve(path.join(__dirname, '.build'))
        if (existsSync(buildPath)) await fs.rm(buildPath, {recursive: true})
        await fs.mkdir(buildPath)
        await fs.writeFile(path.join(buildPath, "build.json"), JSON.stringify(opt.buildOpt))
        ctx.logger('ci').info('plugin-that-requiring-build: build finished')
      })
    })
  }
}

build.js

const { App } = require('koishi')
const app = new App()
app.plugin('koishi-plugin-ci')
app.plugin('plugin-that-requires-build', { buildOpt: { buildTime: new Date() }})

app.ci.build.run()
  .then(() => process.exit(0))

这样便可在 plugin-that-requires-build 插件目录下构建 .builds/build.json

{"buildTime":"2022-01-21T11:22:04.383Z"}

API

工具

KoishiCI.getPluginState(plugin)
KoishiCI.getPluginState()

返回已安装的插件或调用此函数的插件的State

KoishiCI.getStateRoot(state)

返回嵌套中最上层的State

构建相关功能

build.use(callback)
build.use(Promise<callback>)

注册构建函数

async build({only: [Plugin]})
async build({except: [Plugin]})
async build()

运行构建函数 build示例

build-only-some-plugins.js

// ...
app.ci.build.run({only: ['plugin-that-requires-build']})

只会构建 plugin-that-requires-build 插件

build-except-some-plugins.js

// ...
app.ci.build.run({except: ['plugin-that-requires-build']})

会跳过构建 plugin-that-requires-build 插件