mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-18 16:02:10 +00:00
df62925894
* feat: triggers cli sync * fix build * update ee ref --------- Co-authored-by: Ruben Fiszel <ruben@windmill.dev>
66 lines
1.6 KiB
TypeScript
66 lines
1.6 KiB
TypeScript
import { log, yamlParseFile } from "./deps.ts";
|
|
|
|
export interface SyncOptions {
|
|
stateful?: boolean;
|
|
raw?: boolean;
|
|
yes?: boolean;
|
|
skipPull?: boolean;
|
|
failConflicts?: boolean;
|
|
plainSecrets?: boolean;
|
|
json?: boolean;
|
|
skipVariables?: boolean;
|
|
skipResources?: boolean;
|
|
skipSecrets?: boolean;
|
|
includeSchedules?: boolean;
|
|
includeTriggers?: boolean;
|
|
includeUsers?: boolean;
|
|
includeGroups?: boolean;
|
|
includeSettings?: boolean;
|
|
includeKey?: boolean;
|
|
message?: string;
|
|
includes?: string[];
|
|
extraIncludes?: string[];
|
|
excludes?: string[];
|
|
defaultTs?: "bun" | "deno";
|
|
codebases?: Codebase[];
|
|
parallel?: number;
|
|
}
|
|
|
|
export interface Codebase {
|
|
relative_path: string;
|
|
includes?: string[];
|
|
excludes?: string[];
|
|
assets?: {
|
|
from: string;
|
|
to: string;
|
|
}[];
|
|
customBundler?: string;
|
|
external?: string[];
|
|
define?: { [key: string]: string };
|
|
inject?: string[];
|
|
}
|
|
|
|
export async function readConfigFile(): Promise<SyncOptions> {
|
|
try {
|
|
const conf = (await yamlParseFile("wmill.yaml")) as SyncOptions;
|
|
if (conf?.defaultTs == undefined) {
|
|
log.warn(
|
|
"No defaultTs defined in your wmill.yaml. Using 'bun' as default."
|
|
);
|
|
}
|
|
return typeof conf == "object" ? conf : ({} as SyncOptions);
|
|
} catch (e) {
|
|
log.warn(
|
|
"No wmill.yaml found. Use 'wmill init' to bootstrap it. Using 'bun' as default typescript runtime."
|
|
);
|
|
return {};
|
|
}
|
|
}
|
|
|
|
export async function mergeConfigWithConfigFile<T>(
|
|
opts: T
|
|
): Promise<T & SyncOptions> {
|
|
const configFile = await readConfigFile();
|
|
return Object.assign(configFile, opts);
|
|
}
|