From 48fdc460ad58923e83f6054f8a74c8b946869deb Mon Sep 17 00:00:00 2001 From: Jef Roosens Date: Wed, 18 Aug 2021 22:06:37 +0200 Subject: [PATCH] Organized Rust project in library & binary --- .gitignore | 2 +- Cargo.toml | 8 +++ frontend/src/pages/index.astro | 56 ------------------- src/main.rs | 3 - src/rb/lib.rs | 3 + src/rbs/main.rs | 5 ++ {frontend => web}/.gitignore | 0 {frontend => web}/.npmrc | 0 {frontend => web}/README.md | 0 {frontend => web}/astro.config.mjs | 0 {frontend => web}/package.json | 0 {frontend => web}/public/assets/logo.svg | 0 {frontend => web}/public/favicon.svg | 0 {frontend => web}/public/robots.txt | 0 {frontend => web}/public/style/global.css | 0 {frontend => web}/public/style/home.css | 0 .../src/components/SvelteCounter.svelte | 0 {frontend => web}/src/components/Tour.astro | 0 web/src/layouts/index.astro | 7 +++ web/src/pages/index.astro | 44 +++++++++++++++ {frontend => web}/tsconfig.json | 0 {frontend => web}/yarn.lock | 0 22 files changed, 68 insertions(+), 60 deletions(-) delete mode 100644 frontend/src/pages/index.astro delete mode 100644 src/main.rs create mode 100644 src/rb/lib.rs create mode 100644 src/rbs/main.rs rename {frontend => web}/.gitignore (100%) rename {frontend => web}/.npmrc (100%) rename {frontend => web}/README.md (100%) rename {frontend => web}/astro.config.mjs (100%) rename {frontend => web}/package.json (100%) rename {frontend => web}/public/assets/logo.svg (100%) rename {frontend => web}/public/favicon.svg (100%) rename {frontend => web}/public/robots.txt (100%) rename {frontend => web}/public/style/global.css (100%) rename {frontend => web}/public/style/home.css (100%) rename {frontend => web}/src/components/SvelteCounter.svelte (100%) rename {frontend => web}/src/components/Tour.astro (100%) create mode 100644 web/src/layouts/index.astro create mode 100644 web/src/pages/index.astro rename {frontend => web}/tsconfig.json (100%) rename {frontend => web}/yarn.lock (100%) diff --git a/.gitignore b/.gitignore index d1bb021..4d7b925 100644 --- a/.gitignore +++ b/.gitignore @@ -6,7 +6,7 @@ target/ # Remove Cargo.lock from gitignore if creating an executable, leave it for libraries # More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html -Cargo.lock +# Cargo.lock # These are backup files generated by rustfmt **/*.rs.bk diff --git a/Cargo.toml b/Cargo.toml index 2016089..b7e4717 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,6 +4,14 @@ version = "0.1.0" authors = ["Jef Roosens "] edition = "2018" +[lib] +name = "rb" +path = "src/rb/lib.rs" + +[[bin]] +name = "rbs" +path = "src/rbs/main.rs" + # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] diff --git a/frontend/src/pages/index.astro b/frontend/src/pages/index.astro deleted file mode 100644 index ea3ab94..0000000 --- a/frontend/src/pages/index.astro +++ /dev/null @@ -1,56 +0,0 @@ ---- -// Component Imports -import Tour from '../components/Tour.astro'; -// You can import components from any supported Framework here! -import SvelteCounter from '../components/SvelteCounter.svelte'; - -// Component Script: -// You can write any JavaScript/TypeScript that you'd like here. -// It will run during the build, but never in the browser. -// All variables are available to use in the HTML template below. -let title = 'My Astro Site'; - -// Full Astro Component Syntax: -// https://docs.astro.build/core-concepts/astro-components/ ---- - - - - - {title} - - - - - - - -
-
-
- Astro logo -

Welcome to Astro

-
-
- - - - - -
- - diff --git a/src/main.rs b/src/main.rs deleted file mode 100644 index e7a11a9..0000000 --- a/src/main.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - println!("Hello, world!"); -} diff --git a/src/rb/lib.rs b/src/rb/lib.rs new file mode 100644 index 0000000..4cb480e --- /dev/null +++ b/src/rb/lib.rs @@ -0,0 +1,3 @@ +pub fn yeet() -> String { + String::from("yeet") +} diff --git a/src/rbs/main.rs b/src/rbs/main.rs new file mode 100644 index 0000000..6e1b97f --- /dev/null +++ b/src/rbs/main.rs @@ -0,0 +1,5 @@ +use rb::yeet; + +fn main() { + println!("{}", yeet()); +} diff --git a/frontend/.gitignore b/web/.gitignore similarity index 100% rename from frontend/.gitignore rename to web/.gitignore diff --git a/frontend/.npmrc b/web/.npmrc similarity index 100% rename from frontend/.npmrc rename to web/.npmrc diff --git a/frontend/README.md b/web/README.md similarity index 100% rename from frontend/README.md rename to web/README.md diff --git a/frontend/astro.config.mjs b/web/astro.config.mjs similarity index 100% rename from frontend/astro.config.mjs rename to web/astro.config.mjs diff --git a/frontend/package.json b/web/package.json similarity index 100% rename from frontend/package.json rename to web/package.json diff --git a/frontend/public/assets/logo.svg b/web/public/assets/logo.svg similarity index 100% rename from frontend/public/assets/logo.svg rename to web/public/assets/logo.svg diff --git a/frontend/public/favicon.svg b/web/public/favicon.svg similarity index 100% rename from frontend/public/favicon.svg rename to web/public/favicon.svg diff --git a/frontend/public/robots.txt b/web/public/robots.txt similarity index 100% rename from frontend/public/robots.txt rename to web/public/robots.txt diff --git a/frontend/public/style/global.css b/web/public/style/global.css similarity index 100% rename from frontend/public/style/global.css rename to web/public/style/global.css diff --git a/frontend/public/style/home.css b/web/public/style/home.css similarity index 100% rename from frontend/public/style/home.css rename to web/public/style/home.css diff --git a/frontend/src/components/SvelteCounter.svelte b/web/src/components/SvelteCounter.svelte similarity index 100% rename from frontend/src/components/SvelteCounter.svelte rename to web/src/components/SvelteCounter.svelte diff --git a/frontend/src/components/Tour.astro b/web/src/components/Tour.astro similarity index 100% rename from frontend/src/components/Tour.astro rename to web/src/components/Tour.astro diff --git a/web/src/layouts/index.astro b/web/src/layouts/index.astro new file mode 100644 index 0000000..499bb35 --- /dev/null +++ b/web/src/layouts/index.astro @@ -0,0 +1,7 @@ + + +

huh

+

lol

+ + + diff --git a/web/src/pages/index.astro b/web/src/pages/index.astro new file mode 100644 index 0000000..44e0ba3 --- /dev/null +++ b/web/src/pages/index.astro @@ -0,0 +1,44 @@ + + + + + + + + diff --git a/frontend/tsconfig.json b/web/tsconfig.json similarity index 100% rename from frontend/tsconfig.json rename to web/tsconfig.json diff --git a/frontend/yarn.lock b/web/yarn.lock similarity index 100% rename from frontend/yarn.lock rename to web/yarn.lock