|
1 | 1 | import { PrintableShellCommand } from "printable-shell-command"; |
2 | 2 | import type { Args } from "./args"; |
3 | 3 |
|
| 4 | +const DEFAULT_EXCLUDES = [".DS_Store", ".git", ".jj", "node_modules"]; |
| 5 | + |
4 | 6 | export interface TargetOptions { |
5 | 7 | username?: string; |
6 | 8 | fromLocalDir?: string; |
| 9 | + skipDefaultExcludes?: true | string[]; |
7 | 10 | additionalExcludes?: string[]; |
8 | 11 | } |
9 | 12 |
|
10 | 13 | export const targetOptionsFields = { |
11 | 14 | username: true, |
12 | 15 | fromLocalDir: true, |
| 16 | + skipDefaultExcludes: true, |
13 | 17 | additionalExcludes: true, |
14 | 18 | }; // TODO: make this more DRY |
15 | 19 |
|
@@ -83,9 +87,14 @@ export async function deploy( |
83 | 87 | // rsyncCommandArgs.push("--mkpath"); |
84 | 88 | // } |
85 | 89 |
|
86 | | - rsyncCommandArgs.push(["--exclude", ".git"]); |
87 | | - rsyncCommandArgs.push(["--exclude", ".jj"]); |
88 | | - rsyncCommandArgs.push(["--exclude", ".DS_Store"]); |
| 90 | + if (targetOptions?.skipDefaultExcludes !== true) { |
| 91 | + const toSkip = new Set(targetOptions?.skipDefaultExcludes ?? []); |
| 92 | + for (const pattern of DEFAULT_EXCLUDES) { |
| 93 | + if (!toSkip.has(pattern)) { |
| 94 | + rsyncCommandArgs.push(["--exclude", pattern]); |
| 95 | + } |
| 96 | + } |
| 97 | + } |
89 | 98 | for (const additionalExclude of targetOptions?.additionalExcludes ?? []) { |
90 | 99 | rsyncCommandArgs.push(["--exclude", additionalExclude]); |
91 | 100 | } |
|
0 commit comments