-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrenderCargo.ts
More file actions
28 lines (25 loc) · 952 Bytes
/
renderCargo.ts
File metadata and controls
28 lines (25 loc) · 952 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import { FormatHelpers } from '@asyncapi/modelina';
import { RenderFile } from './renderFile';
import { InfoInterface } from '@asyncapi/parser';
function content(info: InfoInterface, exchangeName: string): string {
const exchange = FormatHelpers.toSnakeCase(exchangeName);
return `
[package]
name = "exchange-collection-ws-${exchange}"
version = "${info.version()}"
description = "${info.description()?.replace(/"/g, '\\"').replace(/\n/g, '\\n')}"
edition = "2018"
# use workspace when needed
[dependencies]
tokio = { version = "1.41.0", features = ["full"] }
tokio-tungstenite = { version = "0.24.0", features = ["native-tls"] }
futures = "0.3.31"
futures-util = "0.3.31"
serde = { version = "1.0.214", features = ["derive"] }
serde_json = "1.0.132"
typed-websocket = "0.1.0"
`.trimStart();
}
export function renderCargo(info: InfoInterface, exchangeName: string): RenderFile {
return new RenderFile("Cargo.toml", content(info, exchangeName));
}