From 89d7a2c74082186e86b97781439ecfe4960450d5 Mon Sep 17 00:00:00 2001 From: Marco Pasqualetti <24919330+marcalexiei@users.noreply.github.com> Date: Wed, 20 Nov 2024 13:46:31 +0100 Subject: [PATCH] chore: add `examples` folder to workspaces and make examples packages name unique (#125) --- Cargo.toml | 6 +- .../routes/documentation/tutorial/index.mdx | 2 +- crates/tuono/src/scaffold_project.rs | 2 +- examples/README.md | 11 --- examples/{mdx => tuono-app}/.gitignore | 0 examples/{tuono => tuono-app}/Cargo.toml | 2 +- examples/{mdx => tuono-app}/README.md | 0 examples/{tuono => tuono-app}/package.json | 4 +- .../{tuono => tuono-app}/public/favicon.ico | Bin .../{tuono => tuono-app}/public/react.svg | 0 examples/{tuono => tuono-app}/public/rust.svg | 0 .../src/routes/__root.tsx | 0 .../{tuono => tuono-app}/src/routes/index.rs | 0 .../{tuono => tuono-app}/src/routes/index.tsx | 0 .../src/styles/global.css | 2 +- examples/{mdx => tuono-app}/tsconfig.json | 0 .../{mdx => tuono-app}/tsconfig.node.json | 0 examples/{tuono => tuono-tutorial}/.gitignore | 0 .../{tutorial => tuono-tutorial}/Cargo.toml | 2 +- examples/tuono-tutorial/README.md | 9 +++ .../{tutorial => tuono-tutorial}/package.json | 2 +- .../public/favicon.ico | Bin .../public/react.svg | 0 .../public/rust.svg | 0 .../src/components/PokemonLink.module.css | 0 .../src/components/PokemonLink.tsx | 0 .../src/components/PokemonView.module.css | 0 .../src/components/PokemonView.tsx | 0 .../{tutorial => tuono-tutorial}/src/main.rs | 0 .../src/routes/__root.tsx | 0 .../src/routes/index.rs | 0 .../src/routes/index.tsx | 0 .../src/routes/pokemons/GOAT.rs | 0 .../src/routes/pokemons/[pokemon].rs | 0 .../src/routes/pokemons/[pokemon].tsx | 0 .../src/styles/global.css | 0 .../{tuono => tuono-tutorial}/tsconfig.json | 0 .../tsconfig.node.json | 0 examples/tutorial/README.md | 9 --- examples/{tutorial => with-mdx}/.gitignore | 0 examples/{mdx => with-mdx}/Cargo.toml | 2 +- examples/{tuono => with-mdx}/README.md | 0 examples/{mdx => with-mdx}/package.json | 4 +- .../{tutorial => with-mdx}/public/favicon.ico | Bin .../{mdx => with-mdx}/src/routes/__root.tsx | 0 .../{mdx => with-mdx}/src/routes/index.mdx | 0 .../{tuono => with-mdx}/src/styles/global.css | 0 examples/{tutorial => with-mdx}/tsconfig.json | 0 .../{tutorial => with-mdx}/tsconfig.node.json | 0 package.json | 2 +- pnpm-lock.yaml | 69 ++++++++++++++++++ pnpm-workspace.yaml | 2 +- 52 files changed, 94 insertions(+), 36 deletions(-) rename examples/{mdx => tuono-app}/.gitignore (100%) rename examples/{tuono => tuono-app}/Cargo.toml (91%) rename examples/{mdx => tuono-app}/README.md (100%) rename examples/{tuono => tuono-app}/package.json (77%) rename examples/{tuono => tuono-app}/public/favicon.ico (100%) rename examples/{tuono => tuono-app}/public/react.svg (100%) rename examples/{tuono => tuono-app}/public/rust.svg (100%) rename examples/{tuono => tuono-app}/src/routes/__root.tsx (100%) rename examples/{tuono => tuono-app}/src/routes/index.rs (100%) rename examples/{tuono => tuono-app}/src/routes/index.tsx (100%) rename examples/{tutorial => tuono-app}/src/styles/global.css (98%) rename examples/{mdx => tuono-app}/tsconfig.json (100%) rename examples/{mdx => tuono-app}/tsconfig.node.json (100%) rename examples/{tuono => tuono-tutorial}/.gitignore (100%) rename examples/{tutorial => tuono-tutorial}/Cargo.toml (90%) create mode 100644 examples/tuono-tutorial/README.md rename examples/{tutorial => tuono-tutorial}/package.json (82%) rename examples/{mdx => tuono-tutorial}/public/favicon.ico (100%) rename examples/{tutorial => tuono-tutorial}/public/react.svg (100%) rename examples/{tutorial => tuono-tutorial}/public/rust.svg (100%) rename examples/{tutorial => tuono-tutorial}/src/components/PokemonLink.module.css (100%) rename examples/{tutorial => tuono-tutorial}/src/components/PokemonLink.tsx (100%) rename examples/{tutorial => tuono-tutorial}/src/components/PokemonView.module.css (100%) rename examples/{tutorial => tuono-tutorial}/src/components/PokemonView.tsx (100%) rename examples/{tutorial => tuono-tutorial}/src/main.rs (100%) rename examples/{tutorial => tuono-tutorial}/src/routes/__root.tsx (100%) rename examples/{tutorial => tuono-tutorial}/src/routes/index.rs (100%) rename examples/{tutorial => tuono-tutorial}/src/routes/index.tsx (100%) rename examples/{tutorial => tuono-tutorial}/src/routes/pokemons/GOAT.rs (100%) rename examples/{tutorial => tuono-tutorial}/src/routes/pokemons/[pokemon].rs (100%) rename examples/{tutorial => tuono-tutorial}/src/routes/pokemons/[pokemon].tsx (100%) rename examples/{mdx => tuono-tutorial}/src/styles/global.css (100%) rename examples/{tuono => tuono-tutorial}/tsconfig.json (100%) rename examples/{tuono => tuono-tutorial}/tsconfig.node.json (100%) delete mode 100644 examples/tutorial/README.md rename examples/{tutorial => with-mdx}/.gitignore (100%) rename examples/{mdx => with-mdx}/Cargo.toml (92%) rename examples/{tuono => with-mdx}/README.md (100%) rename examples/{mdx => with-mdx}/package.json (79%) rename examples/{tutorial => with-mdx}/public/favicon.ico (100%) rename examples/{mdx => with-mdx}/src/routes/__root.tsx (100%) rename examples/{mdx => with-mdx}/src/routes/index.mdx (100%) rename examples/{tuono => with-mdx}/src/styles/global.css (100%) rename examples/{tutorial => with-mdx}/tsconfig.json (100%) rename examples/{tutorial => with-mdx}/tsconfig.node.json (100%) diff --git a/Cargo.toml b/Cargo.toml index d7671b8b..6f543623 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,8 +7,8 @@ members = [ ] exclude = [ "apps/documentation", - "examples/mdx", - "examples/tuono", - "examples/tutorial", + "examples/wit-mdx", + "examples/tuono-app", + "examples/tuono-tutorial", "benches/tuono" ] diff --git a/apps/documentation/src/routes/documentation/tutorial/index.mdx b/apps/documentation/src/routes/documentation/tutorial/index.mdx index ae6e7757..396773f4 100644 --- a/apps/documentation/src/routes/documentation/tutorial/index.mdx +++ b/apps/documentation/src/routes/documentation/tutorial/index.mdx @@ -21,7 +21,7 @@ This tutorial is not meant for people who don't know React - in that case, I sug If you prefer to just read the code rather than write you can download the finished tutorial project with: ```bash -$ tuono new tutorial --template tutorial +$ tuono new tutorial --template tuono-tutorial ``` > I'd love to hear your thoughts about the framework and the tutorial - feel free to reach me at [valerioageno@yahoo.it](mailto:valerioageno@ahoo.it) diff --git a/crates/tuono/src/scaffold_project.rs b/crates/tuono/src/scaffold_project.rs index 37825ca5..e4bce0a4 100644 --- a/crates/tuono/src/scaffold_project.rs +++ b/crates/tuono/src/scaffold_project.rs @@ -42,7 +42,7 @@ pub fn create_new_project(folder_name: Option, template: Option) let folder = folder_name.unwrap_or(".".to_string()); // In case of missing select the tuono example - let template = template.unwrap_or("tuono".to_string()); + let template = template.unwrap_or("tuono-app".to_string()); let client = blocking::Client::builder() .user_agent("") diff --git a/examples/README.md b/examples/README.md index cf8a0f31..e9f7610d 100644 --- a/examples/README.md +++ b/examples/README.md @@ -15,14 +15,3 @@ $ tuono new [NAME] --template [TEMPLATE] ``` `[TEMPLATE]` is the folder name. - -## Troubleshooting for contributors - -There is a common error that happens during example development due to -pnpm workspace about the findings of different react versions. - -To overcome this issue run within the single example folder: - -``` -pnpm install --ignore-workspace && pnpm upgrade --save -``` diff --git a/examples/mdx/.gitignore b/examples/tuono-app/.gitignore similarity index 100% rename from examples/mdx/.gitignore rename to examples/tuono-app/.gitignore diff --git a/examples/tuono/Cargo.toml b/examples/tuono-app/Cargo.toml similarity index 91% rename from examples/tuono/Cargo.toml rename to examples/tuono-app/Cargo.toml index e4487952..6853b25c 100644 --- a/examples/tuono/Cargo.toml +++ b/examples/tuono-app/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "tuono" +name = "tuono-app" version = "0.0.1" edition = "2021" diff --git a/examples/mdx/README.md b/examples/tuono-app/README.md similarity index 100% rename from examples/mdx/README.md rename to examples/tuono-app/README.md diff --git a/examples/tuono/package.json b/examples/tuono-app/package.json similarity index 77% rename from examples/tuono/package.json rename to examples/tuono-app/package.json index 9e0d88d3..2c278801 100644 --- a/examples/tuono/package.json +++ b/examples/tuono-app/package.json @@ -1,6 +1,6 @@ { - "name": "tuono", - "description": "The react/rust fullstack framework", + "name": "tuono-app", + "description": "Basic tuono application", "version": "0.0.1", "dependencies": { "react": "18.3.1", diff --git a/examples/tuono/public/favicon.ico b/examples/tuono-app/public/favicon.ico similarity index 100% rename from examples/tuono/public/favicon.ico rename to examples/tuono-app/public/favicon.ico diff --git a/examples/tuono/public/react.svg b/examples/tuono-app/public/react.svg similarity index 100% rename from examples/tuono/public/react.svg rename to examples/tuono-app/public/react.svg diff --git a/examples/tuono/public/rust.svg b/examples/tuono-app/public/rust.svg similarity index 100% rename from examples/tuono/public/rust.svg rename to examples/tuono-app/public/rust.svg diff --git a/examples/tuono/src/routes/__root.tsx b/examples/tuono-app/src/routes/__root.tsx similarity index 100% rename from examples/tuono/src/routes/__root.tsx rename to examples/tuono-app/src/routes/__root.tsx diff --git a/examples/tuono/src/routes/index.rs b/examples/tuono-app/src/routes/index.rs similarity index 100% rename from examples/tuono/src/routes/index.rs rename to examples/tuono-app/src/routes/index.rs diff --git a/examples/tuono/src/routes/index.tsx b/examples/tuono-app/src/routes/index.tsx similarity index 100% rename from examples/tuono/src/routes/index.tsx rename to examples/tuono-app/src/routes/index.tsx diff --git a/examples/tutorial/src/styles/global.css b/examples/tuono-app/src/styles/global.css similarity index 98% rename from examples/tutorial/src/styles/global.css rename to examples/tuono-app/src/styles/global.css index 84fc0842..3d023a4f 100644 --- a/examples/tutorial/src/styles/global.css +++ b/examples/tuono-app/src/styles/global.css @@ -23,7 +23,7 @@ body { } main { - width: 673px; + max-width: 673px; margin: 20px auto; } diff --git a/examples/mdx/tsconfig.json b/examples/tuono-app/tsconfig.json similarity index 100% rename from examples/mdx/tsconfig.json rename to examples/tuono-app/tsconfig.json diff --git a/examples/mdx/tsconfig.node.json b/examples/tuono-app/tsconfig.node.json similarity index 100% rename from examples/mdx/tsconfig.node.json rename to examples/tuono-app/tsconfig.node.json diff --git a/examples/tuono/.gitignore b/examples/tuono-tutorial/.gitignore similarity index 100% rename from examples/tuono/.gitignore rename to examples/tuono-tutorial/.gitignore diff --git a/examples/tutorial/Cargo.toml b/examples/tuono-tutorial/Cargo.toml similarity index 90% rename from examples/tutorial/Cargo.toml rename to examples/tuono-tutorial/Cargo.toml index e36032a7..409d7c1a 100644 --- a/examples/tutorial/Cargo.toml +++ b/examples/tuono-tutorial/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "tuono" +name = "tuono-tutorial" version = "0.0.1" edition = "2021" diff --git a/examples/tuono-tutorial/README.md b/examples/tuono-tutorial/README.md new file mode 100644 index 00000000..36d8c7e1 --- /dev/null +++ b/examples/tuono-tutorial/README.md @@ -0,0 +1,9 @@ +# Tuono tutorial + +This project is the outcome of the [tuono tutorial](https://tuono.dev/documentation/tutorial) + +If you want to directly install it you can run: + +```bash +$ tuono new my-project -t tuono-tutorial +``` diff --git a/examples/tutorial/package.json b/examples/tuono-tutorial/package.json similarity index 82% rename from examples/tutorial/package.json rename to examples/tuono-tutorial/package.json index b8745ca3..9d8dd595 100644 --- a/examples/tutorial/package.json +++ b/examples/tuono-tutorial/package.json @@ -1,6 +1,6 @@ { "name": "tuono-tutorial", - "description": "The react/rust fullstack framework", + "description": "The basic tutorial for tuono applications", "version": "0.0.1", "dependencies": { "react": "18.3.1", diff --git a/examples/mdx/public/favicon.ico b/examples/tuono-tutorial/public/favicon.ico similarity index 100% rename from examples/mdx/public/favicon.ico rename to examples/tuono-tutorial/public/favicon.ico diff --git a/examples/tutorial/public/react.svg b/examples/tuono-tutorial/public/react.svg similarity index 100% rename from examples/tutorial/public/react.svg rename to examples/tuono-tutorial/public/react.svg diff --git a/examples/tutorial/public/rust.svg b/examples/tuono-tutorial/public/rust.svg similarity index 100% rename from examples/tutorial/public/rust.svg rename to examples/tuono-tutorial/public/rust.svg diff --git a/examples/tutorial/src/components/PokemonLink.module.css b/examples/tuono-tutorial/src/components/PokemonLink.module.css similarity index 100% rename from examples/tutorial/src/components/PokemonLink.module.css rename to examples/tuono-tutorial/src/components/PokemonLink.module.css diff --git a/examples/tutorial/src/components/PokemonLink.tsx b/examples/tuono-tutorial/src/components/PokemonLink.tsx similarity index 100% rename from examples/tutorial/src/components/PokemonLink.tsx rename to examples/tuono-tutorial/src/components/PokemonLink.tsx diff --git a/examples/tutorial/src/components/PokemonView.module.css b/examples/tuono-tutorial/src/components/PokemonView.module.css similarity index 100% rename from examples/tutorial/src/components/PokemonView.module.css rename to examples/tuono-tutorial/src/components/PokemonView.module.css diff --git a/examples/tutorial/src/components/PokemonView.tsx b/examples/tuono-tutorial/src/components/PokemonView.tsx similarity index 100% rename from examples/tutorial/src/components/PokemonView.tsx rename to examples/tuono-tutorial/src/components/PokemonView.tsx diff --git a/examples/tutorial/src/main.rs b/examples/tuono-tutorial/src/main.rs similarity index 100% rename from examples/tutorial/src/main.rs rename to examples/tuono-tutorial/src/main.rs diff --git a/examples/tutorial/src/routes/__root.tsx b/examples/tuono-tutorial/src/routes/__root.tsx similarity index 100% rename from examples/tutorial/src/routes/__root.tsx rename to examples/tuono-tutorial/src/routes/__root.tsx diff --git a/examples/tutorial/src/routes/index.rs b/examples/tuono-tutorial/src/routes/index.rs similarity index 100% rename from examples/tutorial/src/routes/index.rs rename to examples/tuono-tutorial/src/routes/index.rs diff --git a/examples/tutorial/src/routes/index.tsx b/examples/tuono-tutorial/src/routes/index.tsx similarity index 100% rename from examples/tutorial/src/routes/index.tsx rename to examples/tuono-tutorial/src/routes/index.tsx diff --git a/examples/tutorial/src/routes/pokemons/GOAT.rs b/examples/tuono-tutorial/src/routes/pokemons/GOAT.rs similarity index 100% rename from examples/tutorial/src/routes/pokemons/GOAT.rs rename to examples/tuono-tutorial/src/routes/pokemons/GOAT.rs diff --git a/examples/tutorial/src/routes/pokemons/[pokemon].rs b/examples/tuono-tutorial/src/routes/pokemons/[pokemon].rs similarity index 100% rename from examples/tutorial/src/routes/pokemons/[pokemon].rs rename to examples/tuono-tutorial/src/routes/pokemons/[pokemon].rs diff --git a/examples/tutorial/src/routes/pokemons/[pokemon].tsx b/examples/tuono-tutorial/src/routes/pokemons/[pokemon].tsx similarity index 100% rename from examples/tutorial/src/routes/pokemons/[pokemon].tsx rename to examples/tuono-tutorial/src/routes/pokemons/[pokemon].tsx diff --git a/examples/mdx/src/styles/global.css b/examples/tuono-tutorial/src/styles/global.css similarity index 100% rename from examples/mdx/src/styles/global.css rename to examples/tuono-tutorial/src/styles/global.css diff --git a/examples/tuono/tsconfig.json b/examples/tuono-tutorial/tsconfig.json similarity index 100% rename from examples/tuono/tsconfig.json rename to examples/tuono-tutorial/tsconfig.json diff --git a/examples/tuono/tsconfig.node.json b/examples/tuono-tutorial/tsconfig.node.json similarity index 100% rename from examples/tuono/tsconfig.node.json rename to examples/tuono-tutorial/tsconfig.node.json diff --git a/examples/tutorial/README.md b/examples/tutorial/README.md deleted file mode 100644 index fdccceff..00000000 --- a/examples/tutorial/README.md +++ /dev/null @@ -1,9 +0,0 @@ -# Tuono tutorial - -This project is the outcome of the [tuono tutorial](https://github.com/Valerioageno/tuono/blob/main/docs/tutorial.md) - -If you want to directly install it you can run: - -```bash -$ tuono new my-project -t tutorial -``` diff --git a/examples/tutorial/.gitignore b/examples/with-mdx/.gitignore similarity index 100% rename from examples/tutorial/.gitignore rename to examples/with-mdx/.gitignore diff --git a/examples/mdx/Cargo.toml b/examples/with-mdx/Cargo.toml similarity index 92% rename from examples/mdx/Cargo.toml rename to examples/with-mdx/Cargo.toml index e4487952..ddfa2ae5 100644 --- a/examples/mdx/Cargo.toml +++ b/examples/with-mdx/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "tuono" +name = "with-mdx" version = "0.0.1" edition = "2021" diff --git a/examples/tuono/README.md b/examples/with-mdx/README.md similarity index 100% rename from examples/tuono/README.md rename to examples/with-mdx/README.md diff --git a/examples/mdx/package.json b/examples/with-mdx/package.json similarity index 79% rename from examples/mdx/package.json rename to examples/with-mdx/package.json index 8c47d305..e41c9850 100644 --- a/examples/mdx/package.json +++ b/examples/with-mdx/package.json @@ -1,6 +1,6 @@ { - "name": "tuono", - "description": "The react/rust fullstack framework", + "name": "with-mdx", + "description": "Tuono example combined with mdx", "version": "0.0.1", "dependencies": { "@mdx-js/react": "^3.0.1", diff --git a/examples/tutorial/public/favicon.ico b/examples/with-mdx/public/favicon.ico similarity index 100% rename from examples/tutorial/public/favicon.ico rename to examples/with-mdx/public/favicon.ico diff --git a/examples/mdx/src/routes/__root.tsx b/examples/with-mdx/src/routes/__root.tsx similarity index 100% rename from examples/mdx/src/routes/__root.tsx rename to examples/with-mdx/src/routes/__root.tsx diff --git a/examples/mdx/src/routes/index.mdx b/examples/with-mdx/src/routes/index.mdx similarity index 100% rename from examples/mdx/src/routes/index.mdx rename to examples/with-mdx/src/routes/index.mdx diff --git a/examples/tuono/src/styles/global.css b/examples/with-mdx/src/styles/global.css similarity index 100% rename from examples/tuono/src/styles/global.css rename to examples/with-mdx/src/styles/global.css diff --git a/examples/tutorial/tsconfig.json b/examples/with-mdx/tsconfig.json similarity index 100% rename from examples/tutorial/tsconfig.json rename to examples/with-mdx/tsconfig.json diff --git a/examples/tutorial/tsconfig.node.json b/examples/with-mdx/tsconfig.node.json similarity index 100% rename from examples/tutorial/tsconfig.node.json rename to examples/with-mdx/tsconfig.node.json diff --git a/package.json b/package.json index 8a5389de..e3a7c4d7 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "docs:format:check": "turbo format:check --filter=documentation", "docs:types": "turbo types --filter=documentation", "repo:root:format": "prettier . !./apps/** !./assets/** !./benches/** !./crates !./examples !./packages/** --write", - "check-all": "turbo build lint format:check types" + "check-all": "turbo build lint format:check types --filter=!./examples" }, "author": "Valerio Ageno", "license": "MIT", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 53f3ef65..3378d02f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -110,6 +110,75 @@ importers: specifier: ^7.0.1 version: 7.0.1(postcss@8.4.49) + examples/tuono-app: + dependencies: + react: + specifier: 18.3.1 + version: 18.3.1 + react-dom: + specifier: 18.3.1 + version: 18.3.1(react@18.3.1) + tuono: + specifier: link:../../packages/tuono + version: link:../../packages/tuono + devDependencies: + '@types/react': + specifier: ^18.3.3 + version: 18.3.12 + '@types/react-dom': + specifier: ^18.3.0 + version: 18.3.1 + typescript: + specifier: ^5.4.5 + version: 5.6.3 + + examples/tuono-tutorial: + dependencies: + react: + specifier: 18.3.1 + version: 18.3.1 + react-dom: + specifier: 18.3.1 + version: 18.3.1(react@18.3.1) + tuono: + specifier: link:../../packages/tuono + version: link:../../packages/tuono + devDependencies: + '@types/react': + specifier: ^18.3.3 + version: 18.3.12 + '@types/react-dom': + specifier: ^18.3.0 + version: 18.3.1 + typescript: + specifier: ^5.4.5 + version: 5.6.3 + + examples/with-mdx: + dependencies: + '@mdx-js/react': + specifier: ^3.0.1 + version: 3.1.0(@types/react@18.3.12)(react@18.3.1) + react: + specifier: 18.3.1 + version: 18.3.1 + react-dom: + specifier: 18.3.1 + version: 18.3.1(react@18.3.1) + tuono: + specifier: link:../../packages/tuono + version: link:../../packages/tuono + devDependencies: + '@types/react': + specifier: ^18.3.3 + version: 18.3.12 + '@types/react-dom': + specifier: ^18.3.0 + version: 18.3.1 + typescript: + specifier: ^5.5.3 + version: 5.6.3 + packages/fs-router-vite-plugin: dependencies: '@babel/core': diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 51d152cb..6ec400e4 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -1,4 +1,4 @@ packages: - 'packages/*' - 'apps/*' - - '!**/examples/**' + - 'examples/*'