mirror of
https://github.com/ThatGuySam/doesitarm.git
synced 2026-05-15 06:35:20 -07:00
Keep device listings available in clean builds
The Netlify validation job imports site listings before generated static device JSON exists in a clean checkout, so keep the small device table in tracked source and use it as the route fallback. Constraint: static/device-list.json is ignored generated output and is absent in GitHub-hosted clean runners Rejected: Force-add static/device-list.json | keeps generated output under source control Confidence: high Scope-risk: narrow Directive: Keep disabled device rows in the fallback source but filter them from routable listings Tested: pnpm run with-env vitest ./test/prebuild/site-listings.test.js Tested: pnpm netlify-build reached Astro build after passing prebuild tests Not-tested: Full local netlify-build completion blocked by unrelated uncommitted scanner worker build failure
This commit is contained in:
parent
3d19c60670
commit
d1f49267c0
3 changed files with 142 additions and 7 deletions
|
|
@ -1,12 +1,11 @@
|
|||
import deviceListText from '~/static/device-list.json?raw'
|
||||
import videoListingsText from '~/static/api/youtube-video-listings.json?raw'
|
||||
|
||||
const trailingCommaPattern = /,\s*([\]}])/g
|
||||
const parsedDeviceList = JSON.parse( deviceListText.replace( trailingCommaPattern, '$1' ) )
|
||||
import { deviceListingFallbacks } from './device-list-fallbacks.js'
|
||||
|
||||
const parsedVideoListings = JSON.parse( videoListingsText )
|
||||
|
||||
export function getDeviceListingBySlug ( slug ) {
|
||||
return parsedDeviceList.find( device => device.slug === slug ) || null
|
||||
return deviceListingFallbacks.find( device => device.slug === slug ) || null
|
||||
}
|
||||
|
||||
export async function getVideoListingBySlug ( slug ) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue