Skip to content

Commit

Permalink
DF-19335 add known issues section to readme generator (#3090)
Browse files Browse the repository at this point in the history
* DF-19335 add known issues section to readme generator

* update readmes

* add changeset
  • Loading branch information
mmcallister-cll authored Nov 15, 2023
1 parent 985bf4e commit a1c6726
Show file tree
Hide file tree
Showing 7 changed files with 100 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .changeset/late-toys-lay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@chainlink/icap-adapter': patch
'@chainlink/tp-adapter': patch
'@chainlink/ea-scripts': patch
---

Add generated known issues section to readme
14 changes: 14 additions & 0 deletions packages/scripts/src/generate-readme/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
capitalize,
codeList,
getJsonFile,
getMdFile,
saveText,
wrapCode,
wrapJson,
Expand Down Expand Up @@ -77,6 +78,8 @@ export class ReadmeGenerator {
license: string
frameworkVersion: 'v2' | 'v3'
frameworkVersionBadgeUrl: string
knownIssuesPath: string
knownIssuesSection: string | null

constructor(adapter: WorkspaceAdapter, verbose = false) {
this.verbose = verbose
Expand All @@ -99,6 +102,7 @@ export class ReadmeGenerator {
this.frameworkVersionBadgeUrl = `https://img.shields.io/badge/framework%20version-${this.frameworkVersion}-blueviolet`
this.license = packageJson.license ?? ''

this.knownIssuesPath = this.adapterPath + 'docs/known-issues.md'
this.schemaPath = this.adapterPath + 'schemas/env.json'
this.rateLimitsPath = this.adapterPath + 'src/config/limits.json'
this.integrationTestPath = this.adapterPath + 'test/integration/*.test.ts'
Expand Down Expand Up @@ -173,12 +177,17 @@ export class ReadmeGenerator {
//Note, not populating description, doesn't exist in framework adapters
this.defaultEndpoint = adapter.defaultEndpoint ?? ''
}

if (fs.existsSync(this.knownIssuesPath)) {
this.knownIssuesSection = getMdFile(this.knownIssuesPath) || null
}
}

buildReadme(): void {
if (this.verbose) console.log(`${this.adapterPath}: Generating README text`)

this.addIntroSection()
this.addKnownIssuesSection()
this.addEnvVarSection()
this.addRateLimitSection()
this.addInputParamsSection()
Expand All @@ -198,6 +207,11 @@ export class ReadmeGenerator {
this.readmeText += `${genSig}\n\n`
}

addKnownIssuesSection(): void {
if (this.verbose) console.log(`${this.adapterPath}: Adding known issues`)
if (this.knownIssuesSection) this.readmeText += `${this.knownIssuesSection}\n\n`
}

addEnvVarSection(): void {
if (this.verbose) console.log(`${this.adapterPath}: Adding environment variables`)

Expand Down
1 change: 1 addition & 0 deletions packages/scripts/src/shared/docGenUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export const codeList = (a: (string | number)[] = []): string =>
.join(', ')

export const getJsonFile = (path: string): JsonObject => JSON.parse(cat(path).toString())
export const getMdFile = (path: string): string => cat(path).toString()

export const saveText = (fileData: FileData | FileData[]): void => {
if (!Array.isArray(fileData)) fileData = [fileData]
Expand Down
20 changes: 20 additions & 0 deletions packages/sources/icap/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,26 @@

This document was generated automatically. Please see [README Generator](../../scripts#readme-generator) for more info.

## Known Issues

### Concurrent connections

Context: TP and ICAP EAs use the same credentials, and often there are issues with the set of credentials not having concurrent (ie: 2+) connections enabled.

- With both TP and ICAP EAs off, try the following commands to check if this is the case:

```bash
wscat -c 'ws://json.mktdata.portal.apac.parametasolutions.com:12000'
```

- Once connected, send:

```json
{ "msg": "auth", "user": "USER_CRED", "pass": "API_KEY", "mode": "broadcast" }
```

- If credentials work for a single connection, open a second terminal and run the same commands while the first is still running. The expected behaviour is that both terminals should fire out a massive amount of price data.

## Environment Variables

| Required? | Name | Description | Type | Options | Default |
Expand Down
19 changes: 19 additions & 0 deletions packages/sources/icap/docs/known-issues.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
## Known Issues

### Concurrent connections

Context: TP and ICAP EAs use the same credentials, and often there are issues with the set of credentials not having concurrent (ie: 2+) connections enabled.

- With both TP and ICAP EAs off, try the following commands to check if this is the case:

```bash
wscat -c 'ws://json.mktdata.portal.apac.parametasolutions.com:12000'
```

- Once connected, send:

```json
{ "msg": "auth", "user": "USER_CRED", "pass": "API_KEY", "mode": "broadcast" }
```

- If credentials work for a single connection, open a second terminal and run the same commands while the first is still running. The expected behaviour is that both terminals should fire out a massive amount of price data.
20 changes: 20 additions & 0 deletions packages/sources/tp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,26 @@

This document was generated automatically. Please see [README Generator](../../scripts#readme-generator) for more info.

## Known Issues

### Concurrent connections

Context: TP and ICAP EAs use the same credentials, and often there are issues with the set of credentials not having concurrent (ie: 2+) connections enabled.

- With both TP and ICAP EAs off, try the following commands to check if this is the case:

```bash
wscat -c 'ws://json.mktdata.portal.apac.parametasolutions.com:12000'
```

- Once connected, send:

```json
{ "msg": "auth", "user": "USER_CRED", "pass": "API_KEY", "mode": "broadcast" }
```

- If credentials work for a single connection, open a second terminal and run the same commands while the first is still running. The expected behaviour is that both terminals should fire out a massive amount of price data.

## Environment Variables

| Required? | Name | Description | Type | Options | Default |
Expand Down
19 changes: 19 additions & 0 deletions packages/sources/tp/docs/known-issues.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
## Known Issues

### Concurrent connections

Context: TP and ICAP EAs use the same credentials, and often there are issues with the set of credentials not having concurrent (ie: 2+) connections enabled.

- With both TP and ICAP EAs off, try the following commands to check if this is the case:

```bash
wscat -c 'ws://json.mktdata.portal.apac.parametasolutions.com:12000'
```

- Once connected, send:

```json
{ "msg": "auth", "user": "USER_CRED", "pass": "API_KEY", "mode": "broadcast" }
```

- If credentials work for a single connection, open a second terminal and run the same commands while the first is still running. The expected behaviour is that both terminals should fire out a massive amount of price data.

0 comments on commit a1c6726

Please sign in to comment.