Skip to content
This repository was archived by the owner on Mar 7, 2026. It is now read-only.

Commit 2c6853d

Browse files
Cleanup
1 parent e8e4350 commit 2c6853d

7 files changed

Lines changed: 84 additions & 109 deletions

File tree

bun.lock

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

cynthia_websites_mini_client/src/cynthia_websites_mini_shared/config/v4_1/decodes.gleam

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ pub fn vp4p1mini_toml(toml_source: String) {
8686
tom.get_string(toml, ["config", "edition"])
8787
|> result.map(string.lowercase)
8888
let version =
89-
result.or(tom.get_float(toml, ["version"]), {
89+
result.or(tom.get_float(toml, ["config", "version"]), {
9090
tom.get_int(toml, ["config", "version"]) |> result.map(int.to_float)
9191
})
9292

@@ -159,6 +159,7 @@ pub fn vp4p1mini_toml(toml_source: String) {
159159
}
160160
Ok(_), Error(_) | Error(_), Ok(_) -> {
161161
console.error("Unknown combination of edition and version.")
162+
console.log(#(edition, version) |> string.inspect)
162163
Error(Nil)
163164
}
164165
Error(e), Error(_) -> {

cynthia_websites_mini_client/src/cynthia_websites_mini_shared/config/v4_1/encodes.gleam

Lines changed: 30 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import cynthia_websites_mini_shared/config/v4_1
22
import gbor
33
import gleam/bool
44
import gleam/json
5+
import gleam/string
56

67
pub fn v4p1_mini_json(v4p1_mini: v4_1.V4p1Mini) -> json.Json {
78
json.object([
@@ -103,48 +104,48 @@ pub fn v4p1_mini_cbor(v4p1_mini: v4_1.V4p1Mini) {
103104
}
104105

105106
pub fn v4p1_mini_toml(v4p1_mini: v4_1.V4p1Mini) -> String {
106-
"# Do not edit these variables! It is set by Cynthia to tell it's config format apart.
107-
configbor.edition=\"mini\"
108-
configbor.version=4.1
109-
[global]
110-
# Theme to use for light mode - default themes: autumn, default
111-
# Theme to use for dark mode - default themes: night, default-dark
112-
theme = { default = \""
107+
"# Do not edit these variables! They are set by Cynthia to tell it's config format apart.\nconfig.edition=\"mini\"\nconfig.version=4.1\n\n
108+
[global]
109+
# Theme to use for light mode - default themes: autumn, default
110+
# Theme to use for dark mode - default themes: night, default-dark
111+
theme = { default = \""
113112
<> v4p1_mini.global.theme
114113
<> "\", dark = \""
115114
<> v4p1_mini.global.theme_dark
116115
<> "\" }
117-
# Your website's name, displayed in various places
118-
site_name = \""
116+
# Your website's name, displayed in various places
117+
site_name = \""
119118
<> v4p1_mini.global.site_name
120119
<> "\"
121-
# A brief description of your website
122-
site_description = \""
120+
# A brief description of your website
121+
site_description = \""
123122
<> v4p1_mini.global.site_description
124123
<> "\"
125124
126-
[integrations]
127-
# Enable git integration for the website
128-
# This will allow Cynthia Mini to detect the git repository
129-
# For example linking to the commit hash in the footer
130-
git = "
131-
<> v4p1_mini.integrations.git |> bool.to_string
125+
[integrations]
126+
# Enable git integration for the website
127+
# This will allow Cynthia Mini to detect the git repository
128+
# For example linking to the commit hash in the footer
129+
git = "
130+
<> v4p1_mini.integrations.git |> bool.to_string |> string.lowercase
132131
<> "
133132
134-
# Enable sitemap generation
135-
# This will generate a sitemap.xml file in the root of the website
136-
#
137-
# You will need to enter the base URL of your website in the sitemap variable below.
138-
# If your homepage is at \"https://example.com/#/\", then the sitemap variable should be set to \"https://example.com\".
139-
# If you do not want to use a sitemap, set this to \"false\", or leave it empty (\"\"), you can also remove the sitemap variable altogether.
140-
sitemap = \""
133+
# Enable sitemap generation
134+
# This will generate a sitemap.xml file in the root of the website
135+
#
136+
# You will need to enter the base URL of your website in the sitemap variable below.
137+
# If your homepage is at \"https://example.com/#/\", then the sitemap variable should be set to \"https://example.com\".
138+
# If you do not want to use a sitemap, set this to \"false\", or leave it empty (\"\"), you can also remove the sitemap variable altogether.
139+
sitemap = \""
141140
<> v4p1_mini.integrations.sitemap
142141
<> "\"
143142
144-
# Enable crawlable context (JSON-LD injection)
145-
# This will allow search engines to crawl the website, and makes it
146-
# possible for the website to be indexed by search engine and LLMs.
147-
crawlable_context = "
148-
<> v4p1_mini.integrations.crawlable_context |> bool.to_string
143+
# Enable crawlable context (JSON-LD injection)
144+
# This will allow search engines to crawl the website, and makes it
145+
# possible for the website to be indexed by search engine and LLMs.
146+
crawlable_context = "
147+
<> v4p1_mini.integrations.crawlable_context
148+
|> bool.to_string
149+
|> string.lowercase
149150
<> ""
150151
}

cynthia_websites_mini_server/src/cynthia_websites_mini_server.gleam

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import gleam/string
1919
import gleamy_lights/console
2020
import gleamy_lights/premixed
2121
import gleamy_lights/premixed/gleam_colours
22-
import jot
2322
import plinth/node/process
2423
import simplifile
2524

@@ -214,7 +213,6 @@ fn get_context() -> site_json.SiteJSON {
214213
let htmlcontent = {
215214
case file_ext {
216215
"dj" | "djot" -> {
217-
// files.djot_to_html_string(file_content)
218216
djotparse.djot_to_html(file_content)
219217
}
220218

@@ -646,4 +644,10 @@ fn start() {
646644
panic as "Should not reach here."
647645
}
648646
}
647+
console.info(
648+
premixed.text_ok_green("Site pregeneration complete!")
649+
<> " Serve files from "
650+
<> premixed.text_orange(cwd <> "/out/")
651+
<> " and you should have a site running!",
652+
)
649653
}

cynthia_websites_mini_server/src/cynthia_websites_mini_server/utils/files.gleam

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@ pub fn path_join(parts: List(String)) -> String
77
@external(javascript, "./files_ffi.ts", "path_normalize")
88
pub fn path_normalize(path: String) -> String
99

10-
// Not in use. Using Jot instead for now.
11-
@external(javascript, "./files_ffi.ts", "djot_to_html")
12-
fn djot_to_html_string(djot: String) -> String
13-
1410
@external(javascript, "../../client_code_generated_ffi.ts", "client_script")
1511
pub fn client_js() -> String
1612

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,15 @@
11
import fs from "node:fs";
22
import path from "node:path";
3-
import djot from "@djot/djot";
43
import { List } from "../../../prelude.mjs";
54

65
export function exists(a: string): boolean {
7-
return fs.existsSync(a);
6+
return fs.existsSync(a);
87
}
98

109
export function path_join(paths: List): string {
11-
return path.join(...paths.toArray());
10+
return path.join(...paths.toArray());
1211
}
1312

1413
export function path_normalize(p: string): string {
15-
return path.normalize(p);
16-
}
17-
18-
export function djot_to_html(dj: string) {
19-
return (
20-
djot.renderHTML(djot.parse(dj, { sourcePositions: false }), {
21-
overrides: {
22-
heading(node, context) {
23-
const level = node.level;
24-
const classes: Record<number, string> = {
25-
1: "text-4xl font-bold text-accent",
26-
2: "text-3xl font-bold text-accent",
27-
3: "text-2xl font-bold text-accent",
28-
4: "text-xl font-bold text-accent",
29-
5: "text-lg font-bold text-accent",
30-
6: "font-bold text-accent",
31-
};
32-
return `<h${level}${context.renderAttributes(node)} class="${classes[level] || classes[6]}">${context.renderChildren(node)}</h${level}>`;
33-
},
34-
// Todo: Add more https://github.com/CynthiaWebsiteEngine/Mini/blob/main/cynthia_websites_mini_client/src/cynthia_websites_mini_client/pottery/djotparse.gleam overrides.
35-
},
36-
}) ?? dj
37-
);
14+
return path.normalize(p);
3815
}

package.json

Lines changed: 43 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,45 @@
11
{
2-
"name": "@cynthiaweb/cynthiaweb-mini",
3-
"version": "1.3.0",
4-
"license": "AGPL-3.0-only",
5-
"repository": {
6-
"url": "git+https://github.com/CynthiaWebsiteEngine/Mini.git"
7-
},
8-
"module": "cynthia_websites_mini_server/build/dev/javascript/cynthia_websites_mini_server/cynthia_websites_mini_server.ts",
9-
"bin": {
10-
"cynthiaweb-mini": "dist/cynthia_websites_mini_server.js"
11-
},
12-
"type": "module",
13-
"devDependencies": {
14-
"@types/bun": "latest",
15-
"nodemon": "^3.1.9",
16-
"@types/clean-css": "^4.2.11",
17-
"@types/markdown-it": "^14.1.2",
18-
"@types/moment": "^2.13.0",
19-
"@types/node": "^24.0.0",
20-
"@types/semver": "^7.3.10",
21-
"autoprefixer": "^10.4.20",
22-
"clean-css": "^5.3.3",
23-
"daisyui": "^4.12.23",
24-
"moment": "^2.30.1",
25-
"postcss": "^8.5.1",
26-
"tailwindcss": "3.4.17",
27-
"typescript": "^5.0.0",
28-
"handlebars": "^4.7.8",
29-
"semver": "^7.7.2"
30-
},
31-
"scripts": {
32-
"bundle": "mise run bundle-server",
33-
"check": "mise run check-all",
34-
"clean": "bun ./build.ts clean",
35-
"dev-static": "mise watch run-dev-static-server",
36-
"dev": "mise watch run-dev dynamic",
37-
"format": "mise run fmt-all",
38-
"prepack": "bun run bundle",
39-
"run-in-test": "mise run run-dev",
40-
"test": "mise run test-all"
41-
},
42-
"dependencies": {
43-
"@djot/djot": "^0.3.2",
44-
"cborg": "^4.5.8"
45-
}
2+
"name": "@cynthiaweb/cynthiaweb-mini",
3+
"version": "1.3.0",
4+
"license": "AGPL-3.0-only",
5+
"repository": {
6+
"url": "git+https://github.com/CynthiaWebsiteEngine/Mini.git"
7+
},
8+
"module": "cynthia_websites_mini_server/build/dev/javascript/cynthia_websites_mini_server/cynthia_websites_mini_server.ts",
9+
"bin": {
10+
"cynthiaweb-mini": "dist/cynthia_websites_mini_server.js"
11+
},
12+
"type": "module",
13+
"devDependencies": {
14+
"@types/bun": "latest",
15+
"nodemon": "^3.1.9",
16+
"@types/clean-css": "^4.2.11",
17+
"@types/markdown-it": "^14.1.2",
18+
"@types/moment": "^2.13.0",
19+
"@types/node": "^24.0.0",
20+
"@types/semver": "^7.3.10",
21+
"autoprefixer": "^10.4.20",
22+
"clean-css": "^5.3.3",
23+
"daisyui": "^4.12.23",
24+
"moment": "^2.30.1",
25+
"postcss": "^8.5.1",
26+
"tailwindcss": "3.4.17",
27+
"typescript": "^5.0.0",
28+
"handlebars": "^4.7.8",
29+
"semver": "^7.7.2"
30+
},
31+
"scripts": {
32+
"bundle": "mise run bundle-server",
33+
"check": "mise run check-all",
34+
"clean": "bun ./build.ts clean",
35+
"dev-static": "mise watch run-dev-static-server",
36+
"dev": "mise watch run-dev dynamic",
37+
"format": "mise run fmt-all",
38+
"prepack": "bun run bundle",
39+
"run-in-test": "mise run run-dev",
40+
"test": "mise run test-all"
41+
},
42+
"dependencies": {
43+
"cborg": "^4.5.8"
44+
}
4645
}

0 commit comments

Comments
 (0)