Feat/next packages (#2646)

* fix mac build

* wip

* chore: Update the effects to get rid of bad pattern

* chore: Some small changes

* wip

* fix: Health checks don't show during race

* fix: Restart working

---------

Co-authored-by: Aiden McClelland <me@drbonez.dev>
This commit is contained in:
Jade
2024-06-19 17:30:05 -06:00
committed by GitHub
parent da3720c7a9
commit 355452cdb3
7 changed files with 65 additions and 34 deletions

View File

@@ -25,7 +25,7 @@ dist: $(TS_FILES) package.json node_modules README.md LICENSE
cp LICENSE dist/LICENSE
touch dist
full-bundle: clean bundle
full-bundle: bundle
check:
npm run check
@@ -36,7 +36,7 @@ fmt: node_modules
node_modules: package.json
npm ci
publish: clean bundle package.json README.md LICENSE
publish: bundle package.json README.md LICENSE
cd dist && npm publish --access=public
link: bundle

View File

@@ -154,7 +154,7 @@ export class Daemons<Manifest extends SDKManifest, Ids extends string> {
this.healthDaemons.forEach((x) =>
x.addWatcher(() => this.updateMainHealth()),
)
return {
const built = {
term: async (options?: { signal?: Signals; timeout?: number }) => {
try {
await Promise.all(this.healthDaemons.map((x) => x.term(options)))
@@ -163,6 +163,8 @@ export class Daemons<Manifest extends SDKManifest, Ids extends string> {
}
},
}
this.started(() => built.term())
return built
}
private updateMainHealth() {

View File

@@ -132,14 +132,14 @@ export class HealthDaemon {
this.effects.setHealth({
result: status,
message: health.message,
id: display,
id: this.id,
name: display,
})
} else {
this.effects.setHealth({
result: health.status,
message: health.message || "",
id: display,
id: this.id,
name: display,
})
}

View File

@@ -27,12 +27,11 @@ export class Overlay {
}
for (const dirPart of shared) {
await fs.mkdir(`${rootfs}/${dirPart}`, { recursive: true })
await execFile("mount", [
"--rbind",
`/${dirPart}`,
`${rootfs}/${dirPart}`,
])
const from = `/${dirPart}`
const to = `${rootfs}/${dirPart}`
await fs.mkdir(from, { recursive: true })
await fs.mkdir(to, { recursive: true })
await execFile("mount", ["--rbind", from, to])
}
return new Overlay(effects, id, rootfs, guid)
@@ -48,22 +47,22 @@ export class Overlay {
? options.subpath
: `/${options.subpath}`
: "/"
await execFile("mount", [
"--bind",
`/media/startos/volumes/${options.id}${subpath}`,
path,
])
const from = `/media/startos/volumes/${options.id}${subpath}`
await fs.mkdir(from, { recursive: true })
await fs.mkdir(path, { recursive: true })
await await execFile("mount", ["--bind", from, path])
} else if (options.type === "assets") {
const subpath = options.subpath
? options.subpath.startsWith("/")
? options.subpath
: `/${options.subpath}`
: "/"
await execFile("mount", [
"--bind",
`/media/startos/assets/${options.id}${subpath}`,
path,
])
const from = `/media/startos/assets/${options.id}${subpath}`
await fs.mkdir(from, { recursive: true })
await fs.mkdir(path, { recursive: true })
await execFile("mount", ["--bind", from, path])
} else if (options.type === "pointer") {
await this.effects.mount({ location: path, target: options })
} else if (options.type === "backup") {
@@ -72,11 +71,11 @@ export class Overlay {
? options.subpath
: `/${options.subpath}`
: "/"
await execFile("mount", [
"--bind",
`/media/startos/backup${subpath}`,
path,
])
const from = `/media/startos/backup${subpath}`
await fs.mkdir(from, { recursive: true })
await fs.mkdir(path, { recursive: true })
await execFile("mount", ["--bind", from, path])
} else {
throw new Error(`unknown type ${(options as any).type}`)
}