Skip to content

Commit

Permalink
fix readme image in Pypi
Browse files Browse the repository at this point in the history
  • Loading branch information
dphuang2 committed Oct 9, 2023
1 parent 348592d commit 7c3f165
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 14 deletions.
72 changes: 60 additions & 12 deletions generator/konfig-dash/api/src/functions/generate/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,11 @@ export const myHandler = async (event: APIGatewayEvent, context: Context) => {
},
config: {
additionalProperties: {
...prepareJavaRequestProperties({ body, git }),
...prepareJavaRequestProperties({
body,
git,
generatorConfig: body.generators.objc,
}),
omitInfoDescription: body.omitInfoDescription,
tagPriority: body.tagPriority,
readmeOperation: body.readmeOperation,
Expand Down Expand Up @@ -288,7 +292,11 @@ export const myHandler = async (event: APIGatewayEvent, context: Context) => {
},
config: {
additionalProperties: {
...prepareJavaRequestProperties({ body, git: generatorConfig.git }),
...prepareJavaRequestProperties({
body,
git: generatorConfig.git,
generatorConfig,
}),
omitInfoDescription: body.omitInfoDescription,
tagPriority: body.tagPriority,
readmeOperation: body.readmeOperation,
Expand Down Expand Up @@ -324,7 +332,11 @@ export const myHandler = async (event: APIGatewayEvent, context: Context) => {
},
config: {
additionalProperties: {
...prepareJavaRequestProperties({ body, git: generatorConfig.git }),
...prepareJavaRequestProperties({
body,
git: generatorConfig.git,
generatorConfig,
}),
omitInfoDescription: body.omitInfoDescription,
readmeSnippet: generatorConfig.readmeSnippet,
readmeSupportingDescriptionSnippet:
Expand Down Expand Up @@ -375,7 +387,11 @@ export const myHandler = async (event: APIGatewayEvent, context: Context) => {
},
config: {
additionalProperties: {
...prepareJavaRequestProperties({ body, git: generatorConfig.git }),
...prepareJavaRequestProperties({
body,
git: generatorConfig.git,
generatorConfig,
}),
omitInfoDescription: body.omitInfoDescription,
tagPriority: body.tagPriority,
readmeOperation: body.readmeOperation,
Expand Down Expand Up @@ -434,7 +450,11 @@ export const myHandler = async (event: APIGatewayEvent, context: Context) => {

config: {
additionalProperties: {
...prepareJavaRequestProperties({ body, git: generatorConfig.git }),
...prepareJavaRequestProperties({
body,
git: generatorConfig.git,
generatorConfig,
}),
omitInfoDescription: body.omitInfoDescription,
tagPriority: body.tagPriority,
readmeOperation: body.readmeOperation,
Expand Down Expand Up @@ -473,7 +493,11 @@ export const myHandler = async (event: APIGatewayEvent, context: Context) => {

config: {
additionalProperties: {
...prepareJavaRequestProperties({ body, git: generatorConfig.git }),
...prepareJavaRequestProperties({
body,
git: generatorConfig.git,
generatorConfig,
}),
omitInfoDescription: body.omitInfoDescription,
tagPriority: body.tagPriority,
readmeOperation: body.readmeOperation,
Expand Down Expand Up @@ -517,7 +541,11 @@ export const myHandler = async (event: APIGatewayEvent, context: Context) => {

config: {
additionalProperties: {
...prepareJavaRequestProperties({ body, git: generatorConfig.git }),
...prepareJavaRequestProperties({
body,
git: generatorConfig.git,
generatorConfig,
}),
useDescriptionInOperationTableDocumentation:
generatorConfig.useDescriptionInOperationTableDocumentation,
omitInfoDescription: body.omitInfoDescription,
Expand Down Expand Up @@ -662,7 +690,11 @@ async function queueGoGeneration({
config: {
outputDirectoryName,
additionalProperties: {
...prepareJavaRequestProperties({ body, git: generatorConfig.git }),
...prepareJavaRequestProperties({
body,
git: generatorConfig.git,
generatorConfig,
}),
omitInfoDescription: body.omitInfoDescription,
tagPriority: body.tagPriority,
readmeOperation: body.readmeOperation,
Expand Down Expand Up @@ -714,7 +746,11 @@ async function queuePhpGeneration({
config: {
outputDirectoryName,
additionalProperties: {
...prepareJavaRequestProperties({ body, git: generatorConfig.git }),
...prepareJavaRequestProperties({
body,
git: generatorConfig.git,
generatorConfig,
}),
omitInfoDescription: body.omitInfoDescription,
tagPriority: body.tagPriority,
readmeOperation: body.readmeOperation,
Expand Down Expand Up @@ -775,7 +811,11 @@ async function queueDartGeneration({
config: {
outputDirectoryName,
additionalProperties: {
...prepareJavaRequestProperties({ body, git: generatorConfig.git }),
...prepareJavaRequestProperties({
body,
git: generatorConfig.git,
generatorConfig,
}),
omitInfoDescription: body.omitInfoDescription,
tagPriority: body.tagPriority,
readmeOperation: body.readmeOperation,
Expand Down Expand Up @@ -844,7 +884,11 @@ async function queueJavaGeneration({
config: {
outputDirectoryName,
additionalProperties: {
...prepareJavaRequestProperties({ body, git: generatorConfig.git }),
...prepareJavaRequestProperties({
body,
git: generatorConfig.git,
generatorConfig,
}),
omitInfoDescription: body.omitInfoDescription,
tagPriority: body.tagPriority,
readmeOperation: body.readmeOperation,
Expand Down Expand Up @@ -927,7 +971,11 @@ async function queueTypeScriptGeneration({
config: {
outputDirectoryName, // this is so the directory name from additionalGenerators does not conflict with the one under generators
additionalProperties: {
...prepareJavaRequestProperties({ body, git: generatorConfig.git }),
...prepareJavaRequestProperties({
body,
git: generatorConfig.git,
generatorConfig,
}),
omitInfoDescription: body.omitInfoDescription,
tagPriority: body.tagPriority,
readmeOperation: body.readmeOperation,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import { GenerateRequestBodyType, GeneratorGitConfig } from 'konfig-lib'
import {
GenerateRequestBodyType,
GeneratorGitConfig,
KonfigYamlAdditionalGeneratorConfig,
KonfigYamlGeneratorConfig,
} from 'konfig-lib'

/**
* Used in preparation to send a request to the Java generator API for all
Expand All @@ -16,9 +21,13 @@ import { GenerateRequestBodyType, GeneratorGitConfig } from 'konfig-lib'
export function prepareJavaRequestProperties({
body,
git,
generatorConfig,
}: {
body: GenerateRequestBodyType
git: GeneratorGitConfig
generatorConfig:
| KonfigYamlGeneratorConfig
| KonfigYamlAdditionalGeneratorConfig
}): Record<string, unknown> {
const properties: Record<string, unknown> = {}

Expand All @@ -29,6 +38,14 @@ export function prepareJavaRequestProperties({
}
}

if ('repoName' in git) {
properties['gitRepoName'] = git.repoName
}

if ('outputDirectory' in generatorConfig) {
properties['outputDirectory'] = generatorConfig.outputDirectory
}

if ('defaultBranch' in git) {
properties['gitDefaultBranch'] = git.defaultBranch
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{{#with readmeHeader}}
<div align="center">

[![Visit {{{title}}}](./header.png)]({{{url}}})
[![Visit {{{title}}}](https://raw.githubusercontent.com/{{gitUserId}}/{{gitRepoName}}/HEAD/{{{@root.outputDirectory}}}/header.png)]({{{url}}})

# {{{title}}}

Expand Down

0 comments on commit 7c3f165

Please sign in to comment.