From 232bec6f14f02c887da71ce8ef4748ee29dafe5a Mon Sep 17 00:00:00 2001 From: Joe Clark Date: Mon, 4 Nov 2024 18:15:58 +0000 Subject: [PATCH] don't generate examples for jobs with no expression (#597) --- generate-library/index.js | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/generate-library/index.js b/generate-library/index.js index 4691f0b6f20..a54a89e1d8d 100644 --- a/generate-library/index.js +++ b/generate-library/index.js @@ -150,21 +150,25 @@ module.exports = function (context, { apiUrl }) { console.log('Done ✓'); console.log('Parsing public jobs API data...'); - jobs.map(j => { - const uniqueName = `${j.name.trim()}-${hDate(j.inserted_at)}` - .replace(/[^a-z0-9_-]/gi, '-') - .replace(/-{2,}/g, '-') - .replace(/^[-,\[]/, ''); - - const keywords = getKeywords(j.expression); - const body = generateBody(j, uniqueName, keywords); - - pushToPaths(j, uniqueName); - fs.writeFileSync( - `./adaptors/library/jobs/auto/${uniqueName}.md`, - body - ); - }); + jobs + .filter(j => { + return j.expression && j.expression !== '// Your job goes here.'; + }) + .map(j => { + const uniqueName = `${j.name.trim()}-${hDate(j.inserted_at)}` + .replace(/[^a-z0-9_-]/gi, '-') + .replace(/-{2,}/g, '-') + .replace(/^[-,\[]/, ''); + + const keywords = getKeywords(j.expression); + const body = generateBody(j, uniqueName, keywords); + + pushToPaths(j, uniqueName); + fs.writeFileSync( + `./adaptors/library/jobs/auto/${uniqueName}.md`, + body + ); + }); console.log('Done ✓'); console.log('Creating sidebar paths...');