Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"name": "David Wells",
"github": "davidwells",
"avatar": "https://avatars2.githubusercontent.com/u/532272?v=3&s=60",
"bio": {
"short": "David Wells is a developer at Serverless, Inc.",
"long": "David is a Full Stack JavaScript Developer, entrepreneur, past life marketer. Developer @ http://serverless.com "
}
}
const authorArray = fs.readdirSync(authorDirectory).map((author) =>{
return author.replace('.json', '')
})
// test author directory
globby(['*', '!node_modules'], {
cwd: authorDirectory
}).then(paths => {
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}`);
module.exports = function prepopulateTalks() {
console.log('prepopulate Talk content')
globby([`${talksContentPath}/*.md`]).then((files) => {
const markdownContent = []
files.forEach((f) => {
const fileContent = fs.readFileSync(f, 'utf-8')
const item = matter(fileContent).data
const base = `${path.basename(path.dirname(f))}/${path.basename(f, '.md')}`
const slug = base.replace(/[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])-/g, '')
const data = {
title: item.title,
date: item.date,
event: item.event,
url: `https://davidwells.io/${slug}`
}
if (item.date) {
markdownContent.push(data)
}
})
const globby = require('markdown-magic').globby
const fs = require('fs-extra')
const path = require('path')
const matter = require('gray-matter')
globby('*.md').then((files) => {
let count = 0
const news = []
files.forEach((f) => {
const content = fs.readFileSync(f, 'utf-8')
const item = matter(content).data
if (item.external_post_url) {
const url = item.external_post_url['0']
const data = {
title: item.title,
date: item.date,
url: url
}
//console.log(data)
news.push(data)
count++
module.exports = function prepopulateBlog() {
console.log('prepopulate blog content')
const externalContent = fs.readFileSync(externalContentPath, 'utf-8')
const externalPosts = JSON.parse(externalContent)
globby([`${blogContentPath}/*.md`, `${snippetsContentPath}/*.md`]).then((files) => {
const markdownContent = []
files.forEach((f) => {
const fileContent = fs.readFileSync(f, 'utf-8')
const item = matter(fileContent).data
const base = `${path.basename(path.dirname(f))}/${path.basename(f, '.md')}`
const slug = base.replace(/[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])-/g, '')
const data = {
title: item.title,
date: item.date,
url: `https://davidwells.io/${slug}`
}
if (item.date) {
markdownContent.push(data)
}
})
async function getFiles() {
const topLevelPackages = [`${PACKAGE_PATH}/*/package.json`]
const files = await globby(topLevelPackages)
const collectInfo = files.map(async (file) => {
const pkg = require(file)
const slug = pkg.name.replace(/^@analytics\//, '')
const directory = path.dirname(file)
const docFilePath = path.join(PLUGIN_DOC_PATH, `${slug}.md`)
const exists = await fileExists(docFilePath)
return {
pkg: pkg,
dir: directory,
exists: exists,
repoMdPath: path.resolve(directory, 'README.md'),
docPath: CUSTOM_MAPPING[pkg.name] || docFilePath
}
})
const fileData = await Promise.all(collectInfo)