forked from EpicsDAO/zapp
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[EpicsDAO#6] generate new project instead of downloading a ZIP template
- Loading branch information
Showing
31 changed files
with
196 additions
and
249 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.env |
File renamed without changes.
45 changes: 21 additions & 24 deletions
45
src/new/resources/Cargo.toml → resources/templates/new/Cargo.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,42 @@ | ||
[package] | ||
name = "barbaz" | ||
name = "{{ app_name }}" | ||
version = "0.1.0" | ||
edition = "2021" | ||
rust-version= "1.64" | ||
rust-version = "1.64" | ||
|
||
[workspace] | ||
members = [".", "entity", "migration"] | ||
|
||
[workspace.dependencies] | ||
tokio = { version = "1.0", features = ["full"] } | ||
# graphql base library | ||
async-graphql = { version = "4.0.13", features = ["chrono"] } | ||
# graphql integration for axum web framework | ||
async-graphql-axum = "4.0.13" | ||
# async std lib: used by migration crate | ||
async-std = { version = "1.12.0", features = ["attributes", "tokio1"] } | ||
# our general web framework | ||
axum = "^0.5.1" | ||
# read dotenv files in main.rs | ||
dotenv = "0.15.0" | ||
async-graphql-axum = "4.0.13" | ||
async-graphql = { version = "4.0.13", features = ["chrono"] } | ||
# generated local entities | ||
entity = { path = "entity" } | ||
# generated local migrations | ||
migration = { path = "migration" } | ||
serde = { version = "1", features = ["derive"] } | ||
serde_json = "1" | ||
jsonwebtoken = "8" | ||
chrono = "0.4.19" | ||
axum-auth = "0.3.0" | ||
fireauth = "0.1.5" | ||
# database connection and orm | ||
sea-orm = { version = "0.9.2", features = ["runtime-tokio-native-tls", "sqlx-postgres"] } | ||
async-std = "1.12.0" | ||
# migrate database before startup | ||
sea-orm-migration = "0.9.2" | ||
# asnyc runtime: used by main.rs | ||
tokio = { version = "1.0", features = ["full"] } | ||
|
||
[dependencies] | ||
|
||
tokio = { workspace = true } | ||
axum = { workspace = true } | ||
dotenv = { workspace = true } | ||
async-graphql-axum = { workspace = true } | ||
async-graphql = { workspace = true } | ||
async-graphql-axum = { workspace = true } | ||
async-std = { workspace = true } | ||
axum = {workspace = true} | ||
dotenv = { workspace = true } | ||
entity = { workspace = true } | ||
migration = { workspace = true } | ||
serde = { workspace = true } | ||
serde_json = { workspace = true } | ||
jsonwebtoken = { workspace = true } | ||
chrono = { workspace = true } | ||
axum-auth = { workspace = true } | ||
fireauth = { workspace = true } | ||
sea-orm = { workspace = true } | ||
async-std = { workspace = true } | ||
sea-orm-migration = { workspace = true } | ||
tokio = { workspace = true } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,19 @@ | ||
mod src_dir; | ||
|
||
use crate::new::generation::create_and_write_file; | ||
use crate::new::generation::entity_dir::src_dir::populate_src_dir; | ||
use crate::template_file; | ||
use std::fs; | ||
use std::io::Write; | ||
use std::path::Path; | ||
|
||
pub(super) fn populate_entity_dir(gen_path: &Path, app_name: &str) { | ||
let entity_dir = gen_path.join("entity"); | ||
fs::create_dir(&entity_dir).unwrap(); | ||
|
||
emit_cargo_toml(&entity_dir, &app_name); | ||
populate_src_dir(&entity_dir, &app_name); | ||
} | ||
|
||
fn emit_cargo_toml(gen_path: &Path, app_name: &str) { | ||
let filename = gen_path.join("Cargo.toml"); | ||
let cargo_toml = include_str!("../../resources/entity/Cargo.toml"); | ||
create_and_write_file(&filename, &cargo_toml); | ||
template_file!( | ||
"../../../../resources/templates/new/entity/Cargo.toml", | ||
&entity_dir.join("Cargo.toml") | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,14 @@ | ||
use crate::new::generation::create_and_write_file; | ||
use crate::template_file; | ||
use std::fs; | ||
use std::io::Write; | ||
use std::path::Path; | ||
|
||
pub(super) fn populate_src_dir(gen_path: &Path, app_name: &str) { | ||
pub(super) fn populate_src_dir(gen_path: &Path, _app_name: &str) { | ||
let src_dir = gen_path.join("src"); | ||
fs::create_dir(&src_dir).unwrap(); | ||
|
||
emit_lib_rs(&src_dir, &app_name); | ||
} | ||
|
||
fn emit_lib_rs(gen_path: &Path, app_name: &&str) { | ||
let filename = gen_path.join("lib.rs"); | ||
let lib_rs = include_str!("../../../resources/entity/src/lib.rs"); | ||
create_and_write_file(&filename, lib_rs); | ||
template_file!( | ||
"../../../../../resources/templates/new/entity/src/lib.rs", | ||
&src_dir.join("lib.rs") | ||
); | ||
} |
Oops, something went wrong.