Skip to content
Open
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
70 changes: 69 additions & 1 deletion adaptors/intro.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,79 @@ adaptors is as follows:

In short, _most_ adaptors follow the naming convention `@openfn/language-xyz`.

## Adaptor Badges

OpenFn uses badges to label adaptors based on how they are built and maintained.
The scale being used is:

- <div id="core">
<div style={{display:'inline-flex', alignItems:'baseline', gap:'0.4rem', lineHeight: 1.25}}>
<span>Actively maintained adaptor : <b>Core</b></span>
<img
src="/img/heroicons--shield-check.svg"
width={16}
height={16}
alt="Core badge"
style={{verticalAlign:'-0.15em'}}
/>
</div>

<p style={{margin:'4px 0 0'}}>
Core adaptors are actively maintained by the OpenFn team and/or trusted partners.
They receive regular updates, security fixes, and documentation improvements.
</p>
</div>


- <div id="community">
<div style={{display:'inline-flex', alignItems:'baseline', gap:'0.4rem', lineHeight:1.25}}>
<span>Newly created adaptor by an external contributor: <b>Community</b></span>
<img
src="/img/heroicons--users.svg"
width={16}
height={16}
alt="Community badge"
style={{verticalAlign:'-0.15em'}}
/>
</div>

<p style={{margin:'4px 0 0'}}>
Community adaptors are contributed by external developers and may not follow a regular
maintenance cadence. Contributions and PRs are welcome.
</p>
</div>


- <div id="legacy">
<div style={{display:'inline-flex',alignItems:'baseline',gap:'0.4rem',lineHeight:1.25}}>
<span>Adaptors not actively maintained: <b>Legacy</b></span>
<img
src="/img/heroicons--cog.svg"
width={16}
height={16}
alt="Legacy badge"
style={{verticalAlign:'-0.15em'}}
/>
</div>
<p style={{margin:'4px 0 0'}}>
Legacy adaptors are not actively maintained and may not receive updates.
</p>
</div>


## Learn More About Adaptors

Explore this YouTube playlist to gain a deeper understanding of OpenFn adaptors.

<iframe width="560" height="315" src="https://www.youtube.com/embed/videoseries?si=mnfXiLEM83eUzADd&amp;list=PL1pD3-abjHJ1cSQAoMd_ODCU_AauvyZeL" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>
<iframe
width="560"
height="315"
src="https://www.youtube.com/embed/videoseries?si=mnfXiLEM83eUzADd&amp;list=PL1pD3-abjHJ1cSQAoMd_ODCU_AauvyZeL"
title="YouTube video player"
frameborder="0"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
allowfullscreen
></iframe>

## Adaptors vs. Workflows

Expand Down
41 changes: 36 additions & 5 deletions generate-adaptors/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,23 @@ const chokidar = require('chokidar');

const versions = [];

const badges = [
{
name: 'Core',
icon: `/img/heroicons--shield-check.svg`,
link: '/adaptors/#adaptor-badges',
},
{
name: 'Community',
icon: ` /img/heroicons--users.svg`,
link: '/adaptors/#adaptor-badges',
},
{
name: 'Legacy',
icon: ` /img/heroicons--cog.svg`,
link: '/adaptors/#adaptor-badges',
},
];
async function listVersions(next) {
const url = next || `https://api.github.com/repos/OpenFn/adaptors/tags`;

Expand Down Expand Up @@ -90,20 +107,25 @@ function pushToPaths(name) {
function generateJsDoc(a) {
// Add line break before </dt> tags and escape curly braces outside of code blocks
let docsContent = JSON.parse(a.docs).replace(/<\/dt>/g, '\n</dt>');

// Split content by code blocks (both inline ` and multi-line ```)
const codeBlockRegex = /(```[\s\S]*?```|`[^`]*`)/g;
const parts = docsContent.split(codeBlockRegex);

// Escape curly braces only in non-code parts (odd indices are code blocks)
for (let i = 0; i < parts.length; i++) {
if (i % 2 === 0) { // Non-code parts
if (i % 2 === 0) {
// Non-code parts
parts[i] = parts[i].replace(/{/g, '\\{').replace(/}/g, '\\}');
}
}

docsContent = parts.join('');

const icon = badges.find(
b => b.name?.toLowerCase() === a.badge?.toLowerCase()
);

return `---
title: ${a.name}@${a.version}
id: ${a.name}-docs
Expand All @@ -113,6 +135,16 @@ keywords:
${a.functions.length > 0 ? '- ' : ''}${a.functions.join('\r\n - ')}
---

<a
href="${icon?.link || '#'}"
class="badge-pill"
aria-label="${icon?.name || 'Badge'}"
>
<span>${icon?.name || ''}</span>
${icon?.icon ? `<img src="${icon.icon}" alt="" />` : ''}
</a>


${docsContent}`;
}

Expand Down Expand Up @@ -227,7 +259,6 @@ async function buildAdaptors(monorepoPath) {
if (!a.name) {
return;
}

const docsBody = generateJsDoc(a);
const readmeBody = generateReadme(a);
const changelogBody = generateChangelog(a);
Expand Down
20 changes: 19 additions & 1 deletion src/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,27 @@ html[data-theme='dark'] .header-github-link:before {

margin-bottom: 20px;
padding-top: 12px;
text-align: center;
text-align: center;
border: solid 1px #c0c0c0;
border-radius: 8px;
min-width: 300px;
max-width: 400px;
}

.badge-pill {
display: inline-flex;
align-items: center;
gap: 0.35rem;
padding: 5px 10px;
border: 1px solid var(--ifm-color-emphasis-300);
border-radius: 9999px;
background: rgb(225, 225, 230);
color: inherit;
text-decoration: none;
line-height: 1.1;
}
.badge-pill img {
width: 1.2em;
height: 1.2em;
transform: translateY(0.05em);
}
1 change: 1 addition & 0 deletions static/img/heroicons--cog.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions static/img/heroicons--shield-check.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions static/img/heroicons--users.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.