Skip to content

Commit abc04ac

Browse files
refactor(ssg): 🎨 refactor code and various optimisations features
1 parent d3b5b3a commit abc04ac

35 files changed

+3012
-1342
lines changed

Cargo.lock

Lines changed: 774 additions & 255 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -87,41 +87,45 @@ cli = [] # Enable command-line interface support
8787
# -----------------------------------------------------------------------------
8888
[build-dependencies]
8989
# Dependencies for the build script, used for pre-compilation tasks.
90-
version_check = "0.9" # Ensures that a compatible Rust version is used
90+
version_check = "0.9.5" # Ensures that a compatible Rust version is used
9191

9292
# -----------------------------------------------------------------------------
9393
# Development Dependencies
9494
# -----------------------------------------------------------------------------
9595
[dev-dependencies]
9696
# Dependencies required for testing and development.
97-
criterion = "0.5" # Benchmarking library to test performance
97+
criterion = "0.5.1" # Benchmarking library to test performance
9898

9999
# -----------------------------------------------------------------------------
100100
# Dependencies
101101
# -----------------------------------------------------------------------------
102102
[dependencies]
103103
# Required dependencies for building and running the project.
104-
anyhow = "1.0.93"
105-
clap = { version = "4.5.21", features = ["derive", "cargo", "env"] }
104+
anyhow = "1.0.95"
105+
clap = { version = "4.5.23", features = ["derive", "cargo", "env"] }
106106
dtt = "0.0.8"
107+
env_logger = "0.11.6"
107108
http-handle = "0.0.2"
109+
indicatif = { version = "0.17.9", features = ["rayon"] }
108110
langweave = "0.0.1"
109111
log = { version = "0.4.22", features = ["std"] }
112+
once_cell = "1.20.2"
110113
rayon = "1.10.0"
111114
rlg = "0.0.6"
112-
serde = { version = "1.0.215", features = ["derive"] }
113-
serde_json = "1.0.133"
114-
staticdatagen = "0.0.1"
115+
serde = { version = "1.0.216", features = ["derive"] }
116+
serde_json = "1.0.134"
117+
staticdatagen = "0.0.4"
115118
tempfile = "3.14.0"
116-
thiserror = "2.0.3"
119+
thiserror = "2.0.9"
117120
toml = "0.8.19"
118-
tokio = { version = "1.41.1", features = ["full"], optional = true }
121+
tokio = { version = "1.42.0", features = ["full"], optional = true }
119122
url = "2.5.3"
120123
uuid = { version = "1.11.0", features = ["v4"] }
124+
warp = "0.3.7"
121125

122126
# Platform-specific dependency for Unix with OpenSSL
123127
[target.'cfg(all(unix, not(target_os = "macos")))'.dependencies]
124-
openssl = { version = "0.10", features = ["vendored"] }
128+
openssl = { version = "0.10.68", features = ["vendored"] }
125129

126130
# -----------------------------------------------------------------------------
127131
# Criterion Benchmark

README.md

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,24 +69,33 @@ shokunin = "0.0.31"
6969
```
7070

7171
Basic implementation:
72-
73-
```rust
72+
```rust,no_run
7473
use staticdatagen::compiler::service::compile;
74+
use std::fs;
7575
use std::path::Path;
76+
use std::error::Error;
7677
77-
fn main() -> Result<(), Box<dyn std::error::Error>> {
78-
// Define the paths to the build, site, content and template directories.
78+
fn main() -> Result<(), Box<dyn Error>> {
79+
// Define the paths to the build, site, content, and template directories.
7980
let build_path = Path::new("build");
8081
let content_path = Path::new("content");
8182
let site_path = Path::new("public");
8283
let template_path = Path::new("templates");
8384
85+
// Ensure the required directories exist.
86+
fs::create_dir_all(build_path)?;
87+
fs::create_dir_all(content_path)?;
88+
fs::create_dir_all(site_path)?;
89+
fs::create_dir_all(template_path)?;
90+
91+
// Call the compile function with the specified paths.
8492
compile(build_path, content_path, site_path, template_path)?;
8593
8694
Ok(())
8795
}
8896
```
8997

98+
9099
### Usage
91100

92101
Create a new static site:

content/index.md

Lines changed: 1 addition & 151 deletions
Original file line numberDiff line numberDiff line change
@@ -1,151 +1 @@
1-
---
2-
3-
# Front Matter (YAML)
4-
5-
author: "jane.doe@kaishi.one (Jane Doe)" ## The author of the page. (max 64 characters)
6-
banner_alt: "MacBook Pro on white surface" ## The banner alt of the site.
7-
banner_height: "398" ## The banner height of the site.
8-
banner_width: "1440" ## The banner width of the site.
9-
banner: "https://kura.pro/stock/images/banners/bernardo-lorena-ponte-cEp2Tow6XKk.webp" ## The banner of the site.
10-
cdn: "https://kura.pro" ## The CDN of the site.
11-
changefreq: "weekly" ## The changefreq of the site.
12-
charset: "utf-8" ## The charset of the site. (default: utf-8)
13-
cname: "kaishi.one" ## The cname value of the site. (Only required for the index page.)
14-
copyright: "© 2024 Kaishi. All rights reserved." ## The copyright of the site.
15-
date: "July 12, 2023"
16-
description: "Make beautiful websites with Kaishi, a Shokunin Static Site Generator starter template." ## The description of the site. (max 160 characters)
17-
download: "" ## The download url for the product.
18-
format-detection: "telephone=no" ## The format detection of the site.
19-
hreflang: "en" ## The hreflang of the site. (default: en-gb)
20-
icon: "https://kura.pro/kaishi/images/logos/kaishi.svg" ## The icon of the site in SVG format.
21-
id: "https://kaishi.one" ## The id of the site.
22-
image_alt: "Logo of Kaishi, a starter template for static sites" ## The image alt of the site.
23-
image_height: "630" ## The image height of the site.
24-
image_width: "1200" ## The image width of the site.
25-
image: "https://kura.pro/kaishi/images/banners/banner-kaishi.webp" ## The main image of the site in SVG format.
26-
keywords: "kaishi, shokunin static site generator, static site generator, minimalist website template, modern website template, responsive website template, website starter template, freelance creative, startup founder, small business owner, online presence" ## The keywords of the site. (comma separated, max 10 keywords)
27-
language: "en-GB" ## The language of the site. (default: en-GB)
28-
layout: "index" ## The layout of the site.
29-
locale: "en_GB" ## The locale of the site.
30-
logo_alt: "Logo of Kaishi, a starter template for static sites" ## The logo alt of the site.
31-
logo_height: "33" ## The logo height of the site.
32-
logo_width: "100" ## The logo width of the site.
33-
logo: "https://kura.pro/kaishi/images/logos/kaishi.svg" ## The logo of the site in SVG format.
34-
name: "Kaishi" ## The name of the website. (max 64 characters)
35-
permalink: "https://kaishi.one" ## The url of the site.
36-
rating: "general" ## The rating of the site.
37-
referrer: "no-referrer" ## The referrer of the site.
38-
revisit-after: "7 days" ## The revisit after of the site.
39-
robots: "index, follow" ## The robots of the site.
40-
short_name: "kaishi" ## The short name of the site. (max 12 characters)
41-
subtitle: "Build Amazing Websites with Minimal Effort using Kaishi Starter Templates" ## The subtitle of the page. (max 64 characters)
42-
theme-color: "143, 250, 113" ## The theme color of the site.
43-
tags: "kaishi, shokunin static site generator, static site generator, minimalist website template, modern website template, responsive website template, website starter template, freelance creative, startup founder, small business owner, online presence" ## The tags of the site. (comma separated, max 10 tags)
44-
title: "Kaishi, a Shokunin Static Site Generator Starter Template" ## The title of the page. (max 64 characters)
45-
url: "https://kaishi.one" ## The url of the site.
46-
viewport: "width=device-width, initial-scale=1, shrink-to-fit=no" ## The viewport of the site.
47-
48-
# News - The News SiteMap front matter (YAML).
49-
news_genres: "Blog" ## The genres of the site. (PressRelease|Satire|Blog|OpEd|Opinion|UserGenerated)
50-
news_keywords: "kaishi, shokunin static site generator, static site generator, minimalist website template, modern website template, responsive website template, website starter template, freelance creative, startup founder, small business owner, online presence" ## The keywords of the site. (comma separated, max 10 keywords)
51-
news_language: "en" ## The language of the site. (default: en)
52-
news_image_loc: "https://kura.pro/stock/images/banners/bernardo-lorena-ponte-cEp2Tow6XKk.webp" ## The image loc of the site.
53-
news_loc: "https://kaishi.one" ## The loc of the site.
54-
news_publication_date: "Tue, 20 Feb 2024 15:15:15 GMT" ## The publication date of the site.
55-
news_publication_name: "Kaishi" ## The news publication name of the site.
56-
news_title: "Kaishi, a Shokunin Static Site Generator Starter Template" ## The title of the page. (max 64 characters)
57-
58-
59-
# RSS - The RSS feed front matter (YAML).
60-
atom_link: https://kaishi.one/rss.xml
61-
category: "Technology"
62-
docs: https://validator.w3.org/feed/docs/rss2.html
63-
generator: "Shokunin SSG (version 0.0.31)"
64-
item_description: RSS feed for the site
65-
item_guid: https://kaishi.one/rss.xml
66-
item_link: https://kaishi.one/rss.xml
67-
item_pub_date: "Tue, 20 Feb 2024 15:15:15 GMT"
68-
item_title: "RSS"
69-
last_build_date: "Tue, 20 Feb 2024 15:15:15 GMT"
70-
managing_editor: jane.doe@kaishi.one (Jane Doe)
71-
pub_date: "Tue, 20 Feb 2024 15:15:15 GMT"
72-
ttl: "60"
73-
type: "website"
74-
webmaster: jane.doe@kaishi.one (Jane Doe)
75-
76-
# Apple - The Apple front matter (YAML).
77-
apple_mobile_web_app_orientations: "portrait" ## The Apple mobile web app orientations of the page.
78-
apple_touch_icon_sizes: "192x192" ## The Apple touch icon sizes of the page.
79-
apple-mobile-web-app-capable: "yes" ## The Apple mobile web app capable of the page.
80-
apple-mobile-web-app-status-bar-inset: "black" ## The Apple mobile web app status bar inset of the page.
81-
apple-mobile-web-app-status-bar-style: "black-translucent" ## The Apple mobile web app status bar style of the page.
82-
apple-mobile-web-app-title: "Kaishi" ## The Apple mobile web app title of the page.
83-
apple-touch-fullscreen: "yes" ## The Apple touch fullscreen of the page.
84-
85-
# MS Application - The MS Application front matter (YAML).
86-
87-
msapplication-navbutton-color: "rgb(0,102,204)"
88-
89-
# Twitter Card - The Twitter Card front matter (YAML).
90-
91-
## twitter_card - The Twitter Card type of the page.
92-
twitter_card: "summary"
93-
## twitter_creator - The Twitter Card creator of the page.
94-
twitter_creator: "janedoe"
95-
## twitter_description - The Twitter Card description of the page.
96-
twitter_description: "Make beautiful websites with Kaishi, a Shokunin Static Site Generator Starter Template."
97-
## twitter_image - The Twitter Card image of the page.
98-
twitter_image: "https://kura.pro/kaishi/images/logos/kaishi.svg"
99-
## twitter_image:alt - The Twitter Card image alt of the page.
100-
twitter_image_alt: "Logo of Kaishi, a starter template for static sites"
101-
## twitter_site - The Twitter Card site of the page.
102-
twitter_site: "janedoe"
103-
## twitter_title - The Twitter Card title of the page.
104-
twitter_title: "Kaishi, a Shokunin Static Site Generator Starter Template"
105-
## twitter_url - The Twitter Card url of the page.
106-
twitter_url: "https://kaishi.one"
107-
108-
# Humans.txt - The Humans.txt front matter (YAML).
109-
author_website: "https://kura.pro" ## The author website of the page.
110-
author_twitter: "@wwdseb" ## The author twitter of the page.
111-
author_location: "London, UK" ## The author location of the page.
112-
thanks: "Thanks for reading!" ## The thanks of the page.
113-
site_last_updated: "2023-07-05" ## The last updated of the site.
114-
site_standards: "HTML5, CSS3, RSS, Atom, JSON, XML, YAML, Markdown, TOML" ## The standards of the site.
115-
site_components: "Kaishi, Kaishi Builder, Kaishi CLI, Kaishi Templates, Kaishi Themes" ## The components of the site.
116-
site_software: "Shokunin, Rust" ## The software of the site.
117-
118-
# Security - The Security front matter (YAML).
119-
security_contact: "mailto:jane.doe@kaishi.one" ## The contact of the page.
120-
security_expires: "Tue, 20 Feb 2024 15:15:15 GMT" ## The expires of the page.
121-
# Optional fields:
122-
security_acknowledgments: "Thanks to the Rust team for their amazing work on Shokunin." ## The acknowledgments of the page.
123-
security_languages: "en" ## The preferred languages of the page.
124-
security_canonical: "https://kaishi.one" ## The canonical of the page.
125-
security_policy: "https://kaishi.one/policy" ## The policy of the page.
126-
security_hiring: "https://kaishi.one/hiring" ## The hiring of the page.
127-
security_encryption: "https://kaishi.one/encryption" ## The encryption of the page.
128-
129-
---
130-
131-
## Overview
132-
133-
**Kaishi** is a minimalist and modern [Shokunin static website generator ⧉][0]
134-
starter template designed for professionals who value simplicity and elegance.
135-
136-
With its clean and dynamic layout, Kaishi offers a versatile and user-friendly
137-
solution for those looking to showcase their work and services online. Built on
138-
a responsive framework, this template is ideal for professionals without coding
139-
or design skills.
140-
141-
Whether you're a freelance creative, a startup founder, or a small business
142-
owner. Kaishi's ready-to-use website and responsive starter templates provide
143-
the perfect foundation for your online presence. With its minimalist design,
144-
Kaishi is the ultimate website starter template for modern and professional
145-
websites.
146-
147-
This page is an example for the Shokunin static website generator. You
148-
can use it as a template for your website or blog. It uses a markdown template
149-
for the content and a custom HTML theme for the layout.
150-
151-
[0]: https://shokunin.one/
1+
Hello, world!

0 commit comments

Comments
 (0)