mirror of
https://github.com/ThatGuySam/doesitarm.git
synced 2026-05-18 06:44:46 -07:00
Add build-stork script
This commit is contained in:
parent
43ef3bd5ce
commit
d90d109ca9
2 changed files with 53 additions and 0 deletions
48
build-stork.js
Normal file
48
build-stork.js
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
import execa from 'execa'
|
||||
import fs from 'fs-extra'
|
||||
import axios from 'axios'
|
||||
|
||||
import { isDarwin } from './helpers/environment.js'
|
||||
|
||||
|
||||
const storkVersion = '1.4.2'
|
||||
|
||||
const storkExecutableName = 'stork-executable'
|
||||
const storkExecutablePath = `./${ storkExecutableName }`
|
||||
|
||||
// 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-amazon-linux`
|
||||
}
|
||||
|
||||
;(async () => {
|
||||
const envKey = isDarwin() ? 'darwin' : 'default'
|
||||
|
||||
const execDownloadUrl = execDownloadUrls[ envKey ]
|
||||
|
||||
console.log( 'execDownloadUrl', execDownloadUrl )
|
||||
|
||||
// Delete any existing executable
|
||||
await fs.remove( storkExecutableName )
|
||||
|
||||
// Download the executable
|
||||
await execa( `curl`, [
|
||||
execDownloadUrl,
|
||||
|
||||
'-o',
|
||||
storkExecutableName
|
||||
])
|
||||
|
||||
// const stat = await fs.stat( storkExecutableName )
|
||||
// console.log( 'stat', stat )
|
||||
|
||||
// Make sure the executable is executable
|
||||
await fs.chmod( storkExecutableName, '755' )
|
||||
|
||||
const output = await execa( storkExecutableName, [
|
||||
'--version'
|
||||
])
|
||||
|
||||
console.log( 'output', output )
|
||||
})()
|
||||
Loading…
Add table
Add a link
Reference in a new issue