Skip to content

Commit

Permalink
refactor code
Browse files Browse the repository at this point in the history
  • Loading branch information
fankaiLiu committed Nov 26, 2023
1 parent 0f5a2bb commit ff6971d
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions src/utils/create_project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,10 @@ pub fn write_project_file(
);
data["dependencies"] = dependencies;
create_basic_file(project_path, &handlebars, &data)?;
copy_binary_file(
include_bytes!("../template/assets/favicon.ico"),
project_path.join("template/assets/favicon.ico"),
)?;
let mut templates: Vec<(&str, &str)> = vec![];
if is_web_site {
//templates
Expand Down Expand Up @@ -276,6 +280,7 @@ pub fn write_project_file(
"src/entities/user.rs",
include_str!("../template/src/entities/user.hbs"),
),
(".env", include_str!("../template/.env.hbs")),
]
.as_mut(),
);
Expand Down Expand Up @@ -304,10 +309,6 @@ pub fn write_project_file(
include_bytes!("../template/migrations/20231001143156_users.sql"),
project_path.join("migrations/2021-10-20-000000_create_users_table/up.sql"),
)?;
copy_binary_file(
include_bytes!("../template/.env.hbs"),
project_path.join(".env"),
)?;
}
if is_sea_orm {
copy_binary_file(
Expand All @@ -327,13 +328,10 @@ pub fn write_project_file(
project_path.join("migration/README.md"),
)?;
db_templates.append(
vec![
(
"migration/Cargo.toml",
include_str!("../template/migration/Cargo.toml.hbs"),
),
(".env", include_str!("../template/.env.hbs")),
]
vec![(
"migration/Cargo.toml",
include_str!("../template/migration/Cargo.toml.hbs"),
)]
.as_mut(),
);
if is_sqlite {
Expand Down

0 comments on commit ff6971d

Please sign in to comment.