mirror of
https://github.com/ThatGuySam/doesitarm.git
synced 2026-05-18 06:44:46 -07:00
Make app endpoints a generated value
This commit is contained in:
parent
ea17b014af
commit
63c405943e
7 changed files with 56 additions and 20 deletions
|
|
@ -75,7 +75,7 @@
|
||||||
>
|
>
|
||||||
<!-- app.endpoint: {{ app.endpoint }} -->
|
<!-- app.endpoint: {{ app.endpoint }} -->
|
||||||
<a
|
<a
|
||||||
:href="app.endpoint"
|
:href="getAppEndpoint(app)"
|
||||||
class="flex flex-col justify-center inset-x-0 hover:bg-darkest border-2 border-white border-opacity-0 hover:border-opacity-50 focus:outline-none focus:bg-gray-50 duration-300 ease-in-out rounded-lg space-y-2 -mx-5 pl-5 md:pl-20 pr-6 md:pr-64 py-6 "
|
class="flex flex-col justify-center inset-x-0 hover:bg-darkest border-2 border-white border-opacity-0 hover:border-opacity-50 focus:outline-none focus:bg-gray-50 duration-300 ease-in-out rounded-lg space-y-2 -mx-5 pl-5 md:pl-20 pr-6 md:pr-64 py-6 "
|
||||||
style="transition-property: border;"
|
style="transition-property: border;"
|
||||||
>
|
>
|
||||||
|
|
@ -168,6 +168,7 @@
|
||||||
import scrollIntoView from 'scroll-into-view-if-needed'
|
import scrollIntoView from 'scroll-into-view-if-needed'
|
||||||
|
|
||||||
import { getAppCategory } from '~/helpers/categories.js'
|
import { getAppCategory } from '~/helpers/categories.js'
|
||||||
|
import { getAppEndpoint } from '~/helpers/app-derived.js'
|
||||||
// import appList from '~/static/app-list.json'
|
// import appList from '~/static/app-list.json'
|
||||||
|
|
||||||
// import EmailSubscribe from '~/components/email-subscribe.vue'
|
// import EmailSubscribe from '~/components/email-subscribe.vue'
|
||||||
|
|
@ -320,6 +321,7 @@ export default {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getAppCategory,
|
getAppCategory,
|
||||||
|
getAppEndpoint,
|
||||||
// Search priorities
|
// Search priorities
|
||||||
titleStartsWith (query, app) {
|
titleStartsWith (query, app) {
|
||||||
const matches = app.name.toLowerCase().startsWith(query)
|
const matches = app.name.toLowerCase().startsWith(query)
|
||||||
|
|
|
||||||
11
helpers/app-derived.js
Normal file
11
helpers/app-derived.js
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
// App Data that is derived from other app data
|
||||||
|
|
||||||
|
export function getAppEndpoint ( app ) {
|
||||||
|
// console.log('app', app)
|
||||||
|
|
||||||
|
if (app.category.slug === 'homebrew') return `/formula/${app.slug}`
|
||||||
|
|
||||||
|
if (app.category.slug === 'games') return `/game/${app.slug}`
|
||||||
|
|
||||||
|
return `/app/${app.slug}`
|
||||||
|
}
|
||||||
|
|
@ -6,6 +6,7 @@ import axios from 'axios'
|
||||||
|
|
||||||
import statuses from './statuses'
|
import statuses from './statuses'
|
||||||
import parseGithubDate from './parse-github-date'
|
import parseGithubDate from './parse-github-date'
|
||||||
|
import { getAppEndpoint } from './app-derived'
|
||||||
|
|
||||||
|
|
||||||
const md = new MarkdownIt()
|
const md = new MarkdownIt()
|
||||||
|
|
@ -58,8 +59,10 @@ const lookForLastUpdated = function (app, commits) {
|
||||||
|
|
||||||
// console.log('commit', commit)
|
// console.log('commit', commit)
|
||||||
|
|
||||||
|
const appEndpoint = getAppEndpoint(app)
|
||||||
|
|
||||||
// $$ If message body contains endpoint
|
// $$ If message body contains endpoint
|
||||||
if (commit.messageBody.includes(app.endpoint)) {
|
if (commit.messageBody.includes(appEndpoint)) {
|
||||||
// console.log('Found', app.name ,commit.committedDate)
|
// console.log('Found', app.name ,commit.committedDate)
|
||||||
return commit.committedDate
|
return commit.committedDate
|
||||||
}
|
}
|
||||||
|
|
@ -78,7 +81,7 @@ const lookForLastUpdated = function (app, commits) {
|
||||||
|
|
||||||
// $$$ If commits comments contains endpoint
|
// $$$ If commits comments contains endpoint
|
||||||
for (const { node: comment } of commit.comments.edges) {
|
for (const { node: comment } of commit.comments.edges) {
|
||||||
if (comment.body.includes(app.endpoint)) {
|
if (comment.body.includes(appEndpoint)) {
|
||||||
// console.log('Found', app.name ,commit.committedDate)
|
// console.log('Found', app.name ,commit.committedDate)
|
||||||
return commit.committedDate
|
return commit.committedDate
|
||||||
}
|
}
|
||||||
|
|
@ -165,7 +168,12 @@ export default async function () {
|
||||||
strict: true
|
strict: true
|
||||||
})
|
})
|
||||||
|
|
||||||
const endpoint = `/app/${appSlug}`
|
const endpoint = getAppEndpoint({
|
||||||
|
category: {
|
||||||
|
slug: null
|
||||||
|
},
|
||||||
|
slug: appSlug
|
||||||
|
})// `/app/${appSlug}`
|
||||||
|
|
||||||
let status = 'unknown'
|
let status = 'unknown'
|
||||||
|
|
||||||
|
|
@ -176,7 +184,11 @@ export default async function () {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const lastUpdatedRaw = lookForLastUpdated({ name, endpoint }, commits)
|
const category = {
|
||||||
|
slug: categorySlug
|
||||||
|
}
|
||||||
|
|
||||||
|
const lastUpdatedRaw = lookForLastUpdated({ name, slug: appSlug, endpoint, category }, commits)
|
||||||
|
|
||||||
const lastUpdated = (lastUpdatedRaw) ? {
|
const lastUpdated = (lastUpdatedRaw) ? {
|
||||||
raw: lastUpdatedRaw,
|
raw: lastUpdatedRaw,
|
||||||
|
|
@ -191,10 +203,8 @@ export default async function () {
|
||||||
// url,
|
// url,
|
||||||
text,
|
text,
|
||||||
slug: appSlug,
|
slug: appSlug,
|
||||||
endpoint,
|
// endpoint,
|
||||||
category: {
|
category,
|
||||||
slug: categorySlug
|
|
||||||
},
|
|
||||||
// content: token.content,
|
// content: token.content,
|
||||||
relatedLinks
|
relatedLinks
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import slugify from 'slugify'
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
|
|
||||||
// import { statuses } from './build-app-list'
|
// import { statuses } from './build-app-list'
|
||||||
|
// import { getAppEndpoint } from './app-derived'
|
||||||
|
|
||||||
|
|
||||||
// console.log('process.env.GAMES_SOURCE', process.env.GAMES_SOURCE)
|
// console.log('process.env.GAMES_SOURCE', process.env.GAMES_SOURCE)
|
||||||
|
|
@ -129,16 +130,21 @@ export default async function () {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const category = {
|
||||||
|
slug: 'games'
|
||||||
|
}
|
||||||
|
|
||||||
gameList.push({
|
gameList.push({
|
||||||
name: game.Games,
|
name: game.Games,
|
||||||
status,
|
status,
|
||||||
// url: `https://rawg.io/search?query=${encodeURIComponent(game.Games)}`,
|
// url: `https://rawg.io/search?query=${encodeURIComponent(game.Games)}`,
|
||||||
text: getStatusText(game),
|
text: getStatusText(game),
|
||||||
slug,
|
slug,
|
||||||
endpoint: `/game/${slug}`,
|
// endpoint: getAppEndpoint({
|
||||||
category: {
|
// slug,
|
||||||
slug: 'games'
|
// category
|
||||||
},
|
// }),//`/game/${slug}`,
|
||||||
|
category,
|
||||||
content: '',
|
content: '',
|
||||||
// relatedLinks: [],
|
// relatedLinks: [],
|
||||||
reports: [
|
reports: [
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
// import { promises as fs } from 'fs'
|
// import { promises as fs } from 'fs'
|
||||||
// import MarkdownIt from 'markdown-it'
|
// import MarkdownIt from 'markdown-it'
|
||||||
import slugify from 'slugify'
|
// import slugify from 'slugify'
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
|
|
||||||
// import statuses from './statuses'
|
// import statuses from './statuses'
|
||||||
|
|
@ -10,6 +10,7 @@ import axios from 'axios'
|
||||||
const marked = require('marked')
|
const marked = require('marked')
|
||||||
const HTMLParser = require(`node-html-parser`)
|
const HTMLParser = require(`node-html-parser`)
|
||||||
|
|
||||||
|
// import { getAppEndpoint } from './app-derived'
|
||||||
|
|
||||||
|
|
||||||
const statusesTranslations = {
|
const statusesTranslations = {
|
||||||
|
|
@ -144,16 +145,21 @@ export default async function () {
|
||||||
// strict: true
|
// strict: true
|
||||||
// })
|
// })
|
||||||
|
|
||||||
|
const category = {
|
||||||
|
slug: 'homebrew'
|
||||||
|
}
|
||||||
|
|
||||||
formulaeList.push({
|
formulaeList.push({
|
||||||
name: formulae.name,
|
name: formulae.name,
|
||||||
status: parseStatus(formulae),
|
status: parseStatus(formulae),
|
||||||
// url: `https://formulae.brew.sh/formula/${formulae.name}`,
|
// url: `https://formulae.brew.sh/formula/${formulae.name}`,
|
||||||
text: getStatusText(formulae),
|
text: getStatusText(formulae),
|
||||||
slug,
|
slug,
|
||||||
endpoint: `/formula/${slug}`,
|
// endpoint: getAppEndpoint({
|
||||||
category: {
|
// slug,
|
||||||
slug: 'homebrew'
|
// category
|
||||||
},
|
// }),//`/formula/${slug}`,
|
||||||
|
category,
|
||||||
content: formulae.comments,
|
content: formulae.comments,
|
||||||
relatedLinks: [
|
relatedLinks: [
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import buildGamesList from './helpers/build-game-list.js'
|
||||||
import buildHomebrewList from './helpers/build-homebrew-list.js'
|
import buildHomebrewList from './helpers/build-homebrew-list.js'
|
||||||
|
|
||||||
import { categories } from './helpers/categories.js'
|
import { categories } from './helpers/categories.js'
|
||||||
|
import { getAppEndpoint } from './helpers/app-derived.js'
|
||||||
|
|
||||||
|
|
||||||
const listsOptions = [
|
const listsOptions = [
|
||||||
|
|
@ -119,7 +120,7 @@ export default {
|
||||||
homebrewRoutes
|
homebrewRoutes
|
||||||
] = lists.map((list, listI) => {
|
] = lists.map((list, listI) => {
|
||||||
return list.map( app => {
|
return list.map( app => {
|
||||||
return app.endpoint
|
return getAppEndpoint(app)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ export default {
|
||||||
name: app.name,
|
name: app.name,
|
||||||
status: app.status,
|
status: app.status,
|
||||||
slug: app.slug,
|
slug: app.slug,
|
||||||
endpoint: app.endpoint,
|
// endpoint: app.endpoint,
|
||||||
text: app.text,
|
text: app.text,
|
||||||
lastUpdated: app.lastUpdated,
|
lastUpdated: app.lastUpdated,
|
||||||
category: app.category,
|
category: app.category,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue