spacedrive/scripts/utils/consts.mjs
Brendan Allan 49cc098f32
[ENG-927, ENG-735, ENG-766] Fix Updater & Tauri 1.5 (#1361)
* custom updater with toasts

* new state management + updated router route

* tauri-specific update route

* ref

* update in prod only

* change 'Install' to 'Update'

* fix tsconfig

* desktop tauri

* remove tauri patch

* tauri 1.5

* tauri 1.5

* use tauri script

* native-deps

* Rework preprep and tauri script to better support tauri 1.5

* Update to tauri 1.5.1
 - Update workspace and apps/desktop dependencies
 - Fix mustache import, @types/mustache is not compatible with ES imports
 - Replace arm64 with aarch64 in machineID, they should be treated the same and this simplyfies the code

* Fix tauri updater not building due to missing key
 - Fix dmg background not being found
 - Generate an adhoc key for tauri updater with it is enabled and the user is doing a prod build

* Fix ctrl+c/ctrl+v typo

* Normalie @tanstack/react-query version through workspace
 - Use undici in scripts instead of global fetch
 - Fix typecheck

* Fix linux prod and dev builds
 - Improve error handling in tauri.mjs

* Normalize dev deps in workspace
 - Improve linux shared libs setup

* Fix CI and server docker

* Fix windows
 - Remove superfluous envvar

* Attempt to fix server, mobile, deb and release updater

* Attempt to fix deb and mobile again
 - Fix type on deb dependency
 - Enable release deb for aarch64-unknown-linux-gnu

* Github doesn't have arm runners
 - Fix typo in server Dockerfile

* Publish deb and updater artifacts

* remove version from asset name

* update commands

* log release

* Some logs on updater errors

* show updater errors on frontend

* fix desktop ui caching

---------

Co-authored-by: Vítor Vasconcellos <vasconcellos.dev@gmail.com>
Co-authored-by: Ericson Fogo Soares <ericson.ds999@gmail.com>
2023-10-10 07:30:56 +00:00

98 lines
1.8 KiB
JavaScript

// Suffixes
export const PROTOC_SUFFIX = {
Linux: {
i386: 'linux-x86_32',
i686: 'linux-x86_32',
x86_64: 'linux-x86_64',
aarch64: 'linux-aarch_64',
},
Darwin: {
x86_64: 'osx-x86_64',
aarch64: 'osx-aarch_64',
},
Windows_NT: {
i386: 'win32',
i686: 'win32',
x86_64: 'win64',
},
}
export const PDFIUM_SUFFIX = {
Linux: {
x86_64: {
musl: 'linux-musl-x64',
glibc: 'linux-x64',
},
aarch64: 'linux-arm64',
},
Darwin: {
x86_64: 'mac-x64',
aarch64: 'mac-arm64',
},
Windows_NT: {
x86_64: 'win-x64',
aarch64: 'win-arm64',
},
}
export const FFMPEG_SUFFFIX = {
Darwin: {
x86_64: 'x86_64',
aarch64: 'arm64',
},
Windows_NT: {
x86_64: 'x86_64',
},
}
export const FFMPEG_WORKFLOW = {
Darwin: 'ffmpeg-macos.yml',
Windows_NT: 'ffmpeg-windows.yml',
}
export const LIBHEIF_SUFFIX = {
Linux: {
x86_64: {
musl: 'x86_64-linux-musl',
glibc: 'x86_64-linux-gnu',
},
aarch64: {
musl: 'aarch64-linux-musl',
glibc: 'aarch64-linux-gnu',
},
},
}
export const LIBHEIF_WORKFLOW = {
Linux: 'libheif-linux.yml',
}
/**
* @param {Record<string, unknown>} constants
* @param {string[]} identifiers
* @returns {string?}
*/
export function getConst(constants, identifiers) {
/** @type {string | Record<string, unknown>} */
let constant = constants
for (const id of identifiers) {
constant = /** @type {string | Record<string, unknown>} */ (constant[id])
if (!constant) return null
if (typeof constant !== 'object') break
}
return typeof constant === 'string' ? constant : null
}
/**
* @param {Record<string, unknown>} suffixes
* @param {string[]} identifiers
* @returns {RegExp?}
*/
export function getSuffix(suffixes, identifiers) {
const suffix = getConst(suffixes, identifiers)
return suffix ? new RegExp(`${suffix}(\\.[^\\.]+)*$`) : null
}