From 9329006ad822e78c196d5ea6469b694d20c9a67f Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Mon, 9 Sep 2024 10:56:46 +0200 Subject: [PATCH] fix(cli): add --extra-includes to improve git sync capabilities --- cli/main.ts | 7 ------- cli/sync.ts | 25 ++++++++++++++++--------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/cli/main.ts b/cli/main.ts index 446460dc8d..dc7dcde52d 100644 --- a/cli/main.ts +++ b/cli/main.ts @@ -14,8 +14,6 @@ import workspace, { getActiveWorkspace } from "./workspace.ts"; import resource from "./resource.ts"; import user from "./user.ts"; import variable from "./variable.ts"; -import lgeacyPush from "./push.ts"; -import legacyPull from "./pull.ts"; import hub from "./hub.ts"; import folder from "./folder.ts"; import schedule from "./schedule.ts"; @@ -45,8 +43,6 @@ export { sync, instance, dev, - lgeacyPush, - legacyPull, hubPull, pull, push, @@ -142,9 +138,6 @@ let command: any = new Command() }) ) .command("completions", new CompletionsCommand()); -if (Number.parseInt(VERSION.replace("v", "").replace(".", "")) > 1700) { - command = command.command("push", lgeacyPush).command("pull", legacyPull); -} export let showDiffs = false; async function main() { diff --git a/cli/sync.ts b/cli/sync.ts index 00f57a70da..0e56972410 100644 --- a/cli/sync.ts +++ b/cli/sync.ts @@ -798,6 +798,7 @@ export const isWhitelisted = (p: string) => { export async function ignoreF(wmillconf: { includes?: string[]; excludes?: string[]; + extraIncludes?: string[]; }): Promise<(p: string, isDirectory: boolean) => boolean> { let whitelist: { approve(file: string): boolean } | undefined = undefined; @@ -811,7 +812,9 @@ export async function ignoreF(wmillconf: { (!wmillconf.includes || wmillconf.includes?.some((i) => minimatch(file, i))) && (!wmillconf?.excludes || - wmillconf.excludes!.every((i) => !minimatch(file, i))) + wmillconf.excludes!.every((i) => !minimatch(file, i))) && + (!wmillconf.extraIncludes || + wmillconf.extraIncludes.some((i) => minimatch(file, i))) ); }, }; @@ -1412,9 +1415,7 @@ const command = new Command() log.info("2 actions available, pull and push. Use -h to display help.") ) .command("pull") - .description( - "Pull any remote changes and apply them locally. Use --raw for usage without local state tracking." - ) + .description("Pull any remote changes and apply them locally.") .option( "--fail-conflicts", "Error on conflicts (both remote and local have changes on the same item)" @@ -1440,18 +1441,20 @@ const command = new Command() .option("--include-key", "Include workspace encryption key") .option( "-i --includes ", - "Comma separated patterns to specify which file to take into account (among files that are compatible with windmill). Patterns can include * (any string until '/') and ** (any string)" + "Comma separated patterns to specify which file to take into account (among files that are compatible with windmill). Patterns can include * (any string until '/') and ** (any string). Overrides wmill.yaml includes" ) .option( "-e --excludes ", - "Comma separated patterns to specify which file to NOT take into account." + "Comma separated patterns to specify which file to NOT take into account. Overrides wmill.yaml excludes" + ) + .option( + "--extra-includes ", + "Comma separated patterns to specify which file to take into account (among files that are compatible with windmill). Patterns can include * (any string until '/') and ** (any string). Useful to still take wmill.yaml into account and act as a second pattern to satisfy" ) // deno-lint-ignore no-explicit-any .action(pull as any) .command("push") - .description( - "Push any local changes and apply them remotely. Use --raw for usage without local state tracking." - ) + .description("Push any local changes and apply them remotely.") .option( "--fail-conflicts", "Error on conflicts (both remote and local have changes on the same item)" @@ -1484,6 +1487,10 @@ const command = new Command() "-e --excludes ", "Comma separated patterns to specify which file to NOT take into account." ) + .option( + "--extra-includes ", + "Comma separated patterns to specify which file to take into account (among files that are compatible with windmill). Patterns can include * (any string until '/') and ** (any string). Useful to still take wmill.yaml into account and act as a second pattern to satisfy" + ) .option( "--message ", "Include a message that will be added to all scripts/flows/apps updated during this push"