mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-09-08 08:04:25 +00:00
chore(cli): better folder structure + add config utils (#6319)
* 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>
This commit is contained in:
committed by
GitHub
co-authored by
Alexander Petric
parent
2156ce6d62
commit
59f39d860a
@@ -0,0 +1,33 @@
|
||||
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;
|
||||
}
|
||||
Reference in New Issue
Block a user