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

@whitekite/after-build

v0.3.2

Published

提供自动部署,代码压缩,代码备份功能

Readme

@whitekite/after-build

提供自动部署,代码压缩,代码备份功能

使用

import { createAfterBuild } from '@whitekite/after-build'

createAfterBuild({
  // 可选,可用于配置不同环境的不同部署服务器,
  // 默认:production
  mode: 'build-test',
  // 可选,借助 dotenv为配置文件提供环境变量
  env: process.env,
  // 开启本工具任何功能时,该选项都为必填
  outputPath: '/User/outputPath',
  // 可选 ,详见 AfterBuildFullConfig
  // 在未使用配置文件的情况下,提供默认设置
  config: {},
})

配置文件

  • 设置默认使用 afterBuild.config.[ext]
  • 可根据 设置的不同 mode 使用 afterBuild.[mode].[ext]

配置文件示例

// afterBuild.config.ts afterBuild.config.local.ts
import { defineConfig } from '@whitekite/after-build'

export default defineConfig({
  compress: 'gzip',
  /**
   * 打包文件备份功能,传递任意字符串开启该功能
   * 传递的字符串作为备份文件的前缀
   * 支持 Mustache 风格的参数解析
   * 支持的参数 {{name}} package.json 的name
   * 支持的参数 {{version}} package.json 的version
   * 支持的参数 {{mode}} 打包的模式
   * 支持的参数 {{time}} 打包时的时间
   * 示例(这也是传递true时的默认值):
   * {{name}}-{{mode}}-{{time}}
   */
  backup: 'folder-name-{{name}}-{{mode}}-{{time}}',
  publish: {
    enable: true,
    host: 'http://XXXX.XXXX.XXX',
    port: 30,
    user: 'root',
    password: 'pass',
    path: '/user/local/folder',
    /**
     * 代码压缩后上传至代码服务器
     * 用于应对大型项目文件数量多导致拖慢上传速度的问题
     * 该功能处于实验阶段,暂只支持linux服务器
     */
    zipUpload: true,
  },
})

export default defineConfig((env) => ({
  compress: 'gzip',
  /**
   * 打包文件备份功能,传递任意字符串开启该功能
   * 传递的字符串作为备份文件的前缀
   * 支持 Mustache 风格的参数解析
   * 支持的参数 {{name}} package.json 的name
   * 支持的参数 {{version}} package.json 的version
   * 支持的参数 {{mode}} 打包的模式
   * 支持的参数 {{time}} 打包时的时间
   * 示例(这也是传递true时的默认值):
   * {{name}}-{{mode}}-{{time}}
   */
  backup: 'folder-name-{{name}}-{{mode}}-{{time}}',
  publish: {
    enable: env.VITE_AUTO_PUBLISH,
    host: 'http://XXXX.XXXX.XXX',
    port: 30,
    user: 'root',
    password: 'pass',
    path: '/user/local/folder',
    /**
     * 代码压缩后上传至代码服务器
     * 用于应对大型项目文件数量多导致拖慢上传速度的问题
     * 该功能处于实验阶段,暂只支持linux服务器
     */
    zipUpload: true,
  },
}))

推送回滚

package.json

示例备份文件名称 projectName-test-20228022.zip

{
  "scripts": {
    "cli:rollback": "whitekite-after-build rollback --mode build-test --version projectName-test-20228022"
  }
}

命令行执行

package.json

{
  "scripts": {
    "cli:afterBuild": "whitekite-after-build run --mode build-test --compress.gzip --compress.br --backup {{name}}@{{version}} --outputPath /file-path"
  }
}