sideload wip, websockets, styling, multiple todos (#2865)

* sideload wip, websockets, styling, multiple todos

* sideload

* misc backend updates

* chore: comments

* prep for license and instructions display

* comment for Matt

* s9pk updates and 040 sdk

* fix dependency error for actions

* 0.4.0-beta.1

* beta.2

---------

Co-authored-by: Aiden McClelland <me@drbonez.dev>
Co-authored-by: waterplea <alexander@inkin.ru>
Co-authored-by: Aiden McClelland <3732071+dr-bonez@users.noreply.github.com>
This commit is contained in:
Matt Hill
2025-04-10 13:51:05 -06:00
committed by GitHub
parent ab4336cfd7
commit fc2be42418
88 changed files with 773 additions and 965 deletions

View File

@@ -1,22 +1,29 @@
// @TODO get types from sdk
type Progress = null | boolean | { done: number; total: number | null }
type NamedProgress = { name: string; progress: Progress }
type FullProgress = { overall: Progress; phases: Array<NamedProgress> }
import { T } from '@start9labs/start-sdk'
export function formatProgress({ phases, overall }: FullProgress): {
export function formatProgress({ phases, overall }: T.FullProgress): {
total: number
message: string
} {
return {
total: getDecimal(overall),
message: phases
.filter(p => p.progress !== true && p.progress !== null)
.map(p => `${p.name}${getPhaseBytes(p.progress)}`)
.filter(
(
p,
): p is {
name: string
progress: {
done: number
total: number | null
}
} => p.progress !== true && p.progress !== null,
)
.map(p => `<b>${p.name}</b>${getPhaseBytes(p.progress)}`)
.join(', '),
}
}
function getDecimal(progress: Progress): number {
function getDecimal(progress: T.Progress): number {
if (progress === true) {
return 1
} else if (!progress || !progress.total) {
@@ -26,7 +33,7 @@ function getDecimal(progress: Progress): number {
}
}
function getPhaseBytes(progress: Progress): string {
function getPhaseBytes(progress: T.Progress): string {
return progress === true || !progress
? ''
: `: (${progress.done}/${progress.total})`

View File

@@ -55,3 +55,6 @@ export function toUrl(text: string | null | undefined): string {
}
export type WithId<T> = T & { id: string }
export type OptionalProperty<T, K extends keyof T> = Omit<T, K> &
Partial<Pick<T, K>>