Skip to content

Commit 7fdc2c9

Browse files
committed
Use linwood styles for docs
1 parent 16df83b commit 7fdc2c9

File tree

10 files changed

+331
-159
lines changed

10 files changed

+331
-159
lines changed

Cargo.lock

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

api/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
[package]
22
name = "luna_api"
33
version = "0.1.0"
4-
edition = "2021"
4+
edition = "2024"
55

66
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
77

88
[dependencies]
99
serde = { version = "1", features = ["derive"] }
1010
serde_json = "1"
11+
toml = "0.8"

api/src/models/asset.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use crate::models::Named;
22
use serde::{Deserialize, Serialize};
3+
use toml::value::Datetime;
34

45
// Path: content/{author}/{name}/asset.toml
56
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
@@ -23,6 +24,7 @@ pub struct Asset {
2324
pub struct Version {
2425
pub name: String,
2526
pub changes: String,
27+
pub published: Option<Datetime>,
2628
pub download_url: String,
2729
pub sha256: String,
2830
pub blake3: Option<String>,

cli/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
/target
2+
/node_modules
3+
/assets/public/main.css
24
example/index.json

cli/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "luna_cli"
33
version = "0.1.0"
4-
edition = "2021"
4+
edition = "2024"
55

66
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
77

@@ -10,7 +10,7 @@ clap = { version = "4", features = ["derive"] }
1010
luna_api = { path = "../api" }
1111
toml = "0.8"
1212
serde = { version = "1", features = ["derive"] }
13-
thiserror = "1"
13+
thiserror = "2"
1414
serde_json = "1"
15-
handlebars = { version = "4", features = ["rust-embed"] }
15+
handlebars = { version = "6", features = ["rust-embed"] }
1616
rust-embed = { version = "8", features = ["include-exclude"] }

cli/build.rs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
use std::env;
2+
use std::fs;
3+
use std::path::PathBuf;
4+
5+
fn main() -> Result<(), Box<dyn std::error::Error>> {
6+
let project_root = PathBuf::from(env::var("CARGO_MANIFEST_DIR")?);
7+
let out_dir = PathBuf::from(env::var("OUT_DIR")?);
8+
9+
// Define the source path
10+
let source_path = project_root.join("node_modules/@linwooddev/style/css/main.css");
11+
12+
// Define the destination path in the output directory
13+
let destination_path = out_dir.join("main.css");
14+
15+
// Copy the file to the output directory
16+
fs::copy(&source_path, &destination_path)?;
17+
18+
// We still want to copy to the public directory for rust_embed
19+
let public_destination_path = project_root.join("assets/public/main.css");
20+
fs::create_dir_all(public_destination_path.parent().unwrap())?;
21+
fs::copy(&source_path, &public_destination_path)?;
22+
23+
println!("cargo:rerun-if-changed={}", source_path.display());
24+
println!("cargo:rerun-if-changed=public");
25+
26+
Ok(())
27+
}

cli/package.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"name": "cli",
3+
"version": "1.0.0",
4+
"description": "",
5+
"main": "index.js",
6+
"scripts": {
7+
"test": "echo \"Error: no test specified\" && exit 1"
8+
},
9+
"keywords": [],
10+
"author": "",
11+
"license": "ISC",
12+
"packageManager": "[email protected]",
13+
"dependencies": {
14+
"@linwooddev/style": "^0.4.2"
15+
}
16+
}

cli/pnpm-lock.yaml

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

cli/src/directory.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,6 @@ pub trait ModelDirectory<T>
5050

5151
Ok(model)
5252
}
53-
fn valid_model(&self) -> bool {
54-
self.is_valid() && self.model().is_ok()
55-
}
5653
}
5754

5855
impl RepositoryDirectory {

cli/src/docs.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,21 @@ pub fn generate_docs(data: &RepositoryData, output : String) -> Result<(), DocsE
6363
Ok(())
6464
}
6565

66+
fn copy_public(output : &str) -> Result<(), DocsError> {
67+
for file in Public::iter() {
68+
let path = file.as_ref();
69+
let content = Public::get(path).unwrap();
70+
let path = format!("{}/{}", output, path);
71+
let path = Path::new(&path);
72+
if let Some(parent) = path.parent() {
73+
fs::create_dir_all(parent)?;
74+
}
75+
let mut file = fs::File::create(path)?;
76+
file.write_all(&content.data)?;
77+
}
78+
Ok(())
79+
}
80+
6681
fn render_static(name : &str, data: &RepositoryData, hb: &Handlebars, output : &str) -> Result<(), DocsError> {
6782
let context: &Value = &json!({
6883
"info": data.info

0 commit comments

Comments
 (0)