mirror of
https://github.com/ThatGuySam/doesitarm.git
synced 2026-05-15 06:35:20 -07:00
fix(stork): support netlify ubuntu 24 builds
Switch Stork downloads to artifacts that match current runtimes and fix the runtime detection path that Node 22 changed. This keeps the existing Stork pipeline working on Netlify's Noble image and on Apple Silicon development machines.
This commit is contained in:
parent
e701c48fa8
commit
9e48862a5f
3 changed files with 31 additions and 18 deletions
|
|
@ -6,7 +6,10 @@ export function isNuxt( VueThis ) {
|
|||
}
|
||||
|
||||
export function isBrowserContext () {
|
||||
if ( typeof navigator === 'undefined' ) return false
|
||||
// Node 22 exposes a global navigator, so use window/document instead.
|
||||
if ( typeof window === 'undefined' ) return false
|
||||
|
||||
if ( typeof document === 'undefined' ) return false
|
||||
|
||||
return true
|
||||
}
|
||||
|
|
@ -14,6 +17,8 @@ export function isBrowserContext () {
|
|||
export function hasProcesGlobal () {
|
||||
if ( typeof process === 'undefined' ) return false
|
||||
|
||||
if ( !process.versions?.node ) return false
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
import fs from 'fs-extra'
|
||||
import execa from 'execa'
|
||||
|
||||
import { isDarwin } from '~/helpers/environment.js'
|
||||
import {
|
||||
storkVersion,
|
||||
storkExecutableName,
|
||||
|
|
@ -11,15 +10,25 @@ import {
|
|||
storkIndexPath
|
||||
} from '~/helpers/stork/config.js'
|
||||
|
||||
// Netlify's Ubuntu 24 (Noble) image needs the OpenSSL 3 compatible binary.
|
||||
export function getStorkExecutableTarget ( {
|
||||
platform = process.platform,
|
||||
arch = process.arch
|
||||
} = {} ) {
|
||||
if ( platform === 'darwin' ) {
|
||||
if ( arch === 'arm64' ) return 'stork-macos-13-arm'
|
||||
|
||||
return 'stork-macos-10-15'
|
||||
}
|
||||
|
||||
return 'stork-ubuntu-22-04'
|
||||
}
|
||||
|
||||
// https://stork-search.net/docs/install
|
||||
const execDownloadUrls = {
|
||||
darwin: `https://files.stork-search.net/releases/v${ storkVersion }/stork-macos-10-15`,
|
||||
default: `https://files.stork-search.net/releases/v${ storkVersion }/stork-ubuntu-20-04`
|
||||
export function getStorkExecutableDownloadUrl ( options = {} ) {
|
||||
const target = getStorkExecutableTarget( options )
|
||||
|
||||
// Stork 2.0
|
||||
// darwin: `https://files.stork-search.net/releases/v${ storkVersion }/stork-macos-12`,
|
||||
|
||||
// default: `https://files.stork-search.net/releases/v${ storkVersion }/stork-amazon-linux`
|
||||
return `https://files.stork-search.net/releases/v${ storkVersion }/${ target }`
|
||||
}
|
||||
|
||||
// Check if a file is executable
|
||||
|
|
@ -33,9 +42,7 @@ async function isExecutable ( path ) {
|
|||
|
||||
// 👩💻 Bash Download example - https://github.com/jmooring/hugo-stork/blob/main/build.sh
|
||||
export async function downloadStorkExecutable () {
|
||||
const envKey = isDarwin() ? 'darwin' : 'default'
|
||||
|
||||
const execDownloadUrl = execDownloadUrls[ envKey ]
|
||||
const execDownloadUrl = getStorkExecutableDownloadUrl()
|
||||
|
||||
// console.log( { execDownloadUrl } )
|
||||
|
||||
|
|
@ -46,6 +53,7 @@ export async function downloadStorkExecutable () {
|
|||
|
||||
// Download the binary
|
||||
await execa( `curl`, [
|
||||
'-fsSL',
|
||||
execDownloadUrl,
|
||||
|
||||
// Set filename
|
||||
|
|
@ -60,7 +68,7 @@ export async function downloadStorkExecutable () {
|
|||
|
||||
|
||||
// console.log( 'isExecutable', isExecutable )
|
||||
if ( !isExecutable( storkExecutablePath ) ) throw new Error( `Downloaded binary at ${ storkExecutablePath } is not executable.` )
|
||||
if ( !(await isExecutable( storkExecutablePath )) ) throw new Error( `Downloaded binary at ${ storkExecutablePath } is not executable.` )
|
||||
|
||||
|
||||
// Check Stork version
|
||||
|
|
@ -78,7 +86,7 @@ export async function downloadStorkExecutable () {
|
|||
|
||||
export async function buildIndex () {
|
||||
|
||||
if ( !isExecutable( storkExecutablePath ) ) throw new Error( `Binary at ${ storkExecutablePath } is not executable.` )
|
||||
if ( !(await isExecutable( storkExecutablePath )) ) throw new Error( `Binary at ${ storkExecutablePath } is not executable.` )
|
||||
|
||||
// Check Stork version
|
||||
// so we know our binary is working
|
||||
|
|
|
|||
|
|
@ -2,11 +2,11 @@
|
|||
|
||||
# Hugo Bash Example https://github.com/jmooring/hugo-stork/blob/main/build.sh
|
||||
|
||||
# curl https://files.stork-search.net/releases/latest/stork-amazon-linux -o stork-executable
|
||||
# curl https://files.stork-search.net/releases/v1.4.3/stork-macos-latest -o stork-executable
|
||||
# Netlify's Noble/Ubuntu 24 image needs the Ubuntu 22.04 Stork build.
|
||||
# curl -fsSL https://files.stork-search.net/releases/v1.6.0/stork-macos-13-arm -o stork-executable
|
||||
|
||||
curl https://files.stork-search.net/releases/v1.4.2/stork-amazon-linux -o stork-executable
|
||||
# curl https://files.stork-search.net/releases/v1.4.2/stork-macos-10-15 -o stork-executable
|
||||
curl -fsSL https://files.stork-search.net/releases/v1.6.0/stork-ubuntu-22-04 -o stork-executable
|
||||
# curl -fsSL https://files.stork-search.net/releases/v1.6.0/stork-macos-10-15 -o stork-executable
|
||||
|
||||
chmod +x stork-executable
|
||||
./stork-executable build --input static/stork.toml --output static/search-index.st
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue