Compare commits

...

17 Commits

Author SHA1 Message Date
Valerio Ageno 7401a59346 update version to v0.2.5 2024-06-27 17:53:12 +02:00
Valerio Ageno 622ae93d68 fix: crates categories 2024-06-27 17:52:32 +02:00
Valerio Ageno b4207feb7e Update version to v0.2.4 2024-06-27 17:47:09 +02:00
Valerio Ageno 332fdb70ca Update ssr_rs to v0.5.5 2024-06-27 17:46:19 +02:00
Valerio Ageno b9abfb64c0 feat: update version to v0.2.3 2024-06-25 18:53:17 +02:00
Valerio Ageno 3ca8861d85 feat: use the correct public folder according to the mode 2024-06-25 18:48:55 +02:00
Valerio Ageno 0c93aab13f Update tutorial.md 2024-06-25 14:26:27 +02:00
Valerio Ageno 208b49cfc8 Update tutorial.md 2024-06-25 14:26:01 +02:00
Valerio Ageno db0a2d9d1d Update README.md 2024-06-25 14:24:59 +02:00
Valerio Ageno c123e93433 Update scaffold_project.rs 2024-06-25 14:23:22 +02:00
Valerio Ageno 35557d296d feat: update version to v0.2.2 2024-06-25 08:35:09 +02:00
Gábor Szabó d0d6550d7e It is better to use the repository field in Cargo.toml (#7) 2024-06-25 07:42:04 +02:00
Valerio Ageno 38d9be2bb0 feat: update version to v0.2.1 2024-06-24 17:41:34 +02:00
Valerio Ageno fcb33d208c fix: format tuono_lib_macros 2024-06-24 17:38:37 +02:00
Valerio Ageno f831ad6c7a feat: add lint and fmt checks on rust pipelines 2024-06-24 17:37:18 +02:00
Valerio Ageno 3bfed5fabc feat: update launch log according to mode 2024-06-24 17:32:40 +02:00
Valerio Ageno e1ce3ba2fd Update tutorial.md 2024-06-24 09:03:06 +02:00
11 changed files with 61 additions and 26 deletions
+9
View File
@@ -14,6 +14,15 @@ env:
CARGO_TERM_COLOR: always
jobs:
lint_and_fmt:
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: cargo fmt --all -- --check
- run: cargo clippy -- -D warnings
build_and_test:
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
name: Build and test rust crates
+3 -1
View File
@@ -74,7 +74,9 @@ Now to execute it just run `cargo run --release`.
- rust
- cargo
- node
- pnpm (other package managers support will be added soon)
- npm/pnpm/yarn*
> yarn [pnp](https://yarnpkg.com/features/pnp) is not supported yet
## Folder structure
+3 -3
View File
@@ -1,13 +1,13 @@
[package]
name = "tuono"
version = "0.2.0"
version = "0.2.5"
edition = "2021"
authors = ["V. Ageno <valerioageno@yahoo.it>"]
description = "The react/rust fullstack framework"
homepage = "https://github.com/Valerioageno/tuono"
repository = "https://github.com/Valerioageno/tuono"
readme = "../../README.md"
license-file = "../../LICENSE.md"
categories = ["web-programming", "reactjs", "typescript", "framework", "fullstack"]
categories = ["web-programming"]
include = [
"src/*.rs",
"Cargo.toml"
+1 -1
View File
@@ -165,7 +165,7 @@ fn outro(folder_name: String) {
}
println!("\nInstall the dependencies:");
println!("pnpm install");
println!("npm install");
println!("\nRun the local environment:");
println!("tuono dev");
+31 -5
View File
@@ -73,15 +73,16 @@ async fn main() {
let app = Router::new()
// ROUTE_BUILDER
.fallback_service(
ServeDir::new("public"))
.fallback_service(ServeDir::new("out/client")
.fallback(get(catch_all)))
.fallback_service(ServeDir::new("/*public_dir*/").fallback(get(catch_all)))
.with_state(fetch);
let listener = tokio::net::TcpListener::bind("0.0.0.0:3000").await.unwrap();
println!("\nDevelopment app ready at http://localhost:3000/");
if MODE == Mode::Dev {
println!("\nDevelopment app ready at http://localhost:3000/");
} else {
println!("\nProduction app ready at http://localhost:3000/");
}
axum::serve(listener, app).await.unwrap();
}
@@ -108,6 +109,8 @@ async fn catch_all(Path(params): Path<HashMap<String, String>>, request: Request
const ROOT_FOLDER: &str = "src/routes";
const DEV_FOLDER: &str = ".tuono";
const DEV_PUBLIC_DIR: &str = "public";
const PROD_PUBLIC_DIR: &str = "out/client";
#[derive(Debug, PartialEq, Eq)]
struct Route {
@@ -251,6 +254,12 @@ pub fn bundle_axum_source(mode: Mode) -> io::Result<()> {
}
fn generate_axum_source(source_builder: &SourceBuilder, mode: Mode) -> String {
let public_dir = if mode == Mode::Prod {
PROD_PUBLIC_DIR
} else {
DEV_PUBLIC_DIR
};
AXUM_ENTRY_POINT
.replace(
"// ROUTE_BUILDER\n",
@@ -260,6 +269,7 @@ fn generate_axum_source(source_builder: &SourceBuilder, mode: Mode) -> String {
"// MODULE_IMPORTS\n",
&create_modules_declaration(&source_builder.route_map),
)
.replace("/*public_dir*/", public_dir)
.replace("/*MODE*/", mode.as_str())
}
@@ -400,4 +410,20 @@ mod tests {
assert_eq!(dev, "Mode::Dev");
assert_eq!(prod, "Mode::Prod");
}
#[test]
fn should_replace_the_correct_public_folder_dev() {
let source_builder = SourceBuilder::new();
let source = generate_axum_source(&source_builder, Mode::Dev);
assert!(source.contains(r#"ServeDir::new("public")"#))
}
#[test]
fn should_replace_the_correct_public_folder_prod() {
let source_builder = SourceBuilder::new();
let source = generate_axum_source(&source_builder, Mode::Prod);
assert!(source.contains(r#"ServeDir::new("out/client")"#))
}
}
+5 -5
View File
@@ -1,13 +1,13 @@
[package]
name = "tuono_lib"
version = "0.2.0"
version = "0.2.5"
edition = "2021"
authors = ["V. Ageno <valerioageno@yahoo.it>"]
description = "The react/rust fullstack framework"
homepage = "https://github.com/Valerioageno/tuono"
repository = "https://github.com/Valerioageno/tuono"
readme = "../../README.md"
license-file = "../../LICENSE.md"
categories = ["web-programming", "reactjs", "typescript", "framework", "fullstack"]
categories = ["web-programming"]
include = [
"src/*.rs",
"Cargo.toml"
@@ -18,13 +18,13 @@ name = "tuono_lib"
path = "src/lib.rs"
[dependencies]
ssr_rs = "0.5.4"
ssr_rs = "0.5.5"
axum = "0.7.5"
serde = { version = "1.0.202", features = ["derive"] }
erased-serde = "0.4.5"
serde_json = "1.0"
tuono_lib_macros = {path = "../tuono_lib_macros", version = "0.2.0"}
tuono_lib_macros = {path = "../tuono_lib_macros", version = "0.2.5"}
once_cell = "1.19.0"
lazy_static = "1.5.0"
regex = "1.10.5"
+3 -3
View File
@@ -1,12 +1,12 @@
[package]
name = "tuono_lib_macros"
version = "0.2.0"
version = "0.2.5"
edition = "2021"
description = "The react/rust fullstack framework"
homepage = "https://github.com/Valerioageno/tuono"
repository = "https://github.com/Valerioageno/tuono"
readme = "../../README.md"
license-file = "../../LICENSE.md"
categories = ["web-programming", "reactjs", "typescript", "framework", "fullstack"]
categories = ["web-programming"]
include = [
"src/*.rs",
"Cargo.toml"
-2
View File
@@ -7,5 +7,3 @@ mod handler;
pub fn handler(args: TokenStream, item: TokenStream) -> TokenStream {
handler::handler_core(args, item)
}
+4 -4
View File
@@ -5,8 +5,8 @@ This tutorial is meant for giving you a sneak peek of the framework and is inten
The first part is about the project setup and the base knowledge needed to work with tuono. The actual tutorial starts at [Tutorial introduction](#tutorial-introduction).
> I'd love to hear your thoughts about the framework and the tutorial - feel free to reach me
at [valerioageno@yahoo.it](mailto:valerioageno@yahoo.it) or in Twitter (X) DMs
[@valerioageno](https://twitter.com/valerioageno
at [valerioageno@yahoo.it](mailto:valerioageno@yahoo.it) or on Twitter (X) DMs
[@valerioageno](https://twitter.com/valerioageno)
This tutorial is **not meant** for people that don't know React - in that case I suggest you to first read the [React doc](https://react.dev/);
@@ -53,7 +53,7 @@ $ tuono new tuono-tutorial
Get into the project folder and install the dependencies with:
```bash
$ pnpm install
$ npm install
```
Open it with your favourite code editor.
@@ -283,7 +283,7 @@ Create alongside the `PokemonLink.tsx` component the CSS module `PokemonLink.mod
}
```
> 💡 SASS is supported out of the box. Just install the processor in the devDependencies `pnpm i -D sass` and run again `tuono dev`
> 💡 SASS is supported out of the box. Just install the processor in the devDependencies `npm i -D sass` and run again `tuono dev`
Then import the styles into the `PokemonLink` component as following:
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "tuono-lazy-fn-vite-plugin",
"version": "0.2.0",
"version": "0.2.5",
"description": "Plugin for the tuono's lazy fn. Tuono is the react/rust fullstack framework",
"scripts": {
"dev": "vite build --watch",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "tuono",
"version": "0.2.0",
"version": "0.2.5",
"description": "The react/rust fullstack framework",
"scripts": {
"dev": "vite build --watch",