UI Library for Design Engineers. Animated components and effects you can copy and paste into your apps. Free. Open Source.
fix: update article script and workflow
Dillion Verma8211bafd386e
diff --git a/.github/scripts/publish-articles.cjs b/.github/scripts/publish-articles.cjsnew file mode 100644index 00000000..378bdf5b--- /dev/null+++ b/.github/scripts/publish-articles.cjs@@ -0,0 +1,31 @@+#!/usr/bin/env node+"use strict";++const fs = require("fs");+const path = require("path");+const yaml = require("js-yaml");++const payload = JSON.parse(fs.readFileSync("payload.json", "utf8"));+const articles = (payload && payload.data && payload.data.articles) || [];+if (!Array.isArray(articles) || articles.length === 0) process.exit(0);++const folder = path.join("apps", "www", "content", "blog");+fs.mkdirSync(folder, { recursive: true });++for (const a of articles) {+ const fmObj = {+ title: a.title || "",+ description: a.meta_description || "",+ image: a.image_url || "",+ author: "Dillion Verma",+ tags: Array.isArray(a.tags) ? a.tags : [],+ publishedOn: a.created_at || "",+ featured: true,+ };+ const fm =+ "---\n" + yaml.dump(fmObj, { noRefs: true, lineWidth: 0 }) + "---\n";+ const body = String(a.content_markdown || "");+ const file = path.join(folder, `${a.slug}.mdx`);+ fs.writeFileSync(file, fm + body, "utf8");+ console.log(`Wrote ${file}`);+}diff --git a/.github/workflows/publish-article.yml b/.github/workflows/publish-article.ymlindex f1026a1b..07edac00 100644--- a/.github/workflows/publish-article.yml+++ b/.github/workflows/publish-article.yml@@ -17,44 +17,22 @@ jobs:- uses: actions/checkout@v5with:ref: ${{ github.head_ref }}+ - name: Setup Node+ uses: actions/setup-node@v4+ with:+ node-version: 22+ cache: pnpm+ - name: Enable corepack+ run: corepack enable+ - name: Install dependencies+ run: pnpm -w i --frozen-lockfile- name: Save payloadrun: node -e "require('fs').writeFileSync('payload.json', process.env.PAYLOAD)"env:PAYLOAD: ${{ github.event.inputs.payload }}- name: Write blog posts- run: |- node - <<'EOF'- const fs = require('fs');- const path = require('path');-- const payload = JSON.parse(fs.readFileSync('payload.json', 'utf8'));-- for (const article of payload.data.articles) {- // folder and file name- const folder = path.join('apps', 'www', 'content', 'blog');- fs.mkdirSync(folder, { recursive: true });- const filePath = path.join(folder, `${article.slug}.mdx`);-- // build front-matter using YAML.stringify for safer escaping- const yaml = require('js-yaml');-- const frontMatter = {- title: article.title,- description: article.meta_description,- image: article.image_url,- author: "Dillion Verma",- tags: article.tags || [],- publishedOn: article.created_at,- featured: true- };-- const fm = '---\n' + yaml.dump(frontMatter) + '---\n';-- // write file with front-matter + markdown content- fs.writeFileSync(filePath, fm + article.content_markdown);- }- EOF+ run: node .github/scripts/publish-articles.cjs- name: Commit & pushrun: |diff --git a/package.json b/package.jsonindex c3056904..0c3b1844 100644--- a/package.json+++ b/package.json@@ -25,7 +25,8 @@},"devDependencies": {"prettier": "^3.6.2",- "turbo": "^2.5.6"+ "turbo": "^2.5.6",+ "js-yaml": "^4.1.0"},"engines": {"node": ">=22.14.0",