diff --git a/adaptors/intro.mdx b/adaptors/intro.mdx index 4dfe9bfdc9ac..d19c89c0f85d 100644 --- a/adaptors/intro.mdx +++ b/adaptors/intro.mdx @@ -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: + +-
+
+ Actively maintained adaptor : Core + Core badge +
+ +

+ Core adaptors are actively maintained by the OpenFn team and/or trusted partners. + They receive regular updates, security fixes, and documentation improvements. +

+
+ + +-
+
+ Newly created adaptor by an external contributor: Community + Community badge +
+ +

+ Community adaptors are contributed by external developers and may not follow a regular + maintenance cadence. Contributions and PRs are welcome. +

+
+ + +-
+
+ Adaptors not actively maintained: Legacy + Legacy badge +
+

+ Legacy adaptors are not actively maintained and may not receive updates. +

+
+ + ## Learn More About Adaptors Explore this YouTube playlist to gain a deeper understanding of OpenFn adaptors. - + ## Adaptors vs. Workflows diff --git a/generate-adaptors/index.js b/generate-adaptors/index.js index 88b4d2b66c85..e7a6dd734c1c 100644 --- a/generate-adaptors/index.js +++ b/generate-adaptors/index.js @@ -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`; @@ -90,20 +107,25 @@ function pushToPaths(name) { function generateJsDoc(a) { // Add line break before tags and escape curly braces outside of code blocks let docsContent = JSON.parse(a.docs).replace(/<\/dt>/g, '\n'); - + // 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 @@ -113,6 +135,16 @@ keywords: ${a.functions.length > 0 ? '- ' : ''}${a.functions.join('\r\n - ')} --- + + ${icon?.name || ''} + ${icon?.icon ? `` : ''} + + + ${docsContent}`; } @@ -227,7 +259,6 @@ async function buildAdaptors(monorepoPath) { if (!a.name) { return; } - const docsBody = generateJsDoc(a); const readmeBody = generateReadme(a); const changelogBody = generateChangelog(a); diff --git a/src/css/custom.css b/src/css/custom.css index 731ebccb56da..b3f92480f724 100644 --- a/src/css/custom.css +++ b/src/css/custom.css @@ -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); +} diff --git a/static/img/heroicons--cog.svg b/static/img/heroicons--cog.svg new file mode 100644 index 000000000000..45ac78a88b4e --- /dev/null +++ b/static/img/heroicons--cog.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/img/heroicons--shield-check.svg b/static/img/heroicons--shield-check.svg new file mode 100644 index 000000000000..c6bb0c7e1e12 --- /dev/null +++ b/static/img/heroicons--shield-check.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/img/heroicons--users.svg b/static/img/heroicons--users.svg new file mode 100644 index 000000000000..2f4fd3278179 --- /dev/null +++ b/static/img/heroicons--users.svg @@ -0,0 +1 @@ + \ No newline at end of file