https://github.com/bjmhe/unplugin-jdoss
A build plugin based on unplugin that automatically uploads files to JD OSS after build completion.
https://github.com/bjmhe/unplugin-jdoss
jd oss unplugin
Last synced: 10 days ago
JSON representation
A build plugin based on unplugin that automatically uploads files to JD OSS after build completion.
- Host: GitHub
- URL: https://github.com/bjmhe/unplugin-jdoss
- Owner: bjmhe
- License: mit
- Created: 2026-05-20T12:19:59.000Z (23 days ago)
- Default Branch: main
- Last Pushed: 2026-05-23T14:19:37.000Z (20 days ago)
- Last Synced: 2026-05-26T18:17:56.611Z (17 days ago)
- Topics: jd, oss, unplugin
- Language: TypeScript
- Homepage:
- Size: 375 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Security: SECURITY.md
Awesome Lists containing this project
README
# unplugin-jdoss
[![npm version][npm-version-src]][npm-version-href]
[![npm downloads][npm-downloads-src]][npm-downloads-href]
A build plugin based on [unplugin](https://github.com/unjs/unplugin) that automatically uploads files to JD OSS after build completion.
It supports multiple build tools, including Vite, Webpack, Rspack, Rollup, Rolldown, esbuild and Farm. The plugin integrates `@jd/upload-oss-tools` and automatically performs uploads in the `writeBundle` hook, eliminating the need for manual deployment of static assets.
## Install
```bash
npm i -D -E unplugin-jdoss
```
## Features
- **Automatic OSS Upload** - Automatically uploads build artifacts to JD OSS after build completion via the `writeBundle` hook
- **Multi-Builder Support** - Works seamlessly with Vite, Webpack, Rspack, Rollup, Rolldown, esbuild, and Farm
- **Zero Configuration** - Integrates with `@jd/upload-oss-tools` out of the box, no manual deployment needed
- **Build Tool Agnostic** - Built on [unplugin](https://github.com/unjs/unplugin) for universal compatibility across modern build tools
- **Static Asset Deployment** - Eliminates the need for manual static asset deployment workflows
## Usage
```typescript
/// vite.config.ts
import path from 'node:path'
import VitePluginJdoss from 'unplugin-jdoss/vite'
import { defineConfig, loadEnv, searchForWorkspaceRoot } from 'vite'
export default defineConfig(({ mode }) => {
const workspaceRoot = searchForWorkspaceRoot(process.cwd())
const env = loadEnv(mode, workspaceRoot)
return {
base: env.VITE_BASE_URL,
plugins: [
mode === 'production' &&
VitePluginJdoss({
localFullPath: path.resolve(workspaceRoot, 'dist'),
access: env.VITE_OSS_ACCESS,
secret: env.VITE_OSS_SECRET,
site: 'storage.jd.local',
cover: true,
timeout: '30000',
printCdnFile: false,
bucket: env.VITE_OSS_BUCKET,
folder: env.VITE_OSS_FOLDER,
ignoreRegexp: '',
}),
],
}
})
```
## Ecology
- [x] Rollup
- [x] Vite
- [x] Webpack
- [x] Esbuild
- [x] Rspack
- [x] Farm
- [x] Rolldown
- [x] Bun
## License
[MIT](./LICENSE) License © 2026-PRESENT [Benjamin He](https://github.com/bjmhe)
[npm-version-src]: https://img.shields.io/npm/v/unplugin-jdoss.svg
[npm-version-href]: https://npmjs.com/package/unplugin-jdoss
[npm-downloads-src]: https://img.shields.io/npm/dm/unplugin-jdoss
[npm-downloads-href]: https://www.npmcharts.com/compare/unplugin-jdoss?interval=30