How to use the markdown-magic.fsExtra.readFileSync function in markdown-magic

To help you get started, we’ve selected a few markdown-magic examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github serverless / blog / validate.js View on Github external
paths.forEach((file) => {
      const fp = path.join(authorDirectory, file)
      if (file.match(/\.json/)) {
        const author = fs.readFileSync(fp, 'utf8')
        const valid = hasSameProps(authorData, JSON.parse(author))
        if (!valid) {
          const msg = `${file} has missing value in author profile.
Author data must match (if no value applies use false):
${JSON.stringify(authorData, null, 2)}`
          throw new Error(msg)
        }
      } else {
        // not json throw error
        throw new Error(`${file} file type not allowed in authors directory ${file}`);
      }
    })
github serverless / blog / validate.js View on Github external
paths.forEach((file) => {
    const postPath = path.join(postsDirectory, file)
    if (file.match(dateFormatRegex)) {
      const post = fs.readFileSync(postPath, 'utf8')
      const postData = yml(post).data
      let msg
      if (isEmptyObject(postData)) {
        msg = `no yaml found in post or YAML is malformed! Please update ${file}`
        throw new Error(msg)
      }

      if (!postData.title) {
msg = `No title found in post YAML

Please update ${file}

---- The description format is -----

title: "My 50-60 character Human & Keyword Friendly title"

markdown-magic

Automatically update markdown files with content from external sources

MIT
Latest version published 4 months ago

Package Health Score

72 / 100
Full package analysis

Similar packages