phare-blog 0.1.0
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/LICENSE +21 -0
- package/README.md +385 -0
- package/dist/index.js +707 -0
- package/package.json +78 -0
- package/templates/default/base.html +36 -0
- package/templates/default/index.html +57 -0
- package/templates/default/page.html +39 -0
- package/templates/default/post.html +47 -0
- package/templates/default/style.css +319 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Phare Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,385 @@
|
|
|
1
|
+
# Phare
|
|
2
|
+
|
|
3
|
+
**A privacy-focused static site generator for the small web.**
|
|
4
|
+
|
|
5
|
+
Phare (French for "lighthouse", pronounced like "far") is a minimal, fast, and privacy-first static site generator built with TypeScript. It's designed for bloggers who value simplicity, performance, and user privacy.
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- π **Privacy-First**: No tracking, no analytics, no external dependencies
|
|
10
|
+
- β‘ **Blazing Fast**: Builds 50 posts in <20ms
|
|
11
|
+
- π¨ **Beautiful Default Theme**: Dark mode, <10KB CSS, zero JavaScript
|
|
12
|
+
- π **Markdown-Based**: Write in Markdown with frontmatter
|
|
13
|
+
- π **Simple CLI**: Four commands to rule them all
|
|
14
|
+
- π **RSS/Atom Feeds**: Built-in feed generation
|
|
15
|
+
- βΏ **Accessible**: WCAG AA compliant by default
|
|
16
|
+
- π¦ **Zero Config**: Works out of the box with sensible defaults
|
|
17
|
+
|
|
18
|
+
## Quick Start
|
|
19
|
+
|
|
20
|
+
### Installation
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
# Install globally
|
|
24
|
+
npm install -g phare
|
|
25
|
+
|
|
26
|
+
# Or use with pnpm
|
|
27
|
+
pnpm add -g phare
|
|
28
|
+
|
|
29
|
+
# Or use without installing
|
|
30
|
+
npx phare new my-blog
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
See [Installation Guide](docs/INSTALL.md) for detailed instructions, troubleshooting, and all installation methods.
|
|
34
|
+
|
|
35
|
+
### Create Your First Site
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
# Create a new site
|
|
39
|
+
phare new my-blog
|
|
40
|
+
|
|
41
|
+
# Navigate to your site
|
|
42
|
+
cd my-blog
|
|
43
|
+
|
|
44
|
+
# Create your first post
|
|
45
|
+
phare post "Hello World"
|
|
46
|
+
|
|
47
|
+
# Build the site
|
|
48
|
+
phare build
|
|
49
|
+
|
|
50
|
+
# Start dev server with hot-reload
|
|
51
|
+
phare serve
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Your site will be available at `http://localhost:3000`
|
|
55
|
+
|
|
56
|
+
## Project Structure
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
my-blog/
|
|
60
|
+
βββ phare.toml # Site configuration
|
|
61
|
+
βββ content/
|
|
62
|
+
β βββ posts/ # Blog posts (Markdown)
|
|
63
|
+
β β βββ 2024-01-10-hello-world.md
|
|
64
|
+
β βββ pages/ # Static pages (Markdown)
|
|
65
|
+
β βββ about.md
|
|
66
|
+
βββ static/ # Static assets (copied as-is)
|
|
67
|
+
β βββ favicon.ico
|
|
68
|
+
βββ templates/ # Custom templates (optional)
|
|
69
|
+
β βββ default/
|
|
70
|
+
β βββ index.html
|
|
71
|
+
β βββ post.html
|
|
72
|
+
β βββ page.html
|
|
73
|
+
β βββ style.css
|
|
74
|
+
βββ public/ # Generated site (don't edit)
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Configuration
|
|
78
|
+
|
|
79
|
+
Edit `phare.toml` to configure your site:
|
|
80
|
+
|
|
81
|
+
```toml
|
|
82
|
+
[site]
|
|
83
|
+
title = "My Blog"
|
|
84
|
+
url = "https://example.com"
|
|
85
|
+
author = "Your Name"
|
|
86
|
+
lang = "en"
|
|
87
|
+
description = "A blog about things"
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
That's it! Phare embraces convention over configuration.
|
|
91
|
+
|
|
92
|
+
## Writing Content
|
|
93
|
+
|
|
94
|
+
### Posts
|
|
95
|
+
|
|
96
|
+
Create a new post with the CLI:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
phare post "My Post Title"
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Or manually create a Markdown file in `content/posts/`:
|
|
103
|
+
|
|
104
|
+
```markdown
|
|
105
|
+
---
|
|
106
|
+
title: "My First Post"
|
|
107
|
+
date: 2024-01-10
|
|
108
|
+
tags: ["intro", "blog"]
|
|
109
|
+
description: "An introduction to my blog"
|
|
110
|
+
draft: false
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
# Hello World
|
|
114
|
+
|
|
115
|
+
This is my first post!
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
**Frontmatter fields:**
|
|
119
|
+
- `title` (required): Post title
|
|
120
|
+
- `date` (required): Publication date (YYYY-MM-DD)
|
|
121
|
+
- `tags` (optional): Array of tags
|
|
122
|
+
- `description` (optional): Post description for feeds
|
|
123
|
+
- `draft` (optional): If true, post won't be published
|
|
124
|
+
|
|
125
|
+
### Pages
|
|
126
|
+
|
|
127
|
+
Create static pages in `content/pages/`:
|
|
128
|
+
|
|
129
|
+
```markdown
|
|
130
|
+
---
|
|
131
|
+
title: "About"
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
This is the about page.
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## Commands
|
|
138
|
+
|
|
139
|
+
### `phare new <name>`
|
|
140
|
+
|
|
141
|
+
Create a new Phare site with the given name.
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
phare new my-blog
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### `phare post <title>`
|
|
148
|
+
|
|
149
|
+
Create a new blog post with the given title.
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
phare post "My Awesome Post"
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
This creates a file like `content/posts/2024-01-10-my-awesome-post.md`.
|
|
156
|
+
|
|
157
|
+
### `phare build`
|
|
158
|
+
|
|
159
|
+
Build your static site to the `public/` directory.
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
phare build
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
Options:
|
|
166
|
+
- `-o, --output <dir>`: Specify output directory (default: `public`)
|
|
167
|
+
|
|
168
|
+
### `phare serve`
|
|
169
|
+
|
|
170
|
+
Start a development server with hot-reload.
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
phare serve
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
Options:
|
|
177
|
+
- `-p, --port <port>`: Specify port (default: `3000`)
|
|
178
|
+
|
|
179
|
+
The server watches for changes in:
|
|
180
|
+
- `content/` - Rebuilds on content changes
|
|
181
|
+
- `static/` - Copies updated assets
|
|
182
|
+
- `phare.toml` - Reloads configuration
|
|
183
|
+
- `templates/` - Reloads templates
|
|
184
|
+
|
|
185
|
+
## Customization
|
|
186
|
+
|
|
187
|
+
### Templates
|
|
188
|
+
|
|
189
|
+
Phare uses Handlebars templates. To customize, create files in `templates/default/`:
|
|
190
|
+
|
|
191
|
+
- `index.html` - Homepage template
|
|
192
|
+
- `post.html` - Blog post template
|
|
193
|
+
- `page.html` - Static page template
|
|
194
|
+
- `style.css` - Stylesheet (inlined in HTML)
|
|
195
|
+
|
|
196
|
+
**Available template variables:**
|
|
197
|
+
|
|
198
|
+
```handlebars
|
|
199
|
+
{{site.title}} - Site title
|
|
200
|
+
{{site.url}} - Site URL
|
|
201
|
+
{{site.author}} - Author name
|
|
202
|
+
{{site.lang}} - Site language
|
|
203
|
+
{{site.description}} - Site description
|
|
204
|
+
|
|
205
|
+
{{post.title}} - Post title
|
|
206
|
+
{{post.date}} - Post date
|
|
207
|
+
{{post.content}} - Post HTML content
|
|
208
|
+
{{post.description}} - Post description
|
|
209
|
+
{{post.tags}} - Post tags array
|
|
210
|
+
{{post.slug}} - Post URL slug
|
|
211
|
+
|
|
212
|
+
{{#each posts}} - Loop through posts
|
|
213
|
+
{{#each pages}} - Loop through pages
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
**Template helpers:**
|
|
217
|
+
|
|
218
|
+
```handlebars
|
|
219
|
+
{{formatDate date "yyyy-MM-dd"}} - Format date
|
|
220
|
+
{{formatDateLong date}} - Format as "January 10, 2024"
|
|
221
|
+
{{truncate text 100}} - Truncate text to length
|
|
222
|
+
{{join tags ", "}} - Join array with separator
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
### Styling
|
|
226
|
+
|
|
227
|
+
The default "ClartΓ©" theme provides:
|
|
228
|
+
- Automatic dark mode (prefers-color-scheme)
|
|
229
|
+
- System font stack (no web fonts)
|
|
230
|
+
- Responsive design
|
|
231
|
+
- <10KB CSS
|
|
232
|
+
- WCAG AA accessible
|
|
233
|
+
|
|
234
|
+
To customize, edit `templates/default/style.css` or create your own theme.
|
|
235
|
+
|
|
236
|
+
## Performance
|
|
237
|
+
|
|
238
|
+
Phare is designed to be fast:
|
|
239
|
+
|
|
240
|
+
- **Build speed**: 50 posts in ~15ms
|
|
241
|
+
- **Page size**: <10KB HTML + CSS
|
|
242
|
+
- **Zero JavaScript**: No runtime overhead
|
|
243
|
+
- **Optimized parsing**: Efficient Markdown and template processing
|
|
244
|
+
|
|
245
|
+
## Privacy
|
|
246
|
+
|
|
247
|
+
Phare is built with privacy as a core principle:
|
|
248
|
+
|
|
249
|
+
- β
No tracking scripts
|
|
250
|
+
- β
No analytics
|
|
251
|
+
- β
No external font loading
|
|
252
|
+
- β
No CDN dependencies
|
|
253
|
+
- β
Self-contained CSS
|
|
254
|
+
- β
GDPR compliant by default
|
|
255
|
+
|
|
256
|
+
Your readers' privacy is protected out of the box.
|
|
257
|
+
|
|
258
|
+
## Deployment
|
|
259
|
+
|
|
260
|
+
Deploy the `public/` directory to any static hosting:
|
|
261
|
+
|
|
262
|
+
### Netlify
|
|
263
|
+
|
|
264
|
+
```bash
|
|
265
|
+
# netlify.toml
|
|
266
|
+
[build]
|
|
267
|
+
command = "phare build"
|
|
268
|
+
publish = "public"
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
### Vercel
|
|
272
|
+
|
|
273
|
+
```bash
|
|
274
|
+
# vercel.json
|
|
275
|
+
{
|
|
276
|
+
"buildCommand": "phare build",
|
|
277
|
+
"outputDirectory": "public"
|
|
278
|
+
}
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
### GitHub Pages
|
|
282
|
+
|
|
283
|
+
```bash
|
|
284
|
+
phare build
|
|
285
|
+
cd public
|
|
286
|
+
git init
|
|
287
|
+
git add .
|
|
288
|
+
git commit -m "Deploy"
|
|
289
|
+
git push -f git@github.com:username/username.github.io.git main
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
### Cloudflare Pages
|
|
293
|
+
|
|
294
|
+
Connect your repository and set:
|
|
295
|
+
- **Build command**: `phare build`
|
|
296
|
+
- **Output directory**: `public`
|
|
297
|
+
|
|
298
|
+
## Development
|
|
299
|
+
|
|
300
|
+
### Requirements
|
|
301
|
+
|
|
302
|
+
- Node.js 20+
|
|
303
|
+
- pnpm (recommended)
|
|
304
|
+
|
|
305
|
+
### Setup
|
|
306
|
+
|
|
307
|
+
```bash
|
|
308
|
+
# Clone repository
|
|
309
|
+
git clone https://codeberg.org/fberrez/phare.git
|
|
310
|
+
cd phare
|
|
311
|
+
|
|
312
|
+
# Install dependencies
|
|
313
|
+
pnpm install
|
|
314
|
+
|
|
315
|
+
# Build CLI
|
|
316
|
+
pnpm build
|
|
317
|
+
|
|
318
|
+
# Run tests
|
|
319
|
+
pnpm test
|
|
320
|
+
|
|
321
|
+
# Link for local development
|
|
322
|
+
pnpm link --global
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
### Project Structure
|
|
326
|
+
|
|
327
|
+
```
|
|
328
|
+
phare/
|
|
329
|
+
βββ src/
|
|
330
|
+
β βββ index.ts # CLI entry point
|
|
331
|
+
β βββ cli/ # Command implementations
|
|
332
|
+
β βββ config/ # Configuration parser
|
|
333
|
+
β βββ content/ # Content parsers (Markdown)
|
|
334
|
+
β βββ build/ # Build system & templates
|
|
335
|
+
β βββ server/ # Dev server
|
|
336
|
+
βββ templates/ # Default theme
|
|
337
|
+
βββ tests/ # Test suite
|
|
338
|
+
βββ dist/ # Compiled output
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
## Contributing
|
|
342
|
+
|
|
343
|
+
Contributions are welcome! Please read [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
|
|
344
|
+
|
|
345
|
+
### Reporting Issues
|
|
346
|
+
|
|
347
|
+
Found a bug? [Open an issue](https://codeberg.org/fberrez/phare/issues) on Codeberg.
|
|
348
|
+
|
|
349
|
+
### Feature Requests
|
|
350
|
+
|
|
351
|
+
Have an idea? [Start a discussion](https://codeberg.org/fberrez/phare/issues) first.
|
|
352
|
+
|
|
353
|
+
## Philosophy
|
|
354
|
+
|
|
355
|
+
Phare follows these principles:
|
|
356
|
+
|
|
357
|
+
1. **Privacy First**: No tracking, no analytics, respect user privacy
|
|
358
|
+
2. **Radical Simplicity**: Minimal configuration, sensible defaults
|
|
359
|
+
3. **Performance**: Fast builds, small pages, optimized output
|
|
360
|
+
4. **Accessibility**: WCAG AA compliant, semantic HTML
|
|
361
|
+
5. **Open Source**: Free software, community-driven
|
|
362
|
+
6. **Small Web**: Built for personal blogs, not corporate sites
|
|
363
|
+
|
|
364
|
+
## Inspirations
|
|
365
|
+
|
|
366
|
+
Phare is inspired by:
|
|
367
|
+
- [This is a motherfucking website](https://motherfuckingwebsite.com/)
|
|
368
|
+
- [Neustadt - Rediscovering the Small Web](https://neustadt.fr/essays/the-small-web/)
|
|
369
|
+
- [Neustadt - Against an Increasingly User-Hostile Web](https://neustadt.fr/essays/against-a-user-hostile-web/)
|
|
370
|
+
|
|
371
|
+
## License
|
|
372
|
+
|
|
373
|
+
MIT License - see [LICENSE](LICENSE) for details.
|
|
374
|
+
|
|
375
|
+
## Links
|
|
376
|
+
|
|
377
|
+
- **Website**: https://phare.example.com (coming soon)
|
|
378
|
+
- **Repository**: https://codeberg.org/fberrez/phare
|
|
379
|
+
- **Issues**: https://codeberg.org/fberrez/phare/issues
|
|
380
|
+
- **Changelog**: [CHANGELOG.md](CHANGELOG.md)
|
|
381
|
+
- **Roadmap**: [ROADMAP.md](ROADMAP.md)
|
|
382
|
+
|
|
383
|
+
---
|
|
384
|
+
|
|
385
|
+
**Made with β€οΈ for the small web**
|