mirror of
https://github.com/ThatGuySam/doesitarm.git
synced 2026-05-15 06:35:20 -07:00
Merge branch 'master' into feat/tv
# Conflicts: # README.md # helpers/get-list.js
This commit is contained in:
commit
5b4dc94334
11 changed files with 248 additions and 75 deletions
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 parseGithubDate from './parse-github-date'
|
||||
import { getAppEndpoint } from './app-derived'
|
||||
|
||||
|
||||
const md = new MarkdownIt()
|
||||
|
|
@ -58,8 +59,10 @@ const lookForLastUpdated = function (app, commits) {
|
|||
|
||||
// console.log('commit', commit)
|
||||
|
||||
const appEndpoint = getAppEndpoint(app)
|
||||
|
||||
// $$ If message body contains endpoint
|
||||
if (commit.messageBody.includes(app.endpoint)) {
|
||||
if (commit.messageBody.includes(appEndpoint)) {
|
||||
// console.log('Found', app.name ,commit.committedDate)
|
||||
return commit.committedDate
|
||||
}
|
||||
|
|
@ -78,7 +81,7 @@ const lookForLastUpdated = function (app, commits) {
|
|||
|
||||
// $$$ If commits comments contains endpoint
|
||||
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)
|
||||
return commit.committedDate
|
||||
}
|
||||
|
|
@ -165,7 +168,12 @@ export default async function () {
|
|||
strict: true
|
||||
})
|
||||
|
||||
const endpoint = `/app/${appSlug}`
|
||||
const endpoint = getAppEndpoint({
|
||||
category: {
|
||||
slug: null
|
||||
},
|
||||
slug: appSlug
|
||||
})// `/app/${appSlug}`
|
||||
|
||||
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) ? {
|
||||
raw: lastUpdatedRaw,
|
||||
|
|
@ -191,10 +203,8 @@ export default async function () {
|
|||
// url,
|
||||
text,
|
||||
slug: appSlug,
|
||||
endpoint,
|
||||
category: {
|
||||
slug: categorySlug
|
||||
},
|
||||
// endpoint,
|
||||
category,
|
||||
// content: token.content,
|
||||
relatedLinks
|
||||
})
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import slugify from 'slugify'
|
|||
import axios from 'axios'
|
||||
|
||||
// import { statuses } from './build-app-list'
|
||||
// import { getAppEndpoint } from './app-derived'
|
||||
|
||||
|
||||
// console.log('process.env.GAMES_SOURCE', process.env.GAMES_SOURCE)
|
||||
|
|
@ -129,16 +130,21 @@ export default async function () {
|
|||
continue
|
||||
}
|
||||
|
||||
const category = {
|
||||
slug: 'games'
|
||||
}
|
||||
|
||||
gameList.push({
|
||||
name: game.Games,
|
||||
status,
|
||||
// url: `https://rawg.io/search?query=${encodeURIComponent(game.Games)}`,
|
||||
text: getStatusText(game),
|
||||
slug,
|
||||
endpoint: `/game/${slug}`,
|
||||
category: {
|
||||
slug: 'games'
|
||||
},
|
||||
// endpoint: getAppEndpoint({
|
||||
// slug,
|
||||
// category
|
||||
// }),//`/game/${slug}`,
|
||||
category,
|
||||
content: '',
|
||||
// relatedLinks: [],
|
||||
reports: [
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
// import { promises as fs } from 'fs'
|
||||
// import MarkdownIt from 'markdown-it'
|
||||
import slugify from 'slugify'
|
||||
// import slugify from 'slugify'
|
||||
import axios from 'axios'
|
||||
|
||||
// import statuses from './statuses'
|
||||
|
|
@ -10,6 +10,7 @@ import axios from 'axios'
|
|||
const marked = require('marked')
|
||||
const HTMLParser = require(`node-html-parser`)
|
||||
|
||||
// import { getAppEndpoint } from './app-derived'
|
||||
|
||||
|
||||
const statusesTranslations = {
|
||||
|
|
@ -29,6 +30,7 @@ const statusesTranslations = {
|
|||
// The formula has been found to need more analysis/work.
|
||||
'⚠️': 'no',
|
||||
|
||||
'': 'unreported'
|
||||
}
|
||||
|
||||
const statusesMessages = {
|
||||
|
|
@ -36,7 +38,8 @@ const statusesMessages = {
|
|||
'🥈': '✳️ Yes, works via Rosetta 2',
|
||||
'🥉': '⏹ Known issues on macOS 11, though most features work',
|
||||
'⚠️': '⏹ No, not yet, support is still in progress',
|
||||
'🚫': '🚫 No, not yet supported only works on Intel-based Macs'
|
||||
'🚫': '🚫 No, not yet supported only works on Intel-based Macs',
|
||||
'': '🔶 Unknown, more info needed'
|
||||
}
|
||||
|
||||
function getStatusText(formula) {
|
||||
|
|
@ -128,7 +131,7 @@ export default async function () {
|
|||
|
||||
// If this formulae status is empty
|
||||
// then skip this formulae
|
||||
if (formulae.status.length === 0) continue
|
||||
// if (formulae.status.length === 0) continue
|
||||
|
||||
// If this formulae emoji status is not in statusesTranslations
|
||||
// then skip this formulae
|
||||
|
|
@ -142,16 +145,21 @@ export default async function () {
|
|||
// strict: true
|
||||
// })
|
||||
|
||||
const category = {
|
||||
slug: 'homebrew'
|
||||
}
|
||||
|
||||
formulaeList.push({
|
||||
name: formulae.name,
|
||||
status: parseStatus(formulae),
|
||||
// url: `https://formulae.brew.sh/formula/${formulae.name}`,
|
||||
text: getStatusText(formulae),
|
||||
slug,
|
||||
endpoint: `/formula/${slug}`,
|
||||
category: {
|
||||
slug: 'homebrew'
|
||||
},
|
||||
// endpoint: getAppEndpoint({
|
||||
// slug,
|
||||
// category
|
||||
// }),//`/formula/${slug}`,
|
||||
category,
|
||||
content: formulae.comments,
|
||||
relatedLinks: [
|
||||
{
|
||||
|
|
|
|||
43
helpers/get-list-summary-numbers.js
Normal file
43
helpers/get-list-summary-numbers.js
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
import statuses from '~/helpers/statuses'
|
||||
|
||||
export default function ( appList ) {
|
||||
|
||||
const totalApps = appList.length
|
||||
|
||||
// Create a totals object to collect amounts
|
||||
const totals = {}
|
||||
|
||||
// Get status slugs from statuses
|
||||
Object.entries(statuses).forEach( ([_, statusSlug]) => {
|
||||
totals[statusSlug] = 0
|
||||
})
|
||||
|
||||
// Count uses of each status
|
||||
appList.forEach( app => {
|
||||
// console.log('app.status', app.status)
|
||||
|
||||
for (const statusKey in statuses) {
|
||||
if (app.status === statuses[statusKey]) {
|
||||
totals[app.status]++
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
// console.log('totals', totals)
|
||||
|
||||
const nativePercent = Number((( totals['native'] / totalApps ) * 100).toFixed(1))
|
||||
const rosettaPercent = Number((( totals['rosetta'] / totalApps ) * 100).toFixed(1))
|
||||
const unreportedPercent = Number((( totals['unreported'] / totalApps ) * 100).toFixed(1))
|
||||
|
||||
const unsupportedPercent = Number((100 - (nativePercent + rosettaPercent + unreportedPercent)).toFixed(1))
|
||||
|
||||
return {
|
||||
total: totalApps,
|
||||
nativePercent,
|
||||
rosettaPercent,
|
||||
unreportedPercent,
|
||||
unsupportedPercent,
|
||||
}
|
||||
}
|
||||
|
|
@ -9,8 +9,10 @@ export const allVideoList = [
|
|||
...gameList,
|
||||
]
|
||||
|
||||
export const sortedAppList = appList.sort(byTimeThenNull)
|
||||
|
||||
export const allList = [
|
||||
...appList.sort(byTimeThenNull),
|
||||
...sortedAppList,
|
||||
...homebrewList,
|
||||
...gameList,
|
||||
]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue