Align dashboard and installer flows with spec
This commit is contained in:
@@ -2,7 +2,7 @@ import fs from 'node:fs'
|
||||
import fsp from 'node:fs/promises'
|
||||
import path from 'node:path'
|
||||
import { accountPath, fileDir, manifestDir, manifestRootPath } from './paths'
|
||||
import { AccountEntry, PackDefinition, PackListEntry, RootManifest } from './types'
|
||||
import { AccountEntry, DashboardPackEntry, PackDefinition, PackListEntry, RootManifest } from './types'
|
||||
|
||||
const defaultRootManifest: RootManifest = {
|
||||
packs: [
|
||||
@@ -93,6 +93,22 @@ export async function listManifestFiles(): Promise<string[]> {
|
||||
.sort((left, right) => left.localeCompare(right))
|
||||
}
|
||||
|
||||
export async function listDashboardPacks(): Promise<DashboardPackEntry[]> {
|
||||
const [manifestFiles, rootManifest] = await Promise.all([
|
||||
listManifestFiles(),
|
||||
loadRootManifest()
|
||||
])
|
||||
|
||||
return manifestFiles.map((file) => {
|
||||
const registeredPack = rootManifest.packs.find((entry) => entry.file === file)
|
||||
return {
|
||||
file,
|
||||
name: registeredPack?.name ?? file,
|
||||
registered: registeredPack != null
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export async function loadPackDefinition(packKey: string): Promise<PackDefinition | null> {
|
||||
await ensureProjectFiles()
|
||||
const safeKey = sanitizePackKey(packKey)
|
||||
|
||||
Reference in New Issue
Block a user