@jsnchn/buntastic 0.0.3 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -9
- package/buntastic +0 -0
- package/package.json +3 -1
- package/src/index.ts +26 -6
package/README.md
CHANGED
|
@@ -11,16 +11,28 @@ A simple static site generator built with Bun.
|
|
|
11
11
|
|
|
12
12
|
## Installation
|
|
13
13
|
|
|
14
|
-
###
|
|
14
|
+
### Standalone binary (recommended - no dependencies required)
|
|
15
|
+
|
|
16
|
+
Download the latest release for your platform from [GitHub Releases](https://github.com/jsnchn/buntastic/releases):
|
|
15
17
|
|
|
16
18
|
```bash
|
|
17
|
-
#
|
|
18
|
-
curl -fsSL https://
|
|
19
|
+
# Linux/macOS
|
|
20
|
+
curl -fsSL https://github.com/jsnchn/buntastic/releases/latest/download/buntastic -o buntastic
|
|
21
|
+
chmod +x buntastic
|
|
22
|
+
|
|
23
|
+
# Windows (PowerShell)
|
|
24
|
+
iwr https://github.com/jsnchn/buntastic/releases/latest/download/buntastic.exe -o buntastic.exe
|
|
25
|
+
```
|
|
19
26
|
|
|
20
|
-
|
|
21
|
-
bun install -g buntastic
|
|
27
|
+
Then run `./buntastic` (or `buntastic.exe` on Windows).
|
|
22
28
|
|
|
23
|
-
|
|
29
|
+
### With Bun or Node
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
# With bun
|
|
33
|
+
bunx buntastic build
|
|
34
|
+
|
|
35
|
+
# With npx (Node.js)
|
|
24
36
|
npx buntastic build
|
|
25
37
|
```
|
|
26
38
|
|
|
@@ -31,8 +43,11 @@ npx buntastic build
|
|
|
31
43
|
git clone https://github.com/jsnchn/buntastic.git
|
|
32
44
|
cd buntastic
|
|
33
45
|
|
|
46
|
+
# Build the binary
|
|
47
|
+
bun run build:binary
|
|
48
|
+
|
|
34
49
|
# Start the dev server
|
|
35
|
-
|
|
50
|
+
./buntastic dev
|
|
36
51
|
```
|
|
37
52
|
|
|
38
53
|
Visit `http://localhost:3000` to see your site.
|
|
@@ -79,7 +94,7 @@ Buntastic commands interact with your project in different ways:
|
|
|
79
94
|
|
|
80
95
|
**Destructive command** (`init`) creates new files and **will overwrite** an existing `package.json`. Use this only on new projects or when you want to start fresh.
|
|
81
96
|
|
|
82
|
-
Or
|
|
97
|
+
Or when using from source with bun:
|
|
83
98
|
|
|
84
99
|
| Command | Description |
|
|
85
100
|
|---------|-------------|
|
|
@@ -89,6 +104,8 @@ Or with bun run (if using from source):
|
|
|
89
104
|
| `bun run preview` | Serve the built `dist/` folder |
|
|
90
105
|
| `bun run init` | Initialize a new project (creates files) |
|
|
91
106
|
|
|
107
|
+
Note: When using from source, `bun run dev` internally runs `./buntastic dev` after building.
|
|
108
|
+
|
|
92
109
|
## Writing Content
|
|
93
110
|
|
|
94
111
|
Create markdown files in `content/`:
|
|
@@ -230,11 +247,13 @@ Drafts are included when running `bun run build:drafts`.
|
|
|
230
247
|
|
|
231
248
|
## Tech Stack
|
|
232
249
|
|
|
233
|
-
- [Bun](https://bun.sh) -
|
|
250
|
+
- [Bun](https://bun.sh) - Runtime used to build the binary
|
|
234
251
|
- Bun.markdown - Built-in GFM markdown parser
|
|
235
252
|
- Bun.serve - HTTP server
|
|
236
253
|
- Bun.watch - File watching
|
|
237
254
|
|
|
255
|
+
The published binary has no runtime dependencies - users don't need Bun or Node.js installed.
|
|
256
|
+
|
|
238
257
|
## License
|
|
239
258
|
|
|
240
259
|
MIT
|
package/buntastic
ADDED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsnchn/buntastic",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"description": "A simple static site generator built with Bun",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"buntastic": "src/index.ts"
|
|
8
8
|
},
|
|
9
9
|
"scripts": {
|
|
10
|
+
"build:binary": "bun build --compile src/index.ts --outfile buntastic",
|
|
11
|
+
"prepublish": "bun build --compile src/index.ts --outfile buntastic",
|
|
10
12
|
"build": "buntastic build",
|
|
11
13
|
"build:drafts": "buntastic build --drafts",
|
|
12
14
|
"dev": "buntastic dev",
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
#!/usr/bin/env bun
|
|
2
1
|
import { mkdir, writeFile, readFile, copyFile, exists } from "fs/promises";
|
|
2
|
+
import { watch as fsWatch } from "fs/promises";
|
|
3
3
|
import { join, relative, dirname, extname } from "path";
|
|
4
4
|
import { Glob } from "bun";
|
|
5
5
|
|
|
@@ -292,11 +292,31 @@ async function dev(): Promise<void> {
|
|
|
292
292
|
|
|
293
293
|
console.log(`Dev server running at http://localhost:${server.port}`);
|
|
294
294
|
|
|
295
|
-
const
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
295
|
+
const watcher1 = fsWatch(CONTENT_DIR, { recursive: true });
|
|
296
|
+
const watcher2 = fsWatch(LAYOUTS_DIR, { recursive: true });
|
|
297
|
+
const watcher3 = fsWatch(PUBLIC_DIR, { recursive: true });
|
|
298
|
+
|
|
299
|
+
const watchers = [watcher1, watcher2, watcher3];
|
|
300
|
+
|
|
301
|
+
let debounceTimer: ReturnType<typeof setTimeout> | undefined;
|
|
302
|
+
const rebuild = () => {
|
|
303
|
+
clearTimeout(debounceTimer);
|
|
304
|
+
debounceTimer = setTimeout(async () => {
|
|
305
|
+
console.log("Rebuilding...");
|
|
306
|
+
await build(false);
|
|
307
|
+
}, 100);
|
|
308
|
+
};
|
|
309
|
+
|
|
310
|
+
(async () => {
|
|
311
|
+
for (const watcher of watchers) {
|
|
312
|
+
(async () => {
|
|
313
|
+
for await (const event of watcher) {
|
|
314
|
+
console.log(`[${event.eventType}] ${event.filename} - rebuilding...`);
|
|
315
|
+
rebuild();
|
|
316
|
+
}
|
|
317
|
+
})();
|
|
318
|
+
}
|
|
319
|
+
})();
|
|
300
320
|
}
|
|
301
321
|
|
|
302
322
|
async function preview(): Promise<void> {
|