Clean up build video list

This commit is contained in:
Sam Carlton 2020-12-05 18:51:04 -06:00
parent e8f44a6d3f
commit ebd7446ee0

View file

@ -1,93 +1,7 @@
import { promises as fs } from 'fs'
import MarkdownIt from 'markdown-it'
import slugify from 'slugify'
import axios from 'axios'
import statuses from './statuses'
import parseGithubDate from './parse-github-date'
const md = new MarkdownIt()
const getTokenLinks = function ( childTokens ) {
const tokenList = []
let isLink = false
for (const token of childTokens) {
// On link_ switch link mode
// link_open = true
// link_close = false
if (token.type.includes('link_')) isLink = !isLink
// For link_open create a new related link in our list
// and store thee attributes into it
if ( isLink && token.type === 'link_open' ) {
tokenList.push({
...Object.fromEntries(token.attrs)
})
}
// For the text inside the link
// store that text as the label for the link we're inside
if ( isLink && token.type === 'text' ) {
// Get the last pushed link
const currentLink = tokenList[tokenList.length-1]
// Add our text to it as a label
tokenList[tokenList.length-1] = {
...currentLink,
label: token.content
}
}
}
return tokenList
}
const lookForLastUpdated = function (app, commits) {
for (const { node: commit } of commits) {
// console.log('commit', commit)
// $$ If message body contains endpoint
if (commit.messageBody.includes(app.endpoint)) {
// console.log('Found', app.name ,commit.committedDate)
return commit.committedDate
}
// $$ If message body contains App Name
if (commit.messageBody.includes(app.name)) {
// console.log('Found', app.name ,commit.committedDate)
return commit.committedDate
}
// $$ If message headline contains App Name
if (commit.messageHeadline.includes(app.name)) {
// console.log('Found', app.name ,commit.committedDate)
return commit.committedDate
}
// $$$ If commits comments contains endpoint
for (const { node: comment } of commit.comments.edges) {
if (comment.body.includes(app.endpoint)) {
// console.log('Found', app.name ,commit.committedDate)
return commit.committedDate
}
}
}
return null
}
const videoFeaturesApp = function (app, video) {
@ -105,8 +19,6 @@ const videoFeaturesApp = function (app, video) {
export default async function ( applist ) {
console.log('applist', applist.length)
// Fetch Commits
const response = await axios.get(process.env.VIDEO_SOURCE)
// Extract commit from response data