mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-22 08:02:19 +00:00
59f39d860a
* organize in folders * add config command * fix * cleaning * move utility functions * merge * only show token with option * only show token with option * fix * remove config command * add config utils * change paths * nit * clean path assigner --------- Co-authored-by: Alexander Petric <alpetric@users.noreply.github.com>
34 lines
1.1 KiB
TypeScript
34 lines
1.1 KiB
TypeScript
import { Codebase, SyncOptions } from "../core/conf.ts";
|
|
import { log } from "../../deps.ts";
|
|
import { digestDir } from "./utils.ts";
|
|
|
|
export type SyncCodebase = Codebase & { getDigest: () => Promise<string> };
|
|
export function listSyncCodebases(
|
|
options: SyncOptions
|
|
): SyncCodebase[] {
|
|
const res: SyncCodebase[] = [];
|
|
const nb_codebase = options?.codebases?.length ?? 0;
|
|
if (nb_codebase > 0) {
|
|
log.info(`Found ${nb_codebase} codebases: ${options?.codebases?.map((c) => c.relative_path).join(", ")}`);
|
|
}
|
|
for (const codebase of options?.codebases ?? []) {
|
|
let _digest: string | undefined = undefined;
|
|
const getDigest: () => Promise<string> = async () => {
|
|
if (_digest == undefined) {
|
|
_digest = await digestDir(
|
|
codebase.relative_path,
|
|
JSON.stringify(codebase)
|
|
);
|
|
if (Array.isArray(codebase.assets) && codebase.assets.length > 0) {
|
|
_digest += ".tar";
|
|
}
|
|
log.info(`Codebase ${codebase.relative_path}, digest: ${_digest}`);
|
|
}
|
|
return _digest;
|
|
};
|
|
res.push({ ...codebase, getDigest });
|
|
}
|
|
|
|
return res;
|
|
}
|