Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion cmd/nbe/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ var (
Deno,
Node,
Rust,
CSharp,
DotNet,
Java,
Ruby,
Elixir,
Expand Down Expand Up @@ -389,6 +389,8 @@ func chromaFormat(code, lang string) (string, error) {
lang = "js"
case WebSocket:
lang = "js"
case DotNet:
lang = "cs"
}

lexer := lexers.Get(lang)
Expand Down
21 changes: 12 additions & 9 deletions cmd/nbe/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const (
Go = "go"
Rust = "rust"
Java = "java"
CSharp = "csharp"
DotNet = "dotnet"
Deno = "deno"
Node = "node"
Bun = "bun"
Expand All @@ -40,7 +40,7 @@ var (
Go: "Go",
Rust: "Rust",
Java: "Java",
CSharp: "C#",
DotNet: "C#",
Deno: "Deno",
Node: "Node",
Bun: "Bun",
Expand All @@ -63,14 +63,15 @@ var (
Node: "main.js",
WebSocket: "main.js",
Java: "Main.java",
DotNet: "Main.cs",
}

languageMultiCommentDelims = map[string][2]string{
Go: {"/*", "*/"},
// TODO: java has a few conventions..
// https://www.oracle.com/java/technologies/javase/codeconventions-comments.html
Java: {"/*", "*/"},
CSharp: {"/**", "**/"},
DotNet: {"/**", "**/"},
Deno: {"/*", "*/"},
Node: {"/*", "*/"},
Bun: {"/*", "*/"},
Expand All @@ -84,7 +85,7 @@ var (
Go: "//",
Rust: "//",
Java: "//",
CSharp: "///",
DotNet: "//",
Deno: "//",
Node: "//",
Bun: "//",
Expand Down Expand Up @@ -162,10 +163,12 @@ var (

// One limitiation is that it does not currently handle trailing multi-line
// comments, such as:
// func() int {/*
// a := 1
// */
// b := 2
//
// func() int {/*
// a := 1
// */
// b := 2
//
// Since this code is scoped to well written examples, it should not be an issue
// in practice.
func parseLineType(lang, line string) LineType {
Expand All @@ -183,7 +186,7 @@ func parseLineType(lang, line string) LineType {
}
return NormalLine

case Go, CSharp, Java, Rust, C, Deno, Node, Bun:
case Go, DotNet, Java, Rust, C, Deno, Node, Bun:
if cStyleSingleCommentLineRe.MatchString(line) {
return SingleCommentLine
}
Expand Down
17 changes: 17 additions & 0 deletions docker/dotnet/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# https://hub.docker.com/_/microsoft-dotnet
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
WORKDIR /source

# copy csproj and restore as distinct layers
COPY *.csproj .
RUN dotnet restore --use-current-runtime

# copy and publish app and libraries
COPY . .
RUN dotnet publish -c Release -o /app --use-current-runtime --self-contained false --no-restore

# final stage/image
FROM mcr.microsoft.com/dotnet/runtime:7.0
WORKDIR /app
COPY --from=build /app .
ENTRYPOINT ["dotnet", "example.dll"]
15 changes: 15 additions & 0 deletions docker/dotnet/example.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<Title>NATS by Example</Title>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="NATS.Client" Version="1.0.2"></PackageReference>
</ItemGroup>

</Project>
29 changes: 29 additions & 0 deletions examples/issues/3724/cli/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
FROM golang:1.19-alpine3.17 AS build

RUN go install github.com/nats-io/natscli/nats@latest #allow-online-peer-remove
RUN go install github.com/nats-io/nats-server/v2@main

FROM natsio/nats-box:0.13.2

RUN apk add bash curl

COPY --from=build /go/bin/nats-server /usr/local/bin/
COPY --from=build /go/bin/nats /usr/local/bin/

COPY . .

ENTRYPOINT ["bash"]

CMD ["main.sh"]

#FROM natsio/nats-box:0.13.3

#RUN apk add bash curl

#COPY --from=nats:2.9.10 /nats-server /usr/local/bin/

#COPY . .

#ENTRYPOINT ["bash"]

#CMD ["main.sh"]
Loading