Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate connector docs #200

Merged
merged 36 commits into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
f085fe0
Generate connector docs from connector.yaml
hariso Dec 4, 2024
f716f34
fix template
hariso Dec 4, 2024
016b3e1
generate docs
hariso Dec 4, 2024
332cca3
tag stuff fixed
hariso Dec 4, 2024
bd1a7fa
generate
hariso Dec 4, 2024
2e8fcef
add destination
hariso Dec 4, 2024
73f41cd
changes for connector foo
hariso Dec 4, 2024
f1fa991
remove hack
hariso Dec 4, 2024
44504a4
refactor
hariso Dec 5, 2024
1b9c584
handle case when there are no assets
hariso Dec 6, 2024
e9c25a6
do not edit note
hariso Dec 6, 2024
b485bb3
updates
hariso Dec 6, 2024
622cc2c
build docs page
hariso Dec 6, 2024
92a126e
generate connectors.json
hariso Dec 6, 2024
fe92c50
cleanup docs path
hariso Dec 9, 2024
9502787
update template
hariso Dec 9, 2024
9047989
remove temp
hariso Dec 9, 2024
8eac274
re-generate
hariso Dec 9, 2024
9d76b93
re-organize
hariso Dec 9, 2024
c70c6c7
re-organize
hariso Dec 9, 2024
48419c9
re-generate
hariso Dec 9, 2024
8cbfef4
Merge branch 'main' into haris/generate-connector-docs
hariso Dec 9, 2024
3cb54d9
Merge branch 'main' into haris/generate-connector-docs
hariso Dec 20, 2024
d84494d
latest release only
hariso Dec 20, 2024
29e8c0a
Merge branch 'haris/generate-connector-docs' of github.com:ConduitIO/…
hariso Dec 20, 2024
9d6e842
fix template
hariso Dec 20, 2024
9b5b62c
clean up
hariso Dec 20, 2024
288aebc
Try with NonExpandableAccordion
hariso Dec 20, 2024
75298c8
style custom connectors
raulb Dec 20, 2024
b5487e2
add width
hariso Dec 20, 2024
1660aa3
fix template
hariso Dec 20, 2024
ed77f8e
exclude test repos
hariso Dec 20, 2024
a96c8d3
Merge branch 'main' into haris/generate-connector-docs
raulb Jan 8, 2025
8075ec6
update action
hariso Jan 8, 2025
7de76ff
Merge branch 'haris/generate-connector-docs' of github.com:ConduitIO/…
hariso Jan 8, 2025
c3576a6
Update src/connectorgen/generate_docs.go
hariso Jan 8, 2025
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
9 changes: 8 additions & 1 deletion src/components/ConnectorList/ConnectorAccordion/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ import Stack from '@mui/material/Stack';
import Typography from '@mui/material/Typography';
import Tooltip from '@mui/material/Tooltip';
import ReleaseAccordion, {Release} from "@site/src/components/ConnectorList/ReleaseAccordion";
import Link from '@mui/material/Link';

export class Connector {
nameWithOwner: string;
description: string;
url: string;
conduitIODocsPage: string;
created_at: string;
stargazerCount: number;
forkCount: number;
Expand Down Expand Up @@ -64,7 +66,12 @@ export const ConnectorAccordionSummary = styled((props: ConnectorAccordionSummar
<Typography variant='body1'>{props.connector.nameWithOwner}</Typography>
<Typography variant='body2' className='color-6b7280' >{props.connector.description}</Typography>
</Stack>
<Stack className='align-items-center' direction='row' justifyContent='flex-end' spacing={1} >
<Stack className='align-items-center' direction='row' justifyContent='flex-end' spacing={2} >
{
(props.connector.conduitIODocsPage && props.connector.conduitIODocsPage.trim() !== "")
? <Link href={props.connector.conduitIODocsPage}>View docs</Link>
: null
}
{
props.connector.nameWithOwner.toLowerCase().startsWith('conduitio/') || props.connector.nameWithOwner.toLowerCase().startsWith('conduitio-labs/')
? <Tooltip title="Created by the Conduit team"><img src='/img/conduit/conduit-ring.png' width='18'/></Tooltip>
Expand Down
2 changes: 1 addition & 1 deletion src/components/ConnectorList/ReleaseAccordion/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ const ReleaseAccordion = styled((props: IAccordionProps) => (
</TableRow>
</TableHead>
<TableBody>
{props.release.assets.map(asset => (
{props.release.assets?.map(asset => (
<TableRow key={asset.name} >
<TableCell>
<a href={asset.browser_download_url}>{asset.name}</a>
Expand Down
2 changes: 1 addition & 1 deletion src/connectorgen/Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
.PHONY: generate
generate:
go run main.go ../../static/connectors.json
go run main.go ../../static/connectors.json "../../docs/1-using/4-connectors/7-list"
103 changes: 103 additions & 0 deletions src/connectorgen/connector-docs-mdx.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
---
IMPORTANT: This file was generated using src/connectorgen/main.go. DO NOT EDIT.

title: "{{ .Specification.Name }}"
description: "{{ .Specification.Summary }}"
---

import ReactDiffViewer from 'react-diff-viewer';
import Chip from '@mui/material/Chip';
import Box from "@mui/system/Box";
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import GitHubIcon from '@mui/icons-material/GitHub';
import IconButton from '@mui/material/IconButton';
import Stack from '@mui/material/Stack';
import Link from '@mui/material/Link';
import StarIcon from '@mui/icons-material/Star';
import Tooltip from '@mui/material/Tooltip';

# {{ .Specification.Name }}

<Stack className='align-items-center' direction='row' justifyContent='flex-start' spacing={2} >
{{if or (lower .NameWithOwner | hasPrefix "conduitio/") (lower .NameWithOwner | hasPrefix "conduitio-labs/")}}
<Tooltip title="Created by the Conduit team"><img src='/img/conduit/conduit-ring.png' width='18'/></Tooltip>
{{ end }}

<IconButton size='large' href="{{ .URL }}" target='_blank' >
<GitHubIcon fontSize='inherit' />
</IconButton>

<Chip icon={<StarIcon />} label="{{ .Stargazers }}" size='large' />

</Stack>

## Author

{{ .Specification.Author }}

## Latest release

{{- if .Releases }}
{{- range $i, $rel := .Releases }}
{{- if $rel.IsLatest }}
{{- range $i, $asset := $rel.Assets }}
- [{{ $asset.Name }}]({{ $asset.BrowserDownload }})
{{- end }}
{{- end }}
{{- end }}
{{- end }}

## Description

{{ .Specification.Description }}

## Source Parameters

{{- if gt (len .Specification.Source.Parameters) 0 }}
```yaml
version: 2.2
pipelines:
- id: example
status: running
connectors:
- id: example-source
type: source
plugin: "{{ .Specification.Name }}"
name: example-source
{{ if gt (len .Specification.Source.Parameters) 0 -}}
settings:
{{- range $name, $param := .Specification.Source.Parameters }}
{{ formatParameterDescriptionYAML $param.Description }}
# Type: {{ $param.Type }}
{{ $param.Name }}: {{ formatParameterValueYAML $param.Default }}
{{- end }}
{{- end }}
```
{{- else }}
Reading data with {{ .Specification.Name }} is not supported.
{{- end }}

## Destination Parameters

{{- if gt (len .Specification.Destination.Parameters) 0 }}
```yaml
version: 2.2
pipelines:
- id: example
status: running
connectors:
- id: example-destination
type: destination
plugin: "{{ .Specification.Name }}"
name: example-destination
settings:
{{- range $name, $param := .Specification.Destination.Parameters }}
{{ formatParameterDescriptionYAML $param.Description }}
# Type: {{ $param.Type }}
{{ $param.Name }}: {{ formatParameterValueYAML $param.Default }}
{{- end }}
```
{{- else }}
Writing data with {{ .Specification.Name }} is not supported.
{{- end }}
29 changes: 29 additions & 0 deletions src/connectorgen/generate_docs.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Copyright © 2024 Meroxa, Inc.
hariso marked this conversation as resolved.
Show resolved Hide resolved
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package main

import (
"context"
"fmt"
"log"
"os"
"path/filepath"
"strings"
"text/template"

"github.com/Masterminds/sprig/v3"
"github.com/conduitio/yaml/v3"
"github.com/google/go-github/v67/github"
)
16 changes: 14 additions & 2 deletions src/connectorgen/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,25 @@ module github.com/conduitio/connectors-list
go 1.22.0

require (
github.com/goccy/go-json v0.10.2
github.com/Masterminds/sprig/v3 v3.3.0
github.com/conduitio/yaml/v3 v3.3.0
github.com/goccy/go-json v0.10.3
github.com/gofri/go-github-ratelimit v1.1.0
github.com/google/go-github/v61 v61.0.0
github.com/google/go-github/v67 v67.0.0
github.com/otiai10/gh-dependents v0.3.0
)

require (
dario.cat/mergo v1.0.1 // indirect
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver/v3 v3.3.0 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/huandu/xstrings v1.5.0 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/shopspring/decimal v1.4.0 // indirect
github.com/spf13/cast v1.7.0 // indirect
golang.org/x/crypto v0.26.0 // indirect
golang.org/x/net v0.22.0 // indirect
)
52 changes: 48 additions & 4 deletions src/connectorgen/go.sum
Original file line number Diff line number Diff line change
@@ -1,21 +1,59 @@
github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU=
github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
dario.cat/mergo v1.0.1 h1:Ra4+bf83h2ztPIQYNP99R6m+Y7KfnARDfID+a+vLl4s=
dario.cat/mergo v1.0.1/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk=
github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI=
github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU=
github.com/Masterminds/semver/v3 v3.3.0 h1:B8LGeaivUe71a5qox1ICM/JLl0NqZSW5CHyL+hmvYS0=
github.com/Masterminds/semver/v3 v3.3.0/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM=
github.com/Masterminds/sprig/v3 v3.3.0 h1:mQh0Yrg1XPo6vjYXgtf5OtijNAKJRNcTdOOGZe3tPhs=
github.com/Masterminds/sprig/v3 v3.3.0/go.mod h1:Zy1iXRYNqNLUolqCpL4uhk6SHUMAOSCzdgBfDb35Lz0=
github.com/conduitio/yaml/v3 v3.3.0 h1:kbbaOSHcuH39gP4+rgbJGl6DSbLZcJgEaBvkEXJlCsI=
github.com/conduitio/yaml/v3 v3.3.0/go.mod h1:JNgFMOX1t8W4YJuRZOh6GggVtSMsgP9XgTw+7dIenpc=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8=
github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0=
github.com/goccy/go-json v0.10.3 h1:KZ5WoDbxAIgm2HNbYckL0se1fHD6rz5j4ywS6ebzDqA=
github.com/goccy/go-json v0.10.3/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M=
github.com/gofri/go-github-ratelimit v1.1.0 h1:ijQ2bcv5pjZXNil5FiwglCg8wc9s8EgjTmNkqjw8nuk=
github.com/gofri/go-github-ratelimit v1.1.0/go.mod h1:OnCi5gV+hAG/LMR7llGhU7yHt44se9sYgKPnafoL7RY=
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-github/v61 v61.0.0 h1:VwQCBwhyE9JclCI+22/7mLB1PuU9eowCXKY5pNlu1go=
github.com/google/go-github/v61 v61.0.0/go.mod h1:0WR+KmsWX75G2EbpyGsGmradjo3IiciuI4BmdVCobQY=
github.com/google/go-github/v67 v67.0.0 h1:g11NDAmfaBaCO8qYdI9fsmbaRipHNWRIU/2YGvlh4rg=
github.com/google/go-github/v67 v67.0.0/go.mod h1:zH3K7BxjFndr9QSeFibx4lTKkYS3K9nDanoI1NjaOtY=
github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8=
github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/huandu/xstrings v1.5.0 h1:2ag3IFq9ZDANvthTwTiqSSZLjDc+BedvHPAp5tJy2TI=
github.com/huandu/xstrings v1.5.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw=
github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s=
github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ=
github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=
github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE=
github.com/otiai10/curr v1.0.0/go.mod h1:LskTG5wDwr8Rs+nNQ+1LlxRjAtTZZjtJW4rMXl6j4vs=
github.com/otiai10/gh-dependents v0.3.0 h1:xLsT1gXL38KjpAvRa6hO0ajNu2ySUlM8h4qtOX51UzQ=
github.com/otiai10/gh-dependents v0.3.0/go.mod h1:5iYNC7oFAMa1H7LTO1eXNfkDumBQW5jJFmvOXFammQ4=
github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT91xUo=
github.com/otiai10/mint v1.3.3 h1:7JgpsBaN0uMkyju4tbYHu0mnM55hNKVYLsXmwr15NQI=
github.com/otiai10/mint v1.3.3/go.mod h1:/yxELlJQ0ufhjUwhshSj+wFjZ78CnZ48/1wtmBH1OTc=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
github.com/shopspring/decimal v1.4.0 h1:bxl37RwXBklmTi0C79JfXCEBD1cqqHt0bbgBAGFp81k=
github.com/shopspring/decimal v1.4.0/go.mod h1:gawqmDU56v4yIKSwfBSFip1HdCCXN8/+DMd9qYNcwME=
github.com/spf13/cast v1.7.0 h1:ntdiHjuueXFgm5nzDRdOS4yfT43P5Fnud6DH50rz/7w=
github.com/spf13/cast v1.7.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo=
github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4=
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
golang.org/x/crypto v0.26.0 h1:RrRspgV4mU+YwB4FYnuBoKsUapNIL5cohGAmSH3azsw=
golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54=
golang.org/x/net v0.0.0-20210825183410-e898025ed96a/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.22.0 h1:9sGLhx7iRIHEiX0oAJ3MRZMUCElJgy7Br1nO+AMN3Tc=
golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg=
Expand All @@ -25,3 +63,9 @@ golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9sn
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU=
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
Loading