From 5492b5b4bc175e82f59e150f2d6c4377b471fbf9 Mon Sep 17 00:00:00 2001 From: Luca Sepe Date: Mon, 22 Jun 2020 14:39:01 +0200 Subject: [PATCH] Fix bug outline frames not working --- CHANGELOG.md | 4 ++++ README.md | 2 +- draft.go | 14 ++++++++++++-- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fe36bee..518e356 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.6.1] - 2020-06-22 +### Fixed +- 🐛 outline frames not working + ## [0.6.0] - 2020-06-20 ### Added - 🎉 new feature use specific icons for each provider (see [README](./README.md) for the _How To_) diff --git a/README.md b/README.md index a89eb6a..bf68379 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Draft -[![Go Report Card](https://goreportcard.com/badge/github.com/lucasepe/draft)](https://goreportcard.com/report/github.com/lucasepe/draft)     [![Coverage](https://gocover.io/_badge/github.com/lucasepe/draft?nocache=draft)](https://gocover.io/_badge/github.com/lucasepe/draft?nocache=draft)     [![Twitter](https://img.shields.io/twitter/url?style=social&url=https%3A%2F%2Fgithub.com%2Flucasepe%2Fdraft)](https://twitter.com/intent/tweet?text=Wow:&url=https%3A%2F%2Fgithub.com%2Flucasepe%2Fdraft) +[![Go Report Card](https://goreportcard.com/badge/github.com/lucasepe/draft)](https://goreportcard.com/report/github.com/lucasepe/draft)     [![Go Coverage](https://gocover.io/_badge/github.com/lucasepe/draft?nocache=draft)](https://gocover.io/_badge/github.com/lucasepe/draft?nocache=draft)     [![Twitter](https://img.shields.io/twitter/url?style=social&url=https%3A%2F%2Fgithub.com%2Flucasepe%2Fdraft)](https://twitter.com/intent/tweet?text=Wow:&url=https%3A%2F%2Fgithub.com%2Flucasepe%2Fdraft) A commandline tool that generate **H**igh **L**evel microservice & serverless **A**rchitecture diagrams using a declarative syntax defined in a YAML file. diff --git a/draft.go b/draft.go index 47876e9..26f052a 100644 --- a/draft.go +++ b/draft.go @@ -7,6 +7,7 @@ import ( "strings" "github.com/emicklei/dot" + "github.com/lucasepe/draft/pkg/cluster" "github.com/lucasepe/draft/pkg/edge" "github.com/lucasepe/draft/pkg/graph" ) @@ -141,9 +142,18 @@ func sketchComponents(gfx *dot.Graph, cfg Config, items []Component) error { fmt.Fprintf(os.Stderr, " • component: %s\n", string(bin)) } - if ok := figIcon(cfg, it)(gfx); !ok { + parent := gfx + if strings.TrimSpace(it.Outline) != "" { + parent = cluster.New(gfx, it.Outline, + cluster.PenColor("#d9cc31"), + cluster.FontName("Fira Mono"), + cluster.FontSize(10), + cluster.FontColor("#63625b")) + } + + if ok := figIcon(cfg, it)(parent); !ok { if fig, found := figRegistry[it.Kind]; found { - fig(cfg, it)(gfx) + fig(cfg, it)(parent) } else { return fmt.Errorf("sketcher not found for component of kind <%s>", it.Kind) }