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

boog-webpack-oss

v3.0.6

Published

Webpack 构建完成后,将产物上传至阿里云 OSS,并可选清除 CDN 缓存。支持并行上传、断点续传、多 OSS 双写策略。

Downloads

198

Readme

boog-webpack-oss

Webpack 构建完成后,将产物上传至阿里云 OSS,并可选清除 CDN 缓存。支持并行上传、断点续传、多 OSS 双写策略。

安装

npm install boog-webpack-oss --save-dev

基本用法

在 webpack.config.js 中注册插件:

const BoogWebpackOss = require('boog-webpack-oss');

module.exports = {
  // ...
  plugins: [
    new BoogWebpackOss({
      // projectName: 'akx-pc-main', // 可选,默认按目录名或 package.json name 匹配
      // uploadConcurrency: 20,      // 可选,并行上传数,默认 20
    }),
  ],
};

构建完成后(afterEmit)会自动执行 OSS 上传;beforeRun 阶段会先校验 Git 状态。

断点续传

上传过程中若中断,可在同一项目目录下执行:

npx boog-upload

或:

npm run upload

续传会读取上次的上传记录,跳过已成功的文件,并再次校验 Git 状态(工作区干净、本地与远端一致)。

上传记录保存在 node_modules/boog-webpack-oss/.boogoss-upload.json,不会污染业务仓库。

本地凭证

首次上传时会交互式写入以下文件(路径为 ~/.boogoss.json、~/.boogoss-cdn.json):

| 文件 | 用途 | |------|------| | ~/.boogoss.json | OSS accessKeyId / accessKeySecret | | ~/.boogoss-cdn.json | CDN 清缓存 SECRET(prefix + 当天日期 + suffix 的 MD5) |

也可在构造插件时直接传入:

new BoogWebpackOss({
  accessKeyId: 'xxx',
  accessKeySecret: 'xxx',
  stsToken: 'xxx', // 可选
})

不同 OSS 可在 project.js 里通过 ossKeyPath 指定不同的凭证文件,例如 /.boogoss-cdn.json。

项目配置

各业务项目的上传规则定义在包内 project.js,按目录名或 package.json 的 name 匹配;也可通过 projectName 手动指定。

常见字段:

| 字段 | 说明 | |------|------| | from | 待上传文件 glob,如 ['./dist/**'] | | dist | OSS 上的目录前缀 | | bucket / region | OSS 桶与区域 | | host | 访问域名,用于 CDN 清缓存 | | framework | vue 或 weex,影响 CDN 清缓存范围 | | gitVersion | true 时用 Git 分支名作为版本目录 | | production / development | 非 gitVersion 时的正式/开发目录名 | | legacyOss | 旧 OSS 配置,用于双写迁移 | | legacyVersions | 仅走旧 OSS、不清 CDN 的版本白名单 | | dualUploadVersions | 双写(旧 OSS + 新 OSS),仅新 OSS 清 CDN |

sys-ai 双 OSS 迁移

akx-finance-system、akx-pc-main、akx-web-base-app 等 sys-ai 项目支持:

  • 旧版本(26_4_385、26_5_522、26_6_676)→ 仅旧 OSS(aikuaixiao-sys),不清 CDN
  • work / dev
    • gitVersion: true(如 akx-finance-system)→ 仅新 OSS + CDN
    • gitVersion: false(如 akx-pc-main)→ 双写旧 OSS + 新 OSS,仅新 OSS 清 CDN
  • 其他版本 → 仅新 OSS + CDN

CDN 清缓存

上传成功后,若配置了 host 且计划开启 clearCDN,会调用:

POST https://api-3s.boogcloud.com/3s/bubu/common/clearCDNCacheOpen
  • vue 项目
    • 开发环境打包(mode !== 'production')→ TYPE=Directory,清除整个上传目录
    • 生产环境打包 → TYPE=File,仅清除 index.html
  • weex 项目:清除本次上传的全部文件(TYPE=File)
  • 文件清除每批最多 100 个 URL

Git 校验

构建 / 续传前会检查:

  1. 工作区无未提交改动
  2. 已 git fetch
  3. 本地分支与 origin/<branch> 最新 commit 一致

测试分支(非 master / dev 且分支名不以数字开头)校验失败时不会阻断构建;生产模式(mode === 'production')下校验失败会退出进程。

上传行为

  • 默认 20 路并行上传
  • vue 项目:index.html 最后上传,避免入口文件过早生效
  • glob 未命中时自动补全 dist/index.html

版本

当前版本:3.0.0

主要变更:

  • 自研并行 OSS 上传,替代 webpack-aliyun-oss
  • CDN 缓存清除
  • sys-ai 双 OSS 迁移策略
  • 断点续传(npx boog-upload)