From adb4b7c2b88ca252efad7caf9520d6a9afcda675 Mon Sep 17 00:00:00 2001 From: Ni55aN Date: Tue, 17 Oct 2023 23:40:55 +0300 Subject: [PATCH 1/7] feat: support drawio diagrams --- .gitignore | 6 ++++++ assets/diagrams/.gitignore | 1 + components/content/Diagram.vue | 10 ++++++++++ package.json | 3 ++- public/diagrams/.keep | 0 scripts/update-diagrams.bash | 8 ++++++++ 6 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 assets/diagrams/.gitignore create mode 100644 components/content/Diagram.vue create mode 100644 public/diagrams/.keep create mode 100644 scripts/update-diagrams.bash diff --git a/.gitignore b/.gitignore index 1b02c437..e40dfe4c 100644 --- a/.gitignore +++ b/.gitignore @@ -31,3 +31,9 @@ node_modules .output .env dist + +_export +*.dtmp +*.bkp +public/diagrams/*.svg +public/diagrams/**/*.svg diff --git a/assets/diagrams/.gitignore b/assets/diagrams/.gitignore new file mode 100644 index 00000000..5ae88e31 --- /dev/null +++ b/assets/diagrams/.gitignore @@ -0,0 +1 @@ +_export diff --git a/components/content/Diagram.vue b/components/content/Diagram.vue new file mode 100644 index 00000000..89ec2cb7 --- /dev/null +++ b/components/content/Diagram.vue @@ -0,0 +1,10 @@ + + + diff --git a/package.json b/package.json index f344b997..2e93503f 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,8 @@ "dev": "nuxt dev", "analyze": "npx nuxi analyze", "generate": "nuxt generate", - "preview": "nuxt preview" + "preview": "nuxt preview", + "update-diagrams": "bash ./scripts/update-diagrams.bash" }, "dependencies": { "@docsearch/css": "^3.5.2", diff --git a/public/diagrams/.keep b/public/diagrams/.keep new file mode 100644 index 00000000..e69de29b diff --git a/scripts/update-diagrams.bash b/scripts/update-diagrams.bash new file mode 100644 index 00000000..0fce2ed3 --- /dev/null +++ b/scripts/update-diagrams.bash @@ -0,0 +1,8 @@ +source_dir="./assets/diagrams/" +dest_dir="./public/diagrams/" + +docker run -it -v $(pwd):/data rlespinasse/drawio-export -f svg --remove-page-suffix -o _export + +rm -rf $dest_dir/{**/,}*.svg +rsync -av --include='*/' --include='_export/*' --exclude='*' "$source_dir/" "$dest_dir/" +find $dest_dir -type f -name '*.svg' -exec sh -c 'newpath=$(echo {} | sed "s/_export\///"); mv {} $newpath' \; From b7ea8641d67d79aaa118cbd41a7366fd27efc39c Mon Sep 17 00:00:00 2001 From: Ni55aN Date: Wed, 18 Oct 2023 00:38:34 +0300 Subject: [PATCH 2/7] feat: diagram caption --- components/content/Diagram.vue | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/components/content/Diagram.vue b/components/content/Diagram.vue index 89ec2cb7..c03d1640 100644 --- a/components/content/Diagram.vue +++ b/components/content/Diagram.vue @@ -1,10 +1,22 @@ + + + From c14bdb9c384398413b56f7a1e33b415d2aacb2f2 Mon Sep 17 00:00:00 2001 From: Ni55aN Date: Wed, 18 Oct 2023 19:06:57 +0300 Subject: [PATCH 3/7] fix: diagrams generation --- public/diagrams/.keep | 0 scripts/update-diagrams.bash | 4 +++- 2 files changed, 3 insertions(+), 1 deletion(-) delete mode 100644 public/diagrams/.keep diff --git a/public/diagrams/.keep b/public/diagrams/.keep deleted file mode 100644 index e69de29b..00000000 diff --git a/scripts/update-diagrams.bash b/scripts/update-diagrams.bash index 0fce2ed3..093e1eef 100644 --- a/scripts/update-diagrams.bash +++ b/scripts/update-diagrams.bash @@ -1,8 +1,10 @@ +set -e + source_dir="./assets/diagrams/" dest_dir="./public/diagrams/" docker run -it -v $(pwd):/data rlespinasse/drawio-export -f svg --remove-page-suffix -o _export -rm -rf $dest_dir/{**/,}*.svg +rm -rf $dest_dir rsync -av --include='*/' --include='_export/*' --exclude='*' "$source_dir/" "$dest_dir/" find $dest_dir -type f -name '*.svg' -exec sh -c 'newpath=$(echo {} | sed "s/_export\///"); mv {} $newpath' \; From c8be5f0a0d59c0e6fc3875bdd36454b5492a2ed8 Mon Sep 17 00:00:00 2001 From: Ni55aN Date: Wed, 18 Oct 2023 19:07:18 +0300 Subject: [PATCH 4/7] feat: scrollable diagram on phone --- components/content/Diagram.vue | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/components/content/Diagram.vue b/components/content/Diagram.vue index c03d1640..7576df67 100644 --- a/components/content/Diagram.vue +++ b/components/content/Diagram.vue @@ -1,6 +1,7 @@ @@ -11,9 +12,17 @@ export default {