Skip to content

Commit 4189bd3

Browse files
committed
refactor: unplugin-alize
1 parent 543c5a6 commit 4189bd3

File tree

16 files changed

+477
-684
lines changed

16 files changed

+477
-684
lines changed

README.md

Lines changed: 184 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,11 @@
1-
<h1 align="center">🧑‍🚀 hfup</h1>
1+
# 🧑‍🚀 hfup
22

3-
<p align="center">
4-
A collection of tools to help you deploy, bundle HuggingFace Spaces and related assets with ease.
5-
</p>
3+
[![npm version][npm-version-src]][npm-version-href]
4+
[![npm downloads][npm-downloads-src]][npm-downloads-href]
65

7-
> Where `hfup` stands for HuggingFace up, and the word `up` was inspired from `rollup`, `tsup`, you may think it means "to make your HuggingFace work up and running".
8-
9-
## Features
6+
A collection of tools to help you deploy, bundle HuggingFace Spaces and related assets with ease.
107

11-
- Still manually writing HuggingFace Spaces configurations?
12-
- Having trouble to quickly handle and edit the `.gitattributes` file for Git LFS?
13-
- Don't want any of the HuggingFace Spaces front-matter appear in `README.md`?
14-
- Fighting against annoying errors when deploying your HuggingFace Spaces?
15-
16-
`hfup` is here to help you!
17-
18-
- 🚀 Automatically...
19-
- generate `.gitattributes` file for Git LFS.
20-
- generate HuggingFace Spaces front-matter in `README.md`.
21-
- search for your `README.md` file and merge the front-matter header.
22-
- generate a dedicated `README.md` file right inside the `outDir` of build.
23-
- 🔐 Intellisense ready, type safe for Spaces configurations.
24-
- 📦 Out of the box support for Vite.
8+
> Where `hfup` stands for HuggingFace up, and the word `up` was inspired from `rollup`, `tsup`, you may think it means "to make your HuggingFace work up and running".
259
2610
## Installation
2711

@@ -34,11 +18,13 @@ yarn i hfup -D
3418
npm i hfup -D
3519
```
3620

37-
## Usage
21+
<details>
22+
<summary>Vite</summary><br/>
3823

3924
```ts
40-
import { LFS, SpaceCard } from 'hfup/vite'
25+
// vite.config.ts
4126
import { defineConfig } from 'vite'
27+
import { LFS, SpaceCard } from 'hfup/vite'
4228

4329
export default defineConfig({
4430
plugins: [
@@ -59,6 +45,172 @@ export default defineConfig({
5945
})
6046
```
6147

48+
<br/></details>
49+
50+
<details>
51+
<summary>Rollup</summary><br/>
52+
53+
```js
54+
// rollup.config.js
55+
import { LFS, SpaceCard } from 'hfup/rollup';
56+
57+
export default {
58+
plugins: [
59+
LFS(),
60+
SpaceCard({
61+
title: 'Real-time Whisper WebGPU (Vue)',
62+
emoji: '🎤',
63+
colorFrom: 'gray',
64+
colorTo: 'green',
65+
sdk: 'static',
66+
pinned: false,
67+
license: 'mit',
68+
models: ['onnx-community/whisper-base'],
69+
short_description: 'Yet another Real-time Whisper with WebGPU, written in Vue',
70+
thumbnail: 'https://raw.githubusercontent.com/moeru-ai/airi/refs/heads/main/packages/whisper-webgpu/public/banner.png'
71+
}),
72+
],
73+
};
74+
```
75+
76+
<br/></details>
77+
78+
<details>
79+
<summary>Webpack</summary><br/>
80+
81+
```js
82+
// webpack.config.js
83+
const { LFS, SpaceCard } = require("hfup/webpack");
84+
85+
module.exports = {
86+
/* ... */
87+
plugins: [
88+
LFS(),
89+
SpaceCard({
90+
title: 'Real-time Whisper WebGPU (Vue)',
91+
emoji: '🎤',
92+
colorFrom: 'gray',
93+
colorTo: 'green',
94+
sdk: 'static',
95+
pinned: false,
96+
license: 'mit',
97+
models: ['onnx-community/whisper-base'],
98+
short_description: 'Yet another Real-time Whisper with WebGPU, written in Vue',
99+
thumbnail: 'https://raw.githubusercontent.com/moeru-ai/airi/refs/heads/main/packages/whisper-webgpu/public/banner.png'
100+
}),
101+
],
102+
};
103+
```
104+
105+
<br/></details>
106+
107+
<details>
108+
<summary>esbuild</summary><br/>
109+
110+
```js
111+
// esbuild.config.js
112+
import { build } from "esbuild";
113+
import { LFS, SpaceCard } from "hfup/esbuild";
114+
115+
build({
116+
/* ... */
117+
plugins: [
118+
LFS(),
119+
SpaceCard({
120+
title: 'Real-time Whisper WebGPU (Vue)',
121+
emoji: '🎤',
122+
colorFrom: 'gray',
123+
colorTo: 'green',
124+
sdk: 'static',
125+
pinned: false,
126+
license: 'mit',
127+
models: ['onnx-community/whisper-base'],
128+
short_description: 'Yet another Real-time Whisper with WebGPU, written in Vue',
129+
thumbnail: 'https://raw.githubusercontent.com/moeru-ai/airi/refs/heads/main/packages/whisper-webgpu/public/banner.png'
130+
}),
131+
],
132+
});
133+
```
134+
135+
<br/></details>
136+
137+
<details>
138+
<summary>Rspack</summary><br/>
139+
140+
```js
141+
// rspack.config.mjs
142+
import { LFS, SpaceCard } from "hfup/rspack";
143+
144+
/** @type {import('@rspack/core').Configuration} */
145+
export default {
146+
plugins: [
147+
LFS(),
148+
SpaceCard({
149+
title: 'Real-time Whisper WebGPU (Vue)',
150+
emoji: '🎤',
151+
colorFrom: 'gray',
152+
colorTo: 'green',
153+
sdk: 'static',
154+
pinned: false,
155+
license: 'mit',
156+
models: ['onnx-community/whisper-base'],
157+
short_description: 'Yet another Real-time Whisper with WebGPU, written in Vue',
158+
thumbnail: 'https://raw.githubusercontent.com/moeru-ai/airi/refs/heads/main/packages/whisper-webgpu/public/banner.png'
159+
})
160+
],
161+
};
162+
```
163+
164+
<br/></details>
165+
166+
<details>
167+
<summary>Rolldown</summary><br/>
168+
169+
```js
170+
// rolldown.config.js
171+
import { defineConfig } from "rolldown";
172+
import { LFS, SpaceCard } from "hfup/rolldown";
173+
174+
export default defineConfig({
175+
plugins: [
176+
LFS(),
177+
SpaceCard({
178+
title: 'Real-time Whisper WebGPU (Vue)',
179+
emoji: '🎤',
180+
colorFrom: 'gray',
181+
colorTo: 'green',
182+
sdk: 'static',
183+
pinned: false,
184+
license: 'mit',
185+
models: ['onnx-community/whisper-base'],
186+
short_description: 'Yet another Real-time Whisper with WebGPU, written in Vue',
187+
thumbnail: 'https://raw.githubusercontent.com/moeru-ai/airi/refs/heads/main/packages/whisper-webgpu/public/banner.png'
188+
}),
189+
],
190+
});
191+
```
192+
193+
<br/></details>
194+
195+
## Features
196+
197+
- Still manually writing HuggingFace Spaces configurations?
198+
- Having trouble to quickly handle and edit the `.gitattributes` file for Git LFS?
199+
- Don't want any of the HuggingFace Spaces front-matter appear in `README.md`?
200+
- Fighting against annoying errors when deploying your HuggingFace Spaces?
201+
202+
`hfup` is here to help you!
203+
204+
- 🚀 Automatically...
205+
- generate `.gitattributes` file for Git LFS.
206+
- generate HuggingFace Spaces front-matter in `README.md`.
207+
- search for your `README.md` file and merge the front-matter header.
208+
- generate a dedicated `README.md` file right inside the `outDir` of build.
209+
- 🔐 Intellisense ready, type safe for Spaces configurations.
210+
- 📦 Out of the box support for Vite.
211+
212+
## What will happen
213+
62214
After bundling, a dedicated README with merged front-matter header will be generated in the root of your project:
63215

64216
```md
@@ -78,3 +230,12 @@ thumbnail: https://raw.githubusercontent.com/moeru-ai/airi/refs/heads/main/packa
78230

79231
# Real-time Whisper WebGPU (Vue)
80232
```
233+
234+
## License
235+
236+
[MIT License](./LICENSE.md).
237+
238+
[npm-version-src]: https://img.shields.io/npm/v/hfup?style=flat&colorA=18181B&colorB=f7d031
239+
[npm-version-href]: https://npmjs.com/package/hfup
240+
[npm-downloads-src]: https://img.shields.io/npm/dm/hfup?style=flat&colorA=18181B&colorB=f7d031
241+
[npm-downloads-href]: https://npmjs.com/package/hfup

cspell.config.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ words:
1212
- Moeru
1313
- oxlint
1414
- rolldown
15+
- rspack
16+
- spacecard
1517
- taze
1618
- unplugin
1719
ignoreWords: []

package.json

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,13 @@
1818
"import": "./dist/index.mjs",
1919
"default": "./dist/index.mjs"
2020
},
21-
"./vite": {
22-
"types": "./dist/vite/index.d.mts",
23-
"import": "./dist/vite/index.mjs",
24-
"default": "./dist/vite/index.mjs"
25-
}
21+
"./vite": "./dist/vite.mjs",
22+
"./webpack": "./dist/webpack.mjs",
23+
"./rspack": "./dist/rspack.mjs",
24+
"./rollup": "./dist/rollup.mjs",
25+
"./rolldown": "./dist/rolldown.mjs",
26+
"./esbuild": "./dist/esbuild.mjs",
27+
"./*": "./*"
2628
},
2729
"main": "./dist/index.mjs",
2830
"module": "./dist/index.mjs",
@@ -42,7 +44,7 @@
4244
"dependencies": {
4345
"defu": "^6.1.4",
4446
"gray-matter": "^4.0.3",
45-
"vite": "^6.3.5"
47+
"unplugin": "^2.3.5"
4648
},
4749
"devDependencies": {
4850
"@arethetypeswrong/cli": "^0.18.2",

0 commit comments

Comments
 (0)