Merge branch 'master' into tune-spacing
This commit is contained in:
commit
3a15e707a1
12 changed files with 103 additions and 14 deletions
|
|
@ -58,6 +58,9 @@ Flags:
|
|||
images into the daemon for push later. It's not slow though to use --push-docker after
|
||||
building the image as nearly all artifacts are cached.
|
||||
Automatically set if called from release.sh
|
||||
|
||||
--latest-docker
|
||||
Mark the built image with the latest tag. Automatically set if called from release.sh
|
||||
EOF
|
||||
}
|
||||
|
||||
|
|
@ -113,6 +116,10 @@ main() {
|
|||
flag_noarg && shift "$FLAGSHIFT"
|
||||
PUSH_DOCKER=1
|
||||
;;
|
||||
latest-docker)
|
||||
flag_noarg && shift "$FLAGSHIFT"
|
||||
LATEST_DOCKER=1
|
||||
;;
|
||||
*)
|
||||
flag_errusage "unrecognized flag $FLAGRAW"
|
||||
;;
|
||||
|
|
@ -149,7 +156,7 @@ main() {
|
|||
runjob windows/arm64 'OS=windows ARCH=arm64 build' &
|
||||
waitjobs
|
||||
|
||||
runjob linux/dockerimage 'OS=linux build_docker_image' &
|
||||
runjob linux/docker build_docker &
|
||||
runjob windows/amd64/msi 'OS=windows ARCH=amd64 build_windows_msi' &
|
||||
waitjobs
|
||||
}
|
||||
|
|
@ -247,14 +254,20 @@ ARCHIVE=$ARCHIVE \
|
|||
sh_c rsync --archive --human-readable "$REMOTE_HOST:src/d2/$ARCHIVE" "$ARCHIVE"
|
||||
)}
|
||||
|
||||
build_docker_image() {
|
||||
D2_DOCKER_IMAGE=${D2_DOCKER_IMAGE:-terrastruct/d2}
|
||||
flags='--load'
|
||||
if [ -n "${PUSH_DOCKER-}" -o -n "${RELEASE-}" ]; then
|
||||
flags='--push --platform linux/amd64,linux/arm64'
|
||||
build_docker() {
|
||||
if [ -n "${LOCAL-}" ]; then
|
||||
sh_c ./ci/release/docker/build.sh \
|
||||
${PUSH_DOCKER:+--push} \
|
||||
${LATEST_DOCKER:+--latest}
|
||||
return 0
|
||||
fi
|
||||
sh_c rsync --archive --human-readable ./ci/release/Dockerfile_entrypoint.sh "./ci/release/build/$VERSION"
|
||||
sh_c docker buildx build $flags -t "$D2_DOCKER_IMAGE:$VERSION" -t "$D2_DOCKER_IMAGE:latest" --build-arg "VERSION=$VERSION" -f ./ci/release/Dockerfile "./ci/release/build/$VERSION"
|
||||
|
||||
sh_c lockfile_ssh "$CI_D2_LINUX_AMD64" .d2-build-lock
|
||||
sh_c gitsync "$CI_D2_LINUX_AMD64" src/d2
|
||||
sh_c ssh "$CI_D2_LINUX_AMD64" "D2_DOCKER_IMAGE=${D2_DOCKER_IMAGE-}" \
|
||||
./src/d2/ci/release/docker/build.sh \
|
||||
${PUSH_DOCKER:+--push} \
|
||||
${LATEST_DOCKER:+--latest}
|
||||
}
|
||||
|
||||
build_windows_msi() {
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@
|
|||
- `--force-appendix` flag adds an appendix to SVG outputs with tooltips or links. [#761](https://github.com/terrastruct/d2/pull/761)
|
||||
- `d2 themes` subcommand to list themes. [#760](https://github.com/terrastruct/d2/pull/760)
|
||||
- `sql_table` header left-aligned with column [#769](https://github.com/terrastruct/d2/pull/769)
|
||||
- Sequence diagram edge group labels are clearer [#782](https://github.com/terrastruct/d2/pull/782)
|
||||
|
||||
#### Bugfixes ⛑️
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ RUN curl -fsSL "https://github.com/boxboat/fixuid/releases/download/v0.5/fixuid-
|
|||
&& printf "user: debian\ngroup: debian\npaths: [/home/debian]\n" > /etc/fixuid/config.yml
|
||||
|
||||
COPY ./d2-*-linux-$TARGETARCH.tar.gz /tmp
|
||||
ADD ./Dockerfile_entrypoint.sh /usr/local/bin/entrypoint.sh
|
||||
ADD ./entrypoint.sh /usr/local/bin/entrypoint.sh
|
||||
RUN mkdir -p /usr/local/lib/d2 \
|
||||
&& tar -C /usr/local/lib/d2 -xzf /tmp/d2-*-linux-"$TARGETARCH".tar.gz \
|
||||
&& /usr/local/lib/d2/d2-*/scripts/install.sh \
|
||||
57
ci/release/docker/build.sh
Executable file
57
ci/release/docker/build.sh
Executable file
|
|
@ -0,0 +1,57 @@
|
|||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
. "$(dirname "$0")/../../../ci/sub/lib.sh"
|
||||
cd -- "$(dirname "$0")/../../.."
|
||||
|
||||
help() {
|
||||
cat <<EOF
|
||||
usage: $0 [-p|--push] [--latest] [
|
||||
EOF
|
||||
}
|
||||
|
||||
main() {
|
||||
while flag_parse "$@"; do
|
||||
case "$FLAG" in
|
||||
h|help)
|
||||
help
|
||||
return 0
|
||||
;;
|
||||
p|push)
|
||||
flag_noarg && shift "$FLAGSHIFT"
|
||||
PUSH=1
|
||||
;;
|
||||
latest)
|
||||
flag_noarg && shift "$FLAGSHIFT"
|
||||
LATEST=1
|
||||
;;
|
||||
*)
|
||||
flag_errusage "unrecognized flag $FLAGRAW"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
shift "$FLAGSHIFT"
|
||||
|
||||
if [ -z "${VERSION-}" ]; then
|
||||
VERSION=$(readlink ./ci/release/build/latest)
|
||||
fi
|
||||
D2_DOCKER_IMAGE=${D2_DOCKER_IMAGE:-terrastruct/d2}
|
||||
|
||||
sh_c mkdir -p "./ci/release/build/$VERSION/docker"
|
||||
sh_c cp "./ci/release/build/$VERSION/d2-$VERSION"-linux-*.tar.gz "./ci/release/build/$VERSION/docker/"
|
||||
sh_c cp ./ci/release/docker/entrypoint.sh "./ci/release/build/$VERSION/docker/entrypoint.sh"
|
||||
|
||||
flags='--load'
|
||||
if [ -n "${PUSH-}" -o -n "${RELEASE-}" ]; then
|
||||
flags='--push --platform linux/amd64,linux/arm64'
|
||||
fi
|
||||
if [ -n "${LATEST-}" -o -n "${RELEASE-}" ]; then
|
||||
flags="$flags -t $D2_DOCKER_IMAGE:latest"
|
||||
fi
|
||||
sh_c docker buildx build $flags \
|
||||
-t "$D2_DOCKER_IMAGE:$VERSION" \
|
||||
--build-arg "VERSION=$VERSION" \
|
||||
-f ./ci/release/docker/Dockerfile "./ci/release/build/$VERSION/docker"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
|
|
@ -169,6 +169,10 @@ func testPinned(t *testing.T, outDir string) {
|
|||
name: "orientation",
|
||||
text: "a: {\n b\n c\n }\n a <- a.c\n a.b -> a\n",
|
||||
},
|
||||
{
|
||||
name: "cannot create edge between boards",
|
||||
text: `"" <-> ""`,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
|
|
|
|||
|
|
@ -147,6 +147,9 @@ func toShape(obj *d2graph.Object, theme *d2themes.Theme) d2target.Shape {
|
|||
shape.LabelHeight = text.Dimensions.Height
|
||||
if obj.LabelPosition != nil {
|
||||
shape.LabelPosition = *obj.LabelPosition
|
||||
if obj.IsSequenceDiagramGroup() {
|
||||
shape.LabelFill = shape.Fill
|
||||
}
|
||||
}
|
||||
|
||||
shape.Tooltip = obj.Attributes.Tooltip
|
||||
|
|
@ -163,7 +166,6 @@ func toConnection(edge *d2graph.Edge, theme *d2themes.Theme) d2target.Connection
|
|||
connection := d2target.BaseConnection()
|
||||
connection.ID = edge.AbsID()
|
||||
connection.ZIndex = edge.ZIndex
|
||||
// edge.Edge.ID = go2.StringToIntHash(connection.ID)
|
||||
text := edge.Text()
|
||||
|
||||
if edge.SrcArrow {
|
||||
|
|
|
|||
|
|
@ -233,7 +233,7 @@ func NodeBoardKind(n Node) BoardKind {
|
|||
var f *Field
|
||||
switch n := n.(type) {
|
||||
case *Field:
|
||||
if n.Name == "" {
|
||||
if n.parent == nil {
|
||||
return BoardLayer
|
||||
}
|
||||
f = ParentField(n)
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
Before Width: | Height: | Size: 803 KiB After Width: | Height: | Size: 803 KiB |
|
|
@ -989,6 +989,16 @@ func drawShape(writer io.Writer, targetShape d2target.Shape, sketchRunner *d2ske
|
|||
x := labelTL.X + float64(targetShape.LabelWidth)/2.
|
||||
// text is vertically positioned at its baseline which is at labelTL+FontSize
|
||||
y := labelTL.Y + float64(targetShape.FontSize)
|
||||
|
||||
// background style does not exist for <text>, so draw a rectangle behind it to emulate
|
||||
if targetShape.LabelFill != "" {
|
||||
fmt.Fprintf(writer, `<rect x="%f" y="%f" width="%d" height="%d" fill="%s"></rect>`,
|
||||
labelTL.X, labelTL.Y,
|
||||
targetShape.LabelWidth, targetShape.LabelHeight,
|
||||
targetShape.LabelFill,
|
||||
)
|
||||
}
|
||||
|
||||
fmt.Fprintf(writer, `<text class="%s" x="%f" y="%f" style="%s">%s</text>`,
|
||||
fontClass,
|
||||
x, y,
|
||||
|
|
|
|||
|
|
@ -236,8 +236,9 @@ type Text struct {
|
|||
Bold bool `json:"bold"`
|
||||
Underline bool `json:"underline"`
|
||||
|
||||
LabelWidth int `json:"labelWidth"`
|
||||
LabelHeight int `json:"labelHeight"`
|
||||
LabelWidth int `json:"labelWidth"`
|
||||
LabelHeight int `json:"labelHeight"`
|
||||
LabelFill string `json:"labelFill,omitempty"`
|
||||
}
|
||||
|
||||
func BaseShape() *Shape {
|
||||
|
|
|
|||
1
testdata/d2exporter/TestExport/shape/sequence_group_position.exp.json
generated
vendored
1
testdata/d2exporter/TestExport/shape/sequence_group_position.exp.json
generated
vendored
|
|
@ -159,6 +159,7 @@
|
|||
"underline": false,
|
||||
"labelWidth": 0,
|
||||
"labelHeight": 0,
|
||||
"labelFill": "#DEE1EB",
|
||||
"zIndex": 3,
|
||||
"level": 2
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue