Skip to content

Commit

Permalink
feat: update documentation to v0.15.0 and fix aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
Valerio Ageno committed Nov 30, 2024
1 parent ec4577c commit 835dc77
Show file tree
Hide file tree
Showing 29 changed files with 105 additions and 236 deletions.
2 changes: 1 addition & 1 deletion apps/documentation/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ name = "tuono"
path = ".tuono/main.rs"

[dependencies]
tuono_lib = "0.12.3"
tuono_lib = "0.15.0"
glob = "0.3.1"
time = { version = "0.3", features = ["macros"] }
serde = { version = "1.0.202", features = ["derive"] }
Expand Down
2 changes: 1 addition & 1 deletion apps/documentation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"clsx": "^2.1.1",
"react": "18.3.1",
"react-dom": "18.3.1",
"tuono": "npm:tuono@0.12.3"
"tuono": "npm:tuono@0.15.0"
},
"devDependencies": {
"@types/mdx": "^2.0.13",
Expand Down
4 changes: 2 additions & 2 deletions apps/documentation/src/routes/__root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import {
} from '@mantine/core'
import { useDisclosure } from '@mantine/hooks'
import { Head, useRouter } from 'tuono'
import Navbar from '../components/navbar'
import Navbar from '@/components/navbar'

import '@mantine/core/styles.css'
import '@mantine/code-highlight/styles.css'

import Sidebar from '../components/sidebar'
import Sidebar from '@/components/sidebar'

interface RootRouteProps {
children: ReactNode
Expand Down
4 changes: 2 additions & 2 deletions apps/documentation/src/routes/documentation/__root.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { ReactNode, JSX } from 'react'
import { AppShell, Container } from '@mantine/core'

import MdxProvider from '../../components/mdx-provider'
import EditPage from '../../components/edit-page'
import MdxProvider from '@/components/mdx-provider'
import EditPage from '@/components/edit-page'

interface RootRouteProps {
children: ReactNode
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import MetaTags from '../../components/meta-tags'
import MetaTags from '@/components/meta-tags'

<MetaTags
title="Tuono - Application state"
canonical="https://tuono.dev/documentation/application-state"
description="Learn how to add features to your Tuono application"
/>

import Breadcrumbs, { Element } from '../../components/breadcrumbs'
import Breadcrumbs, { Element } from '@/components/breadcrumbs'

<Breadcrumbs breadcrumbs={[{ label: 'Application state' }]} />

Expand Down
4 changes: 2 additions & 2 deletions apps/documentation/src/routes/documentation/cli.mdx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import MetaTags from '../../components/meta-tags'
import MetaTags from '@/components/meta-tags'

<MetaTags
title="Tuono - CLI"
canonical="https://tuono.dev/documentation/cli"
description="Tuono is the CLI that provides all the needed commands to handle the full-stack project."
/>

import Breadcrumbs, { Element } from '../../components/breadcrumbs'
import Breadcrumbs, { Element } from '@/components/breadcrumbs'

<Breadcrumbs breadcrumbs={[{ label: 'CLI' }]} />

Expand Down
4 changes: 2 additions & 2 deletions apps/documentation/src/routes/documentation/contributing.mdx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import MetaTags from '../../components/meta-tags'
import MetaTags from '@/components/meta-tags'

<MetaTags
title="Tuono - Contributing"
canonical="https://tuono.dev/documentation/contributing"
description="The project is massive - if you like it, do consider contributing!"
/>

import Breadcrumbs, { Element } from '../../components/breadcrumbs'
import Breadcrumbs, { Element } from '@/components/breadcrumbs'

<Breadcrumbs breadcrumbs={[{ label: '✨ Contributing' }]} />

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import MetaTags from '../../../components/meta-tags'
import MetaTags from '@/components/meta-tags'

<MetaTags
title="Tuono - Contributing"
canonical="https://tuono.dev/documentation/contributing"
description="The project is massive - if you like it, do consider contributing!"
/>

import Breadcrumbs, { Element } from '../../../components/breadcrumbs'
import Breadcrumbs, { Element } from '@/components/breadcrumbs'

<Breadcrumbs breadcrumbs={[{ label: '✨ Contributing' }]} />

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import MetaTags from '../../../components/meta-tags'
import MetaTags from '@/components/meta-tags'

<MetaTags
title="Tuono - Contributing - Local development"
canonical="https://tuono.dev/documentation/contributing/local-development"
description="Contribute to Tuono. Learn here how to setup the repository for local development"
/>

import Breadcrumbs, { Element } from '../../../components/breadcrumbs'
import Breadcrumbs, { Element } from '@/components/breadcrumbs'

<Breadcrumbs
breadcrumbs={[
Expand Down
4 changes: 2 additions & 2 deletions apps/documentation/src/routes/documentation/index.mdx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import MetaTags from '../../components/meta-tags'
import MetaTags from '@/components/meta-tags'

<MetaTags
title="Tuono - Documentation"
canonical="https://tuono.dev/documentation"
description="Tuono is a full-stack framework for building React applications using Rust as the backend."
/>

import Breadcrumbs from '../../components/breadcrumbs'
import Breadcrumbs from '@/components/breadcrumbs'

<Breadcrumbs />

Expand Down
4 changes: 2 additions & 2 deletions apps/documentation/src/routes/documentation/installation.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Breadcrumbs, { Element } from '../../components/breadcrumbs'
import Breadcrumbs, { Element } from '@/components/breadcrumbs'

import MetaTags from '../../components/meta-tags'
import MetaTags from '@/components/meta-tags'

<MetaTags
title="Tuono - Installation"
Expand Down
4 changes: 2 additions & 2 deletions apps/documentation/src/routes/documentation/routing/index.mdx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import MetaTags from '../../../components/meta-tags'
import MetaTags from '@/components/meta-tags'

<MetaTags
title="Tuono - Routing"
canonical="https://tuono.dev/documentation/routing/intro"
/>

import Breadcrumbs, { Element } from '../../../components/breadcrumbs'
import Breadcrumbs, { Element } from '@/components/breadcrumbs'

<Breadcrumbs breadcrumbs={[{ label: 'Routing' }]} />

Expand Down
4 changes: 2 additions & 2 deletions apps/documentation/src/routes/documentation/routing/intro.mdx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import MetaTags from '../../../components/meta-tags'
import MetaTags from '@/components/meta-tags'

<MetaTags
title="Tuono - Routing"
canonical="https://tuono.dev/documentation/routing"
/>

import Breadcrumbs, { Element } from '../../../components/breadcrumbs'
import Breadcrumbs, { Element } from '@/components/breadcrumbs'

<Breadcrumbs
breadcrumbs={[
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import MetaTags from '../../../components/meta-tags'
import MetaTags from '@/components/meta-tags'

<MetaTags
title="Tuono - API fetching"
canonical="https://tuono.dev/documentation/tutorial/api-fetching"
description="Learn how to fetch remote APIs on the backend"
/>

import Breadcrumbs, { Element } from '../../../components/breadcrumbs'
import Breadcrumbs, { Element } from '@/components/breadcrumbs'

<Breadcrumbs
breadcrumbs={[
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import MetaTags from '../../../components/meta-tags'
import MetaTags from '@/components/meta-tags'

<MetaTags
title="Tuono - Components"
canonical="https://tuono.dev/documentation/tutorial/components"
description="Learn how to manage the components in a Tuono codebase"
/>

import Breadcrumbs, { Element } from '../../../components/breadcrumbs'
import Breadcrumbs, { Element } from '@/components/breadcrumbs'

<Breadcrumbs
breadcrumbs={[
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import MetaTags from '../../../components/meta-tags'
import MetaTags from '@/components/meta-tags'

<MetaTags
title="Tuono - Conclusion"
canonical="https://tuono.dev/documentation/tutorial/conclusion"
description="You just created a multi thread full stack application with Rust and React"
/>

import Breadcrumbs, { Element } from '../../../components/breadcrumbs'
import Breadcrumbs, { Element } from '@/components/breadcrumbs'

<Breadcrumbs
breadcrumbs={[
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import MetaTags from '../../../components/meta-tags'
import MetaTags from '@/components/meta-tags'

<MetaTags
title="Tuono - Development setup"
canonical="https://tuono.dev/documentation/tutorial/development-setup"
description="Learn how to setup a new Tuono project"
/>

import Breadcrumbs, { Element } from '../../../components/breadcrumbs'
import Breadcrumbs, { Element } from '@/components/breadcrumbs'

<Breadcrumbs
breadcrumbs={[
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import MetaTags from '../../../components/meta-tags'
import MetaTags from '@/components/meta-tags'

<MetaTags
title="Tuono - Dynamic routes"
canonical="https://tuono.dev/documentation/tutorial/dynamic-routes"
description="Learn how to catch more endpoint with the same route loading dynamic data"
/>

import Breadcrumbs, { Element } from '../../../components/breadcrumbs'
import Breadcrumbs, { Element } from '@/components/breadcrumbs'

<Breadcrumbs
breadcrumbs={[
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import MetaTags from '../../../components/meta-tags'
import MetaTags from '@/components/meta-tags'

<MetaTags
title="Tuono - Error handling"
canonical="https://tuono.dev/documentation/tutorial/error-handling"
description="Learn how to handle the server side error on your Tuono project"
/>

import Breadcrumbs, { Element } from '../../../components/breadcrumbs'
import Breadcrumbs, { Element } from '@/components/breadcrumbs'

<Breadcrumbs
breadcrumbs={[
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import MetaTags from '../../../components/meta-tags'
import MetaTags from '@/components/meta-tags'

<MetaTags
title="Tuono - Tutorial"
canonical="https://tuono.dev/documentation/tutorial"
description="This tutorial is meant to give you a sneak peek at the framework and is intended to evolve during the development - be sure to have installed the latest version"
/>

import Breadcrumbs, { Element } from '../../../components/breadcrumbs'
import Breadcrumbs, { Element } from '@/components/breadcrumbs'

<Breadcrumbs breadcrumbs={[{ label: 'Tutorial' }]} />

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import MetaTags from '../../../components/meta-tags'
import MetaTags from '@/components/meta-tags'

<MetaTags
title="Tuono - Building for production"
canonical="https://tuono.dev/documentation/tutorial/production"
description="Learn how to build the production project and run the optimize version"
/>

import Breadcrumbs, { Element } from '../../../components/breadcrumbs'
import Breadcrumbs, { Element } from '@/components/breadcrumbs'

<Breadcrumbs
breadcrumbs={[
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import MetaTags from '../../../components/meta-tags'
import MetaTags from '@/components/meta-tags'

<MetaTags
title="Tuono - Redirection"
canonical="https://tuono.dev/documentation/tutorial/redirections"
description="Learn how to redirect to different route from the server"
/>

import Breadcrumbs, { Element } from '../../../components/breadcrumbs'
import Breadcrumbs, { Element } from '@/components/breadcrumbs'

<Breadcrumbs
breadcrumbs={[
Expand Down
4 changes: 2 additions & 2 deletions apps/documentation/src/routes/documentation/tutorial/seo.mdx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import MetaTags from '../../../components/meta-tags'
import MetaTags from '@/components/meta-tags'

<MetaTags
title="Tuono - SEO and meta tags"
canonical="https://tuono.dev/documentation/tutorial/seo"
description="Learn how to handle meaningful meta tags for your Tuono project"
/>

import Breadcrumbs, { Element } from '../../../components/breadcrumbs'
import Breadcrumbs, { Element } from '@/components/breadcrumbs'

<Breadcrumbs
breadcrumbs={[
Expand Down
4 changes: 2 additions & 2 deletions apps/documentation/src/routes/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { JSX } from 'react'

import Hero from '../components/hero'
import MetaTags from '../components/meta-tags'
import Hero from '@/components/hero'
import MetaTags from '@/components/meta-tags'

export default function IndexPage(): JSX.Element {
return (
Expand Down
30 changes: 20 additions & 10 deletions apps/documentation/src/routes/sitemap.xml.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
use tuono_lib::reqwest::StatusCode;
use tuono_lib::{Request, Response};
use tuono_lib::axum::http::{header, HeaderMap};
use glob::glob;
use time::OffsetDateTime;
use tuono_lib::axum::http::{header, HeaderMap, StatusCode};
use tuono_lib::{Request, Response};

const FILE_TO_EXCLUDE: [&str; 2] = ["sitemap.xml", "__root"];

Expand All @@ -14,11 +13,17 @@ const SITEMAP: &str = r#"<?xml version="1.0" encoding="UTF-8"?>
fn load_routes() -> Vec<String> {
let mut paths: Vec<String> = vec![];

for entry in glob("./src/routes/**/*").expect("Failed to glob src/routes folder").flatten() {
for entry in glob("./src/routes/**/*")
.expect("Failed to glob src/routes folder")
.flatten()
{
if !entry.is_dir() {
let path = clean_path(format!("/{}", entry.to_string_lossy()));

if !FILE_TO_EXCLUDE.iter().any(|exclude| path.ends_with(exclude)) {
if !FILE_TO_EXCLUDE
.iter()
.any(|exclude| path.ends_with(exclude))
{
paths.push(path)
}
}
Expand Down Expand Up @@ -51,11 +56,16 @@ async fn generate_sitemap(_req: Request) -> Response {
url.pop();
}

sitemaps.push_str(
&format!(r#"<url><loc>{}</loc><lastmod>{}</lastmod></url>"#,url, OffsetDateTime::now_utc().date())
)
sitemaps.push_str(&format!(
r#"<url><loc>{}</loc><lastmod>{}</lastmod></url>"#,
url,
OffsetDateTime::now_utc().date()
))
}

Response::Custom((StatusCode::OK, headers, SITEMAP.replace("[PLACEHOLDER]", &sitemaps)))
Response::Custom((
StatusCode::OK,
headers,
SITEMAP.replace("[PLACEHOLDER]", &sitemaps),
))
}

5 changes: 4 additions & 1 deletion apps/documentation/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
"noFallthroughCasesInSwitch": true,
"paths": {
"@/*": ["./src/*"]
}
},
"include": ["src"],
"references": [{ "path": "./tsconfig.node.json" }]
Expand Down
Loading

0 comments on commit 835dc77

Please sign in to comment.