Merge remote-tracking branch 'origin/paulie/refactor' into lynith
chore: Merge paulines branch
This commit is contained in:
commit
0843162d69
21 changed files with 906 additions and 207 deletions
22
Cargo.toml
22
Cargo.toml
|
|
@ -33,9 +33,27 @@ tauri-plugin-updater = { git = "https://github.com/tauri-apps/plugins-workspace"
|
|||
|
||||
rspc = { version = "0.2.0", features = [ "specta2" ] }
|
||||
specta = { version = "=2.0.0-rc.12" }
|
||||
rspc-tauri2 = { git = "https://github.com/specta-rs/tauri2" }
|
||||
tauri-specta = { version = "=2.0.0-rc.9", features = [
|
||||
"javascript",
|
||||
"typescript"
|
||||
] }
|
||||
rspc-tauri2 = { git = "https://github.com/specta-rs/tauri2", rev = "6b9419566e2a826fb2a62538c7647f4524ab0fea" }
|
||||
|
||||
interpulse = { version = "0.1.3" }
|
||||
prisma-client-rust = { git = "https://github.com/brendonovich/prisma-client-rust", rev = "4f9ef9d38ca732162accff72b2eb684d2f120bab", features = [
|
||||
"migrations",
|
||||
"specta",
|
||||
"sqlite",
|
||||
"sqlite-create-many",
|
||||
], default-features = false }
|
||||
prisma-client-rust-cli = { git = "https://github.com/brendonovich/prisma-client-rust", rev = "4f9ef9d38ca732162accff72b2eb684d2f120bab", features = [
|
||||
"migrations",
|
||||
"specta",
|
||||
"sqlite",
|
||||
"sqlite-create-many",
|
||||
], default-features = false }
|
||||
prisma-client-rust-sdk = { git = "https://github.com/brendonovich/prisma-client-rust", rev = "4f9ef9d38ca732162accff72b2eb684d2f120bab", features = [ "sqlite" ], default-features = false }
|
||||
|
||||
interpulse = { git = "https://github.com/pulseflow/workers", rev = "dd85302dddc14861b60829cf8c71f52ffd6a7851" }
|
||||
|
||||
tracing = { version = "0.1" }
|
||||
tracing-subscriber = { version = "0.3", features = [
|
||||
|
|
|
|||
|
|
@ -15,9 +15,10 @@
|
|||
"types": "./src/index.ts",
|
||||
"dependencies": {
|
||||
"@rspc/client": "^0.2.0",
|
||||
"@rspc/solid": "^0.2.0",
|
||||
"@rspc/tauri": "^0.2.0",
|
||||
"@solid-primitives/deep": "^0.2.8",
|
||||
"@tanstack/solid-query": "^5.35.5",
|
||||
"@tanstack/solid-query": "^5.36.0",
|
||||
"fast-equals": "^5.0.1",
|
||||
"plausible-tracker": "^0.3.8",
|
||||
"solid-js": "^1.8.17",
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
export * from './constants';
|
||||
|
|
@ -11,6 +11,7 @@ homepage = { workspace = true }
|
|||
authors = { workspace = true }
|
||||
|
||||
[features]
|
||||
default = []
|
||||
# feature flag allowing us to interact with tauri (for loading animations, errors showing on gui, etc)
|
||||
# also allows us to compile onelauncher core without tauri
|
||||
tauri = [ "dep:tauri" ]
|
||||
|
|
|
|||
|
|
@ -19,13 +19,15 @@
|
|||
"@iconify-json/logos": "^1.1.42",
|
||||
"@onelauncher/client": "workspace:*",
|
||||
"@rspc/client": "^0.2.0",
|
||||
"@rspc/solid": "^0.2.0",
|
||||
"@rspc/tauri": "^0.2.0",
|
||||
"@solid-primitives/refs": "^1.0.8",
|
||||
"@solidjs/router": "^0.13.3",
|
||||
"@tanstack/solid-query": "^5.36.0",
|
||||
"@tauri-apps/api": "^2.0.0-beta",
|
||||
"@tauri-apps/plugin-shell": "github:tauri-apps/tauri-plugin-shell#v2",
|
||||
"@thisbeyond/solid-dnd": "^0.7.5",
|
||||
"@unocss/reset": "^0.60.0",
|
||||
"@unocss/reset": "^0.60.2",
|
||||
"@untitled-theme/icons-solid": "^0.8.0",
|
||||
"overlayscrollbars": "^2.8.0",
|
||||
"overlayscrollbars-solid": "^0.5.5",
|
||||
|
|
@ -40,7 +42,7 @@
|
|||
"@types/uuid": "^9.0.8",
|
||||
"jsdom": "^24.0.0",
|
||||
"sass": "^1.77.1",
|
||||
"unocss": "^0.60.0",
|
||||
"unocss": "^0.60.2",
|
||||
"vite-plugin-solid": "^2.10.2",
|
||||
"vite-tsconfig-paths": "^4.3.2"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
"eslint": "^8.56.0",
|
||||
"eslint-plugin-solid": "^0.14.0",
|
||||
"ts-node": "^10.9.2",
|
||||
"tsx": "^4.10.0",
|
||||
"tsx": "^4.10.2",
|
||||
"typescript": "^5.4.5",
|
||||
"vite": "^5.2.11",
|
||||
"vitest": "^1.6.0"
|
||||
|
|
|
|||
581
pnpm-lock.yaml
generated
581
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load diff
|
|
@ -1,3 +1,4 @@
|
|||
packages:
|
||||
- desktop
|
||||
- client
|
||||
- scripts
|
||||
|
|
|
|||
30
scripts/package.json
Normal file
30
scripts/package.json
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
{
|
||||
"name": "@onelauncher/scripts",
|
||||
"type": "module",
|
||||
"version": "1.0.0",
|
||||
"private": true,
|
||||
"description": "Scripts for developing OneLauncher",
|
||||
"license": "GPL-3.0-only",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git@github.com:polyfrost/onelauncher",
|
||||
"directory": "client"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"main": "./src/index.ts",
|
||||
"types": "./src/index.ts",
|
||||
"scripts": {
|
||||
"tauri": "tsx tauri.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"@flowr/utils": "^3.2.1",
|
||||
"@iarna/toml": "^2.2.5",
|
||||
"execa": "^9.1.0",
|
||||
"semver": "^7.6.2",
|
||||
"undici": "^6.16.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/iarna__toml": "^2.0.5",
|
||||
"@types/semver": "^7.5.8"
|
||||
}
|
||||
}
|
||||
0
scripts/prepare.ts
Normal file
0
scripts/prepare.ts
Normal file
231
scripts/setup.ps1
Normal file
231
scripts/setup.ps1
Normal file
|
|
@ -0,0 +1,231 @@
|
|||
# Set default value of 0 for external command exit code
|
||||
$LASTEXITCODE = 0
|
||||
# Enables strict mode, which causes PowerShell to treat uninitialized variables, undefined functions, and other common errors as terminating errors.
|
||||
$ErrorActionPreference = if ($env:CI) { 'Stop' } else { 'Inquire' }
|
||||
Set-StrictMode -Version Latest
|
||||
|
||||
function Reset-Path {
|
||||
$env:Path = [System.Environment]::ExpandEnvironmentVariables(
|
||||
[System.Environment]::GetEnvironmentVariable('Path', 'Machine') +
|
||||
[IO.Path]::PathSeparator +
|
||||
[System.Environment]::GetEnvironmentVariable('Path', 'User')
|
||||
)
|
||||
}
|
||||
|
||||
# Verify if environment is Windows 64-bit and if the user is an administrator
|
||||
if ((-not [string]::IsNullOrEmpty($env:PROCESSOR_ARCHITEW6432)) -or (
|
||||
"$env:PROCESSOR_ARCHITECTURE" -eq 'ARM64'
|
||||
) -or (
|
||||
-not [System.Environment]::Is64BitOperatingSystem
|
||||
# Powershell >= 6 is cross-platform, check if running on Windows
|
||||
) -or (($PSVersionTable.PSVersion.Major -ge 6) -and (-not $IsWindows))
|
||||
) {
|
||||
$ErrorActionPreference = 'Continue'
|
||||
Write-Host
|
||||
if (Test-Path "$($env:WINDIR)\SysNative\WindowsPowerShell\v1.0\powershell.exe" -PathType Leaf) {
|
||||
throw 'You are using PowerShell (32-bit), please re-run in PowerShell (64-bit)'
|
||||
} else {
|
||||
throw 'This script is only supported on Windows 64-bit'
|
||||
}
|
||||
Exit 1
|
||||
} elseif (
|
||||
-not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
|
||||
) {
|
||||
# Start a new PowerShell process with administrator privileges and set the working directory to the directory where the script is located
|
||||
$proc = Start-Process -PassThru -Wait -FilePath 'PowerShell.exe' -Verb RunAs -ArgumentList "-NoProfile -ExecutionPolicy Bypass -File `"$($MyInvocation.MyCommand.Definition)`"" -WorkingDirectory "$PSScriptRoot"
|
||||
# Reset path so the user doesn't have to restart the shell to use the tools installed by this script
|
||||
Reset-Path
|
||||
Exit $proc.ExitCode
|
||||
}
|
||||
|
||||
function Exit-WithError($err, $help = $null) {
|
||||
if ($null -ne $help) {
|
||||
Write-Host
|
||||
Write-Host $help -ForegroundColor DarkRed
|
||||
}
|
||||
throw $err
|
||||
Exit 1
|
||||
}
|
||||
|
||||
function Add-DirectoryToPath($directory) {
|
||||
Reset-Path
|
||||
if ($env:Path.Split([IO.Path]::PathSeparator) -notcontains $directory) {
|
||||
[System.Environment]::SetEnvironmentVariable(
|
||||
'Path',
|
||||
[System.Environment]::GetEnvironmentVariable('Path', 'User') + [IO.Path]::PathSeparator + $directory,
|
||||
'User'
|
||||
)
|
||||
|
||||
if ($env:CI) {
|
||||
# If running in CI, we need to use GITHUB_PATH instead of the normal PATH env variables
|
||||
Add-Content $env:GITHUB_PATH "$directory`n"
|
||||
}
|
||||
}
|
||||
Reset-Path
|
||||
}
|
||||
|
||||
# Reset PATH to ensure the script doesn't have stale Path entries
|
||||
Reset-Path
|
||||
|
||||
# Get project dir (get grandparent dir from script location: <PROJECT_ROOT>\scripts\setup.ps1)
|
||||
$projectRoot = Split-Path -Path $PSScriptRoot -Parent
|
||||
$packageJson = Get-Content -Raw -Path "$projectRoot\package.json" | ConvertFrom-Json
|
||||
|
||||
# Valid winget exit status
|
||||
$wingetValidExit = 0, -1978335189, -1978335153, -1978335135
|
||||
|
||||
Write-Host 'OneLauncher Development Environment Setup' -ForegroundColor Magenta
|
||||
Write-Host @"
|
||||
|
||||
To set up your machine for OneLauncher development, this script will do the following:
|
||||
1) Install Windows C++ build tools
|
||||
2) Install Edge Webview 2
|
||||
3) Install Rust and Cargo
|
||||
4) Install Rust tools
|
||||
5) Install Node.js, npm and pnpm
|
||||
"@
|
||||
|
||||
# Install System dependencies (GitHub Actions already has all of those installed)
|
||||
if (-not $env:CI) {
|
||||
if (-not (Get-Command winget -ea 0)) {
|
||||
Exit-WithError 'winget not available' @'
|
||||
Follow the instructions here to install winget:
|
||||
https://learn.microsoft.com/windows/package-manager/winget/
|
||||
'@
|
||||
}
|
||||
|
||||
# Check system winget version is greater or equal to v1.4.10052
|
||||
$wingetVersion = [Version]((winget --version) -replace '.*?(\d+)\.(\d+)\.(\d+).*', '$1.$2.$3')
|
||||
$requiredVersion = [Version]'1.4.10052'
|
||||
if ($wingetVersion.CompareTo($requiredVersion) -lt 0) {
|
||||
$errorMessage = "You need to update your winget to version $requiredVersion or higher."
|
||||
Exit-WithError $errorMessage
|
||||
}
|
||||
|
||||
# Check connectivity to GitHub
|
||||
$ProgressPreference = 'SilentlyContinue'
|
||||
if (-not ((Test-NetConnection -ComputerName 'github.com' -Port 80).TcpTestSucceeded)) {
|
||||
Exit-WithError "Can't connect to github, check your internet connection and run this script again"
|
||||
}
|
||||
$ProgressPreference = 'Continue'
|
||||
|
||||
Write-Host
|
||||
Read-Host 'Press Enter to continue'
|
||||
|
||||
# TODO: Force update Visual Studio build tools
|
||||
Write-Host
|
||||
Write-Host 'Installing Visual Studio Build Tools...' -ForegroundColor Yellow
|
||||
Write-Host 'This will take some time as it involves downloading several gigabytes of data....' -ForegroundColor Cyan
|
||||
winget install -e --accept-source-agreements --force --disable-interactivity --id Microsoft.VisualStudio.2022.BuildTools `
|
||||
--override 'updateall --quiet --wait'
|
||||
# Force install because BuildTools is itself a package manager, so let it decide if something needs to be installed or not
|
||||
winget install -e --accept-source-agreements --force --disable-interactivity --id Microsoft.VisualStudio.2022.BuildTools `
|
||||
--override '--wait --quiet --add Microsoft.VisualStudio.Workload.VCTools --includeRecommended'
|
||||
if (-not ($wingetValidExit -contains $LASTEXITCODE)) {
|
||||
Exit-WithError 'Failed to install Visual Studio Build Tools'
|
||||
} else {
|
||||
$LASTEXITCODE = 0
|
||||
}
|
||||
|
||||
Write-Host
|
||||
Write-Host 'Installing Edge Webview 2...' -ForegroundColor Yellow
|
||||
# This is normally already available, but on some early Windows 10 versions it isn't
|
||||
winget install -e --accept-source-agreements --disable-interactivity --id Microsoft.EdgeWebView2Runtime
|
||||
if (-not ($wingetValidExit -contains $LASTEXITCODE)) {
|
||||
Exit-WithError 'Failed to install Edge Webview 2'
|
||||
} else {
|
||||
$LASTEXITCODE = 0
|
||||
}
|
||||
|
||||
Write-Host
|
||||
Write-Host 'Installing Rust and Cargo...' -ForegroundColor Yellow
|
||||
winget install -e --accept-source-agreements --disable-interactivity --id Rustlang.Rustup
|
||||
if (-not ($wingetValidExit -contains $LASTEXITCODE)) {
|
||||
Exit-WithError 'Failed to install Rust and Cargo'
|
||||
} else {
|
||||
$LASTEXITCODE = 0
|
||||
}
|
||||
|
||||
Write-Host
|
||||
Write-Host 'Installing Nasm...' -ForegroundColor Yellow
|
||||
winget install -e --accept-source-agreements --disable-interactivity --id NASM.NASM
|
||||
if (-not ($wingetValidExit -contains $LASTEXITCODE)) {
|
||||
Exit-WithError 'Failed to install Nasm'
|
||||
} else {
|
||||
$LASTEXITCODE = 0
|
||||
}
|
||||
|
||||
Write-Host
|
||||
Write-Host 'Installing NodeJS...' -ForegroundColor Yellow
|
||||
# Check if Node.JS is already installed and if it's compatible with the project
|
||||
$currentNode = Get-Command node -ea 0
|
||||
$currentNodeVersion = if (-not $currentNode) { $null } elseif ($currentNode.Version) { $currentNode.Version } elseif ((node --version) -match '(?sm)(\d+(\.\d+)*)') { [Version]$matches[1] } else { $null }
|
||||
$enginesNodeVersion = if ($packageJson.engines.node -match '(?sm)(\d+(\.\d+)*)') { [Version]$matches[1] } else { $null }
|
||||
if ($currentNodeVersion -and $enginesNodeVersion -and $currentNodeVersion.CompareTo($enginesNodeVersion) -lt 0) {
|
||||
Exit-WithError "Current Node.JS version: $currentNodeVersion (required: $enginesNodeVersion)" `
|
||||
'Uninstall the current version of Node.JS and run this script again'
|
||||
}
|
||||
# Install Node.JS
|
||||
winget install -e --accept-source-agreements --disable-interactivity --id OpenJS.NodeJS
|
||||
if (-not ($wingetValidExit -contains $LASTEXITCODE)) {
|
||||
Exit-WithError 'Failed to install NodeJS'
|
||||
} else {
|
||||
$LASTEXITCODE = 0
|
||||
}
|
||||
# Add NodeJS to the PATH
|
||||
Add-DirectoryToPath "$env:SystemDrive\Program Files\nodejs"
|
||||
|
||||
# Reset Path to ensure that executable installed above are available to rest of the script
|
||||
Reset-Path
|
||||
|
||||
Write-Host
|
||||
Write-Host 'Installing Rust MSVC Toolchain...' -ForegroundColor Yellow
|
||||
rustup toolchain install stable-msvc
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Exit-WithError 'Failed to install Rust MSVC Toolchain'
|
||||
}
|
||||
|
||||
Write-Host
|
||||
Write-Host 'Installing Rust tools...' -ForegroundColor Yellow
|
||||
cargo install cargo-watch
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Exit-WithError 'Failed to install Rust tools'
|
||||
}
|
||||
|
||||
Write-Host
|
||||
Write-Host 'Installing for pnpm...' -ForegroundColor Yellow
|
||||
# Check if pnpm is already installed and if it's compatible with the project
|
||||
$currentPnpmVersion = if (-not (Get-Command pnpm -ea 0)) { $null } elseif ((pnpm --version) -match '(?sm)(\d+(\.\d+)*)') { [Version]$matches[1] } else { $null }
|
||||
$enginesPnpmVersion = if ($packageJson.engines.pnpm -match '(?sm)(\d+(\.\d+)*)') { [Version]$matches[1] } else { $null }
|
||||
|
||||
if (-not $currentPnpmVersion) {
|
||||
# Remove possible remaining envvars from old pnpm installation
|
||||
[System.Environment]::SetEnvironmentVariable('PNPM_HOME', $null, [System.EnvironmentVariableTarget]::Machine)
|
||||
[System.Environment]::SetEnvironmentVariable('PNPM_HOME', $null, [System.EnvironmentVariableTarget]::User)
|
||||
|
||||
# Install pnpm
|
||||
npm install -g "pnpm@latest-$($enginesPnpmVersion.Major)"
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Exit-WithError 'Failed to install pnpm'
|
||||
}
|
||||
|
||||
# Add NPM global modules to the PATH
|
||||
if (Test-Path "$env:APPDATA\npm" -PathType Container) {
|
||||
Add-DirectoryToPath "$env:APPDATA\npm"
|
||||
}
|
||||
} elseif ($currentPnpmVersion -and $enginesPnpmVersion -and $currentPnpmVersion.CompareTo($enginesPnpmVersion) -lt 0) {
|
||||
Exit-WithError "Current pnpm version: $currentPnpmVersion (required: $enginesPnpmVersion)" `
|
||||
'Uninstall the current version of pnpm and run this script again'
|
||||
}
|
||||
}
|
||||
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Exit-WithError "Something went wrong, exit code: $LASTEXITCODE"
|
||||
}
|
||||
|
||||
if (-not $env:CI) {
|
||||
Write-Host
|
||||
Write-Host 'Your machine has been setup for OneLauncher development!' -ForegroundColor Green
|
||||
Write-Host
|
||||
Read-Host 'Press Enter to continue'
|
||||
}
|
||||
165
scripts/setup.sh
Executable file
165
scripts/setup.sh
Executable file
|
|
@ -0,0 +1,165 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
if [ "${CI:-}" = "true" ]; then
|
||||
set -x
|
||||
fi
|
||||
|
||||
err() {
|
||||
for _line in "$@"; do
|
||||
echo "$_line" >&2
|
||||
done
|
||||
exit 1
|
||||
}
|
||||
|
||||
has() {
|
||||
for prog in "$@"; do
|
||||
if ! command -v "$prog" 1>/dev/null 2>&1; then
|
||||
return 1
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
sudo() {
|
||||
if [ "$(id -u)" -eq 0 ]; then
|
||||
"$@"
|
||||
else
|
||||
env sudo "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
script_failure() {
|
||||
if [ -n "${1:-}" ]; then
|
||||
_line="on line $1"
|
||||
else
|
||||
_line="(unknown)"
|
||||
fi
|
||||
err "An error occurred $_line." "Setup failed."
|
||||
}
|
||||
|
||||
trap 'script_failure ${LINENO:-}' ERR
|
||||
|
||||
case "${OSTYPE:-}" in
|
||||
'msys' | 'mingw' | 'cygwin')
|
||||
err 'Bash for Windows is not supported, please use Powershell or CMD'
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ "${CI:-}" != "true" ]; then
|
||||
echo 'OneLauncher Development Environment Setup'
|
||||
echo 'To set up your machine for OneLauncher development, this script will install some required dependencies with your system package manager'
|
||||
echo
|
||||
echo 'Press Enter to continue'
|
||||
read -r
|
||||
|
||||
if ! has pnpm; then
|
||||
err 'pnpm was not found.' \
|
||||
"Ensure the 'pnpm' command is in your \$PATH." \
|
||||
'You must use pnpm for this project; yarn and npm are not allowed.' \
|
||||
'https://pnpm.io/installation'
|
||||
fi
|
||||
|
||||
if ! has rustc cargo; then
|
||||
err 'Rust was not found.' \
|
||||
"Ensure the 'rustc' and 'cargo' binaries are in your \$PATH." \
|
||||
'https://rustup.rs'
|
||||
fi
|
||||
|
||||
echo
|
||||
fi
|
||||
|
||||
# Install system deps
|
||||
case "$(uname)" in
|
||||
"Darwin")
|
||||
if [ "$(uname -m)" = 'x86_64' ] && ! [ "${CI:-}" = "true" ]; then
|
||||
brew install nasm
|
||||
fi
|
||||
;;
|
||||
"Linux")
|
||||
# https://v2.tauri.app/start/prerequisites/
|
||||
if has apt-get; then
|
||||
echo "Detected apt!"
|
||||
echo "Installing dependencies with apt..."
|
||||
|
||||
# Tauri dependencies
|
||||
set -- build-essential curl wget file libssl-dev libgtk-3-dev librsvg2-dev \
|
||||
libwebkit2gtk-4.1-dev libayatana-appindicator3-dev libxdo-dev libvips42
|
||||
|
||||
sudo apt-get -y update
|
||||
sudo apt-get -y install "$@"
|
||||
elif has pacman; then
|
||||
echo "Detected pacman!"
|
||||
echo "Installing dependencies with pacman..."
|
||||
|
||||
# Tauri dependencies
|
||||
set -- appmenu-gtk-module libappindicator-gtk3 base-devel curl wget file openssl gtk3 librsvg webkit2gtk-4.1 libayatana-appindicator xdotool libvips
|
||||
|
||||
sudo pacman -Sy --needed "$@"
|
||||
elif has dnf; then
|
||||
echo "Detected dnf!"
|
||||
echo "Installing dependencies with dnf..."
|
||||
|
||||
# For Enterprise Linux, you also need "Development Tools" instead of "C Development Tools and Libraries"
|
||||
if ! { sudo dnf group install "C Development Tools and Libraries" || sudo dnf group install "Development Tools"; }; then
|
||||
err 'We were unable to install the "C Development Tools and Libraries"/"Development Tools" package.' \
|
||||
'Please open an issue if you feel that this is incorrect.'
|
||||
fi
|
||||
|
||||
# Tauri dependencies
|
||||
set -- openssl webkit2gtk4.1-devel openssl-devel curl wget file libappindicator-gtk3-devel librsvg2-devel libxdo-devel vips
|
||||
|
||||
sudo dnf install "$@"
|
||||
elif has apk; then
|
||||
echo "Detected apk!"
|
||||
echo "Installing dependencies with apk..."
|
||||
echo "Alpine suport is experimental" >&2
|
||||
|
||||
# Tauri dependencies
|
||||
set -- build-base curl wget file openssl-dev gtk+3.0-dev librsvg-dev \
|
||||
webkit2gtk-4.1-dev libayatana-indicator-dev xdotool vips
|
||||
|
||||
sudo apk add "$@"
|
||||
elif has emerge; then
|
||||
echo "Detected emerge!"
|
||||
echo "Installing dependencies with emerge..."
|
||||
echo "Gentoo support is experiemntal" >&2
|
||||
|
||||
# Tauri Dependencies
|
||||
set -- net-libs/webkit-gtk:4.1 dev-libs/libappindicator net-misc/curl net-misc/wget sys-apps/file
|
||||
|
||||
sudo emerge --ask "$@"
|
||||
elif has zypper; then
|
||||
echo "Detected zypper!"
|
||||
echo "Installing dependencies with zypper..."
|
||||
echo "openSUSE support is experimental" >&2
|
||||
|
||||
set -- libopenssl-devel webkit2gtk3-devel curl wget file libappindicator3-1 librsvg-devel
|
||||
|
||||
sudo zypper in "$@"
|
||||
sudo zypper in -t pattern devel_basis
|
||||
else
|
||||
if has lsb_release; then
|
||||
_distro="'$(lsb_release -s -d)' "
|
||||
fi
|
||||
err "Your Linux distro ${_distro:-}is not supported by this script." \
|
||||
'We would welcome a PR or some help adding your OS to this script:' \
|
||||
'https://github.com/polyfrost/onelauncher/issues'
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
err "Your OS ($(uname)) is not supported by this script." \
|
||||
'We would welcome a PR or some help adding your OS to this script.' \
|
||||
'https://github.com/polyfrost/onelauncher/issues'
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ "${CI:-}" != "true" ]; then
|
||||
echo "Installing Rust tools..."
|
||||
|
||||
_tools="cargo-watch"
|
||||
|
||||
echo "$_tools" | xargs cargo install
|
||||
fi
|
||||
|
||||
echo 'Your machine has been setup for OneLauncher development!'
|
||||
0
scripts/tauri.ts
Normal file
0
scripts/tauri.ts
Normal file
4
scripts/tsconfig.json
Normal file
4
scripts/tsconfig.json
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"extends": "../tsconfig.base.json",
|
||||
"include": ["./**/*.ts"]
|
||||
}
|
||||
0
scripts/utils/fetch.ts
Normal file
0
scripts/utils/fetch.ts
Normal file
0
scripts/utils/flock.ts
Normal file
0
scripts/utils/flock.ts
Normal file
0
scripts/utils/patch.ts
Normal file
0
scripts/utils/patch.ts
Normal file
0
scripts/utils/shared.ts
Normal file
0
scripts/utils/shared.ts
Normal file
66
scripts/utils/triple.ts
Normal file
66
scripts/utils/triple.ts
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
import { env } from 'node:process';
|
||||
import * as os from 'node:os';
|
||||
import { execaCommand } from 'execa';
|
||||
|
||||
const state: { __debug: boolean; libc: 'musl' | 'glibc' } = {
|
||||
__debug: env.NODE_ENV === 'debug',
|
||||
libc: 'glibc',
|
||||
};
|
||||
|
||||
if (os.type() === 'Linux') {
|
||||
try {
|
||||
const lldResult = await execaCommand('ldd /bin/ls');
|
||||
if (lldResult.stdout.includes('msl'))
|
||||
state.libc = 'musl';
|
||||
}
|
||||
catch (error) {
|
||||
if (state.__debug) {
|
||||
console.warn('failed to check libs type');
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const OS_TYPE: Record<string, string> = {
|
||||
darwin: 'Darwin',
|
||||
windows: 'Windows_NT',
|
||||
linux: 'Linux',
|
||||
};
|
||||
|
||||
type TripleID = ['Darwin' | 'Windows_NT', 'x86_64' | 'aarch64'] | ['Linux', 'x86_64' | 'aarch64', 'musl' | 'glibc'];
|
||||
|
||||
export function getTriple(): TripleID {
|
||||
const tripleState: {
|
||||
_libc: typeof state.libc;
|
||||
_os: string;
|
||||
_arch: string;
|
||||
} = {
|
||||
_libc: state.libc,
|
||||
_os: '',
|
||||
_arch: '',
|
||||
};
|
||||
|
||||
if (env.TARGET_TRIPLE) {
|
||||
const target = env.TARGET_TRIPLE.split('-');
|
||||
tripleState._os = OS_TYPE[target[2] ?? ''] as string;
|
||||
tripleState._arch = target[0] as string;
|
||||
if (tripleState._os === 'Linux')
|
||||
tripleState._libc = target[3]?.includes('musl') ? 'musl' : 'glibc';
|
||||
}
|
||||
else {
|
||||
tripleState._os = os.type();
|
||||
tripleState._arch = os.machine();
|
||||
if (tripleState._arch === 'arm64')
|
||||
tripleState._arch = 'aarch64';
|
||||
}
|
||||
|
||||
if (tripleState._arch !== 'x86_64' && tripleState._arch !== 'aarch64')
|
||||
throw new Error(`Unsuported architecture`);
|
||||
|
||||
if (tripleState._os === 'Linux')
|
||||
return [tripleState._os, tripleState._arch, tripleState._libc];
|
||||
else if (tripleState._os !== 'Darwin' && tripleState._os !== 'Windows_NT')
|
||||
throw new Error(`Unsuported OS`);
|
||||
|
||||
return [tripleState._os, tripleState._arch];
|
||||
}
|
||||
0
scripts/utils/which.ts
Normal file
0
scripts/utils/which.ts
Normal file
Loading…
Add table
Reference in a new issue