From c4ef432daf5574a8b929c668d1b4677b698c4022 Mon Sep 17 00:00:00 2001 From: Anmol Sethi Date: Thu, 1 Dec 2022 05:46:45 -0800 Subject: [PATCH] Move textmeasure into lib It's not a d2renderer. --- d2chaos/d2chaos_test.go | 2 +- d2exporter/export_test.go | 2 +- d2graph/d2graph.go | 2 +- d2lib/d2.go | 2 +- d2renderers/d2svg/d2svg.go | 2 +- docs/examples/lib/1-d2lib/d2lib.go | 2 +- docs/examples/lib/2-d2oracle/d2oracle.go | 2 +- docs/examples/lib/3-lowlevel/lowlevel.go | 2 +- e2etests/e2e_test.go | 2 +- {d2renderers => lib}/textmeasure/NOTICE.txt | 0 {d2renderers => lib}/textmeasure/atlas.go | 0 {d2renderers => lib}/textmeasure/markdown.go | 0 {d2renderers => lib}/textmeasure/rect.go | 0 {d2renderers => lib}/textmeasure/textmeasure.go | 0 {d2renderers => lib}/textmeasure/textmeasure_test.go | 2 +- main.go | 2 +- 16 files changed, 11 insertions(+), 11 deletions(-) rename {d2renderers => lib}/textmeasure/NOTICE.txt (100%) rename {d2renderers => lib}/textmeasure/atlas.go (100%) rename {d2renderers => lib}/textmeasure/markdown.go (100%) rename {d2renderers => lib}/textmeasure/rect.go (100%) rename {d2renderers => lib}/textmeasure/textmeasure.go (100%) rename {d2renderers => lib}/textmeasure/textmeasure_test.go (98%) diff --git a/d2chaos/d2chaos_test.go b/d2chaos/d2chaos_test.go index a73af4d8d..ddbfa9dc2 100644 --- a/d2chaos/d2chaos_test.go +++ b/d2chaos/d2chaos_test.go @@ -17,8 +17,8 @@ import ( "oss.terrastruct.com/d2/d2compiler" "oss.terrastruct.com/d2/d2exporter" "oss.terrastruct.com/d2/d2layouts/d2dagrelayout" - "oss.terrastruct.com/d2/d2renderers/textmeasure" "oss.terrastruct.com/d2/lib/log" + "oss.terrastruct.com/d2/lib/textmeasure" ) // usage: D2_CHAOS_MAXI=100 D2_CHAOS_N=100 ./ci/test.sh ./d2chaos diff --git a/d2exporter/export_test.go b/d2exporter/export_test.go index 1d63d0604..bfd8b8b2f 100644 --- a/d2exporter/export_test.go +++ b/d2exporter/export_test.go @@ -15,11 +15,11 @@ import ( "oss.terrastruct.com/d2/d2compiler" "oss.terrastruct.com/d2/d2exporter" "oss.terrastruct.com/d2/d2layouts/d2dagrelayout" - "oss.terrastruct.com/d2/d2renderers/textmeasure" "oss.terrastruct.com/d2/d2target" "oss.terrastruct.com/d2/d2themes/d2themescatalog" "oss.terrastruct.com/d2/lib/geo" "oss.terrastruct.com/d2/lib/log" + "oss.terrastruct.com/d2/lib/textmeasure" ) type testCase struct { diff --git a/d2graph/d2graph.go b/d2graph/d2graph.go index 5e3f5e566..694e88e2e 100644 --- a/d2graph/d2graph.go +++ b/d2graph/d2graph.go @@ -12,11 +12,11 @@ import ( "oss.terrastruct.com/d2/d2parser" "oss.terrastruct.com/d2/d2renderers/d2fonts" "oss.terrastruct.com/d2/d2renderers/d2latex" - "oss.terrastruct.com/d2/d2renderers/textmeasure" "oss.terrastruct.com/d2/d2target" "oss.terrastruct.com/d2/d2themes" "oss.terrastruct.com/d2/lib/geo" "oss.terrastruct.com/d2/lib/go2" + "oss.terrastruct.com/d2/lib/textmeasure" ) // TODO: Refactor with a light abstract layer on top of AST implementing scenarios, diff --git a/d2lib/d2.go b/d2lib/d2.go index 2b4d800fb..cfc0a0713 100644 --- a/d2lib/d2.go +++ b/d2lib/d2.go @@ -9,8 +9,8 @@ import ( "oss.terrastruct.com/d2/d2compiler" "oss.terrastruct.com/d2/d2exporter" "oss.terrastruct.com/d2/d2graph" - "oss.terrastruct.com/d2/d2renderers/textmeasure" "oss.terrastruct.com/d2/d2target" + "oss.terrastruct.com/d2/lib/textmeasure" ) type CompileOptions struct { diff --git a/d2renderers/d2svg/d2svg.go b/d2renderers/d2svg/d2svg.go index d2f41b9d7..64aa75759 100644 --- a/d2renderers/d2svg/d2svg.go +++ b/d2renderers/d2svg/d2svg.go @@ -22,13 +22,13 @@ import ( "oss.terrastruct.com/d2/d2renderers/d2fonts" "oss.terrastruct.com/d2/d2renderers/d2latex" - "oss.terrastruct.com/d2/d2renderers/textmeasure" "oss.terrastruct.com/d2/d2target" "oss.terrastruct.com/d2/lib/color" "oss.terrastruct.com/d2/lib/geo" "oss.terrastruct.com/d2/lib/go2" "oss.terrastruct.com/d2/lib/label" "oss.terrastruct.com/d2/lib/shape" + "oss.terrastruct.com/d2/lib/textmeasure" ) const ( diff --git a/docs/examples/lib/1-d2lib/d2lib.go b/docs/examples/lib/1-d2lib/d2lib.go index 421e14677..a28b97f07 100644 --- a/docs/examples/lib/1-d2lib/d2lib.go +++ b/docs/examples/lib/1-d2lib/d2lib.go @@ -8,8 +8,8 @@ import ( "oss.terrastruct.com/d2/d2layouts/d2dagrelayout" "oss.terrastruct.com/d2/d2lib" "oss.terrastruct.com/d2/d2renderers/d2svg" - "oss.terrastruct.com/d2/d2renderers/textmeasure" "oss.terrastruct.com/d2/d2themes/d2themescatalog" + "oss.terrastruct.com/d2/lib/textmeasure" ) // Remember to add if err != nil checks in production. diff --git a/docs/examples/lib/2-d2oracle/d2oracle.go b/docs/examples/lib/2-d2oracle/d2oracle.go index e9e7ba944..1f265a05e 100644 --- a/docs/examples/lib/2-d2oracle/d2oracle.go +++ b/docs/examples/lib/2-d2oracle/d2oracle.go @@ -8,8 +8,8 @@ import ( "oss.terrastruct.com/d2/d2layouts/d2dagrelayout" "oss.terrastruct.com/d2/d2lib" "oss.terrastruct.com/d2/d2oracle" - "oss.terrastruct.com/d2/d2renderers/textmeasure" "oss.terrastruct.com/d2/d2themes/d2themescatalog" + "oss.terrastruct.com/d2/lib/textmeasure" ) // Remember to add if err != nil checks in production. diff --git a/docs/examples/lib/3-lowlevel/lowlevel.go b/docs/examples/lib/3-lowlevel/lowlevel.go index 2bba9bfcf..e8f7a70a8 100644 --- a/docs/examples/lib/3-lowlevel/lowlevel.go +++ b/docs/examples/lib/3-lowlevel/lowlevel.go @@ -10,8 +10,8 @@ import ( "oss.terrastruct.com/d2/d2exporter" "oss.terrastruct.com/d2/d2layouts/d2dagrelayout" "oss.terrastruct.com/d2/d2renderers/d2svg" - "oss.terrastruct.com/d2/d2renderers/textmeasure" "oss.terrastruct.com/d2/d2themes/d2themescatalog" + "oss.terrastruct.com/d2/lib/textmeasure" ) // Remember to add if err != nil checks in production. diff --git a/e2etests/e2e_test.go b/e2etests/e2e_test.go index 1e231f39d..19a937abc 100644 --- a/e2etests/e2e_test.go +++ b/e2etests/e2e_test.go @@ -21,10 +21,10 @@ import ( "oss.terrastruct.com/d2/d2layouts/d2elklayout" "oss.terrastruct.com/d2/d2lib" "oss.terrastruct.com/d2/d2renderers/d2svg" - "oss.terrastruct.com/d2/d2renderers/textmeasure" "oss.terrastruct.com/d2/d2target" xdiff "oss.terrastruct.com/d2/lib/diff" "oss.terrastruct.com/d2/lib/log" + "oss.terrastruct.com/d2/lib/textmeasure" ) func TestE2E(t *testing.T) { diff --git a/d2renderers/textmeasure/NOTICE.txt b/lib/textmeasure/NOTICE.txt similarity index 100% rename from d2renderers/textmeasure/NOTICE.txt rename to lib/textmeasure/NOTICE.txt diff --git a/d2renderers/textmeasure/atlas.go b/lib/textmeasure/atlas.go similarity index 100% rename from d2renderers/textmeasure/atlas.go rename to lib/textmeasure/atlas.go diff --git a/d2renderers/textmeasure/markdown.go b/lib/textmeasure/markdown.go similarity index 100% rename from d2renderers/textmeasure/markdown.go rename to lib/textmeasure/markdown.go diff --git a/d2renderers/textmeasure/rect.go b/lib/textmeasure/rect.go similarity index 100% rename from d2renderers/textmeasure/rect.go rename to lib/textmeasure/rect.go diff --git a/d2renderers/textmeasure/textmeasure.go b/lib/textmeasure/textmeasure.go similarity index 100% rename from d2renderers/textmeasure/textmeasure.go rename to lib/textmeasure/textmeasure.go diff --git a/d2renderers/textmeasure/textmeasure_test.go b/lib/textmeasure/textmeasure_test.go similarity index 98% rename from d2renderers/textmeasure/textmeasure_test.go rename to lib/textmeasure/textmeasure_test.go index 616c20c5c..476464206 100644 --- a/d2renderers/textmeasure/textmeasure_test.go +++ b/lib/textmeasure/textmeasure_test.go @@ -8,7 +8,7 @@ import ( "github.com/stretchr/testify/assert" "oss.terrastruct.com/d2/d2renderers/d2fonts" - "oss.terrastruct.com/d2/d2renderers/textmeasure" + "oss.terrastruct.com/d2/lib/textmeasure" ) var txts = []string{ diff --git a/main.go b/main.go index 7586d0838..81f8aaab0 100644 --- a/main.go +++ b/main.go @@ -18,11 +18,11 @@ import ( "oss.terrastruct.com/d2/d2lib" "oss.terrastruct.com/d2/d2plugin" "oss.terrastruct.com/d2/d2renderers/d2svg" - "oss.terrastruct.com/d2/d2renderers/textmeasure" "oss.terrastruct.com/d2/d2themes" "oss.terrastruct.com/d2/d2themes/d2themescatalog" "oss.terrastruct.com/d2/lib/imgbundler" "oss.terrastruct.com/d2/lib/png" + "oss.terrastruct.com/d2/lib/textmeasure" "oss.terrastruct.com/d2/lib/version" "oss.terrastruct.com/d2/lib/xmain" )