wip avec résolution de conflits

This commit is contained in:
gcch 2026-02-27 14:38:50 +01:00
commit ef19ba2b72
208 changed files with 178625 additions and 192002 deletions

View file

@ -6,12 +6,10 @@ import { type ReadonlyRecord } from "effect/Record";
const COMPOSE_PATH = "compose.yaml";
const getServicesKey = (
yaml: ReadonlyRecord<string | symbol, any>,
): Option.Option<ReadonlyArray<string>> =>
const getServicesKey = (yaml: ReadonlyRecord<string | symbol, any>): Option.Option<ReadonlyArray<string>> =>
pipe(
Record.get("services")(yaml),
Option.andThen(yaml => Record.keys(yaml)),
Option.andThen((yaml) => Record.keys(yaml)),
);
const getComposeYaml = <A, I, R>(
@ -25,17 +23,17 @@ const getComposeYaml = <A, I, R>(
Effect.andThen((yaml: unknown) => Schema.decodeUnknown(schema)(yaml)),
);
const programEffect: Effect.Effect<ReadonlyArray<string>> = Effect.gen(function*() {
const programEffect: Effect.Effect<ReadonlyArray<string>> = Effect.gen(function* () {
return yield* pipe(
// Récupère le contenu du fichier compose.yaml sous forme de Record.
getComposeYaml(COMPOSE_PATH, Schema.Record({ key: Schema.String, value: Schema.Unknown })),
// Récupère la clé des services.
Effect.andThen((yaml: ReadonlyRecord<string | symbol, unknown>) => getServicesKey(yaml)),
// Retire la clé de l'image WordPress.
Effect.andThen((keys: ReadonlyArray<string>) => Array.filter(keys, key => key !== "wordpress")),
Effect.andThen((keys: ReadonlyArray<string>) => Array.filter(keys, (key) => key !== "wordpress")),
Effect.orElseSucceed(() => [""]),
// Exécute la commande podman.
Effect.tap(services => Bun.spawn({ cmd: ["podman", "compose", "pull", ...services], timeout: 10000 })),
Effect.tap((services) => Bun.spawn({ cmd: ["podman", "compose", "pull", ...services], timeout: 10000 })),
);
});