From 18eb4ec3bd7e9ed5df881e4727dec92645b00fd3 Mon Sep 17 00:00:00 2001 From: Fankai Liu Date: Fri, 10 May 2024 22:22:31 +0800 Subject: [PATCH] update: openapi style --- Cargo.lock | 2 +- Cargo.toml | 2 +- locales/readme.yml | 18 ++++++++++++++++++ src/template/README.md | 2 ++ src/template/cliff.toml | 2 +- src/template/src/main_template.hbs | 4 ++-- src/template/src/routers/mod.hbs | 16 ++++++++-------- src/utils/create_project.rs | 1 + 8 files changed, 34 insertions(+), 13 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5fdc587..d6138c4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1238,7 +1238,7 @@ checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" [[package]] name = "salvo-cli" -version = "0.1.49" +version = "0.1.50" dependencies = [ "ansi_term", "anyhow", diff --git a/Cargo.toml b/Cargo.toml index e084da7..c457ba0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "salvo-cli" -version = "0.1.49" +version = "0.1.50" edition = "2021" authors = ["Fankai Liu liufankai137@outlook.com","mrxiaozhuox mrxzx.info@gmail.com"] keywords = ["salvo", "cli","template"] diff --git a/locales/readme.yml b/locales/readme.yml index 27af83b..14fcb6a 100644 --- a/locales/readme.yml +++ b/locales/readme.yml @@ -915,6 +915,24 @@ build_yml_description: th: ไฟล์ YAML นี้กำหนดค่าไปป์ไลน์การรวมต่อเนื่อง (CI) สำหรับโปรเจกต์ มันกำหนดขั้นตอนที่จะดำเนินการโดยอัตโนมัติเมื่อมีการผลักดันโค้ดเข้าสู่ที่เก็บข้อมูล ซึ่งรวมถึงงานเช่นการสร้างซอฟต์แวร์ การทดสอบการทำงาน และการปรับใช้แอปพลิเคชันหากเงื่อนไขเป็นไปตามที่กำหนด el: Αυτό το αρχείο YAML διαμορφώνει τη διαδικασία συνεχούς ένταξης (CI) για το έργο. Καθορίζει τα βήματα που εκτελούνται αυτόματα όταν κώδικας αναρτάται στο αποθετήριο. Αυτό περιλαμβάνει εργασίες όπως η δημιουργία του λογισμικού, η εκτέλεση δοκιμών και η ανάπτυξη της εφαρμογής εάν τα κριτήρια έχουν επιτευχθεί. da: Denne YAML-fil konfigurerer det kontinuerlige integrationspipeline (CI) for projektet. Det definerer de trin, der udføres automatisk, når kode skubbes til repositoriet. Dette inkluderer opgaver som at bygge softwaren, køre tests, og udrulle applikationen, hvis betingelserne er opfyldt. +git_cliff: + zh_CN: 请替换 cliff.toml 文件第 49 行的 url 为该仓库的 url,用来触发自动生成变更日志。 + en: Please replace the url in line 49 of the cliff.toml file with the repository url to trigger the automatic generation of changelogs. + zh_TW: 請替換 cliff.toml 文件第 49 行的 url 為該倉庫的 url,用來觸發自動生成變更日誌。 + fr: Veuillez remplacer l'url à la ligne 49 du fichier cliff.toml par l'url du dépôt pour déclencher la génération automatique des journaux de modifications. + ja: cliff.toml ファイルの 49 行目の url をリポジトリの url に置き換えて、変更ログの自動生成をトリガーしてください。 + es: Por favor, reemplace la url en la línea 49 del archivo cliff.toml con la url del repositorio para activar la generación automática de registros de cambios. + de: Bitte ersetzen Sie die URL in Zeile 49 der Datei cliff.toml durch die URL des Repositories, um das automatische Erstellen von Änderungsprotokollen auszulösen. + ru: Пожалуйста, замените url в строке 49 файла cliff.toml на url репозитория, чтобы инициировать автоматическое создание журналов изменений. + it: Si prega di sostituire l'url nella linea 49 del file cliff.toml con l'url del repository per attivare la generazione automatica del changelog. + pt: Por favor, substitua o url na linha 49 do arquivo cliff.toml pelo url do repositório para acionar a geração automática de changelogs. + ko: cliff.toml 파일의 49번째 줄 url을 저장소 url로 바꿔서 변경 로그의 자동 생성을 트리거하세요. + no: Vennligst erstatt url-en i linje 49 i cliff.toml-filen med repositoriets url for å utløse automatisk generering av endringslogger. + is: Vinsamlegast skiptu út url í línu 49 í cliff.toml skránni með url geymslunnar til að virkja sjálfvirka myndun breytingaskráa. + uk: Будь ласка, замініть url у рядку 49 файла cliff.toml на url репозиторію, щоб ініціювати автоматичне створення журналів змін. + th: โปรดแทนที่ url ในบรรทัดที่ 49 ของไฟล์ cliff.toml ด้วย url ของที่เก็บข้อมูลเพื่อเรียกใช้การสร้างบันทึกการเปลี่ยนแปลงโดยอัตโนมัติ + el: Παρακαλώ αντικαταστήστε το url στη γραμμή 49 του αρχείου cliff.toml με το url του αποθετηρίου για να ενεργοποιήσετε την αυτόματη δημιουργία καταγραφών αλλαγών. + da: Erstat venligst url'en på linje 49 i cliff.toml-filen med url'et til repositoriet for at udløse automatisk generering af ændringslogfiler. cliff_toml: zh_CN: 用于 git-cliff 生成变更日志 en: For generating changelogs with git-cliff diff --git a/src/template/README.md b/src/template/README.md index 4abc573..46cb4c0 100644 --- a/src/template/README.md +++ b/src/template/README.md @@ -72,5 +72,7 @@ cargo test ``` shell cargo install --locked cargo-deny && cargo deny check ``` +# git cliff +{{git_cliff}} # {{about_salvo}} {{about_salvo_text}} \ No newline at end of file diff --git a/src/template/cliff.toml b/src/template/cliff.toml index abaa3ed..ad25efc 100644 --- a/src/template/cliff.toml +++ b/src/template/cliff.toml @@ -46,7 +46,7 @@ footer = """ trim = true # postprocessors postprocessors = [ - { pattern = '\$REPO', replace = "https://github.com/tyrchen/geektime-rust-live-coding" }, # replace repository URL + { pattern = '\$REPO', replace = "https://github.com/user/repo" }, # replace repository URL ] [git] diff --git a/src/template/src/main_template.hbs b/src/template/src/main_template.hbs index 66a7dfa..8b70515 100644 --- a/src/template/src/main_template.hbs +++ b/src/template/src/main_template.hbs @@ -76,7 +76,7 @@ async fn main() { match CFG.server.ssl { true => { println!( - "📖 {{open_api_page}}: https://{}/swagger-ui", + "📖 {{open_api_page}}: https://{}/scalar", &CFG.server.address.replace("0.0.0.0", "127.0.0.1") ); {{#if is_web_site}} @@ -100,7 +100,7 @@ async fn main() { } false => { println!( - "📖 {{open_api_page}}: http://{}/swagger-ui", + "📖 {{open_api_page}}: http://{}/scalar", &CFG.server.address.replace("0.0.0.0", "127.0.0.1") ); {{#if is_web_site}} diff --git a/src/template/src/routers/mod.hbs b/src/template/src/routers/mod.hbs index 22b104a..57bf0f6 100644 --- a/src/template/src/routers/mod.hbs +++ b/src/template/src/routers/mod.hbs @@ -2,7 +2,7 @@ {{#if is_web_site}} use crate::middleware::jwt::jwt_middleware; use salvo::{ - prelude::{CatchPanic, Logger, OpenApi, SwaggerUi}, + prelude::{CatchPanic, Logger, OpenApi, Scalar}, Router, }; @@ -49,12 +49,12 @@ pub fn router() -> Router { let doc = OpenApi::new("salvo web api", "0.0.1").merge_router(&router); router .push(doc.into_router("/api-doc/openapi.json")) - .push(SwaggerUi::new("/api-doc/openapi.json").into_router("swagger-ui")) + .push(Scalar::new("/api-doc/openapi.json").into_router("scalar")) } {{else}} use crate::middleware::{cors::cors_middleware, jwt::jwt_middleware}; use salvo::{ - prelude::{CatchPanic, Logger, OpenApi, SwaggerUi}, + prelude::{CatchPanic, Logger, OpenApi, Scalar}, Router, }; @@ -99,13 +99,13 @@ pub fn router() -> Router { let doc = OpenApi::new("salvo web api", "0.0.1").merge_router(&router); router .push(doc.into_router("/api-doc/openapi.json")) - .push(SwaggerUi::new("/api-doc/openapi.json").into_router("swagger-ui")) + .push(Scalar::new("/api-doc/openapi.json").into_router("scalar")) } {{/if}} {{else}} {{#if is_web_site}} use salvo::{ - prelude::{CatchPanic, Logger, OpenApi, SwaggerUi}, + prelude::{CatchPanic, Logger, OpenApi, Scalar}, Router, }; use crate::middleware::cors::cors_middleware; @@ -125,11 +125,11 @@ pub fn router() -> Router { let doc = OpenApi::new("salvo web api", "0.0.1").merge_router(&router); router .push(doc.into_router("/api-doc/openapi.json")) - .push(SwaggerUi::new("/api-doc/openapi.json").into_router("swagger-ui")) + .push(Scalar::new("/api-doc/openapi.json").into_router("scalar")) } {{else}} use salvo::{ - prelude::{CatchPanic, Logger, OpenApi, SwaggerUi}, + prelude::{CatchPanic, Logger, OpenApi, Scalar}, Router, }; use crate::middleware::cors::cors_middleware; @@ -149,7 +149,7 @@ pub fn router() -> Router { let doc = OpenApi::new("salvo web api", "0.0.1").merge_router(&router); router .push(doc.into_router("/api-doc/openapi.json")) - .push(SwaggerUi::new("/api-doc/openapi.json").into_router("swagger-ui")) + .push(Scalar::new("/api-doc/openapi.json").into_router("scalar")) } {{/if}} {{/if}} \ No newline at end of file diff --git a/src/utils/create_project.rs b/src/utils/create_project.rs index e1e7fb1..a0d0118 100644 --- a/src/utils/create_project.rs +++ b/src/utils/create_project.rs @@ -143,6 +143,7 @@ pub fn write_project_file( handlebars::JsonValue::String(t!("database_connection_failed")); data["user_does_not_exist"] = handlebars::JsonValue::String(t!("user_does_not_exist")); data["rust_version_tip"] = handlebars::JsonValue::String(t!("rust_version_tip")); + data["git_cliff"] = handlebars::JsonValue::String(t!("git_cliff")); let mut dependencies = data["dependencies"].clone(); handle_dependencies( &mut dependencies,