diff --git a/app/article-data.js b/app/article-data.js index ba616dc..b650e9a 100644 --- a/app/article-data.js +++ b/app/article-data.js @@ -26,17 +26,7 @@ let articles = "published": true, "title": "Detangling the Standup: Status Reports, Team Planning, Context Sharing, and Community Building", "date": "2022-01-04", - "description": `Standups are often applied without understanding the problem they are solving. This leads to: -
-
    -
  1. Not clearly solving a specific problem
  2. -
  3. Not solving a problem with the best solution
  4. -
  5. A daily interruption to deep work
  6. -
- What follows is a pragmatic and ideal approach to resolving this situation. - The pragmatic approach is to understand so you can excel within that system. - The ideal solution tries to change the system to better serve the team. - ` + "description": "Standups are often applied without understanding the problem they are solving. This leads to:
  1. Not clearly solving a specific problem
  2. Not solving a problem with the best solution
  3. A daily interruption to deep work
What follows is a pragmatic and ideal approach to resolving this situation. The pragmatic approach is to understand so you can excel within that system. The ideal solution tries to change the system to better serve the team." }, { "slug": "detangling-the-manager", diff --git a/lib/scan-dir.js b/lib/scan-dir.js index 26a444e..7307511 100644 --- a/lib/scan-dir.js +++ b/lib/scan-dir.js @@ -1,17 +1,26 @@ let fs = require('fs'); let { join } = require('path'); +function tryParseJSON(jsonText, originalFilePath) { + try { + return JSON.parse(jsonText); + } catch (error) { + console.log(`JSON Parse Error of "${originalFilePath}": ${error.message}\nText:\n${jsonText}`); + } +} + module.exports = async function ({ distDir, visit }) { /* We haev to convert the module format into json because no other mechanism for share this data worked between ember build (node, commonjs) and the project code (browser, module). */ - let articleData = fs.readFileSync(join(__dirname, '/../app/article-data.js')).toString(); + let articlePath = join(__dirname, '/../app/article-data.js'); + let articleData = fs.readFileSync(articlePath).toString(); let trimmedArticleData = articleData .replace('let articles =', '') .replace('export default articles;', ''); - let articles = JSON.parse(trimmedArticleData); + let articles = tryParseJSON(trimmedArticleData, articlePath); let articleUrls = articles.map((a) => { return '/blog/' + a.slug.replace(/\./g, '/'); });