MCPcopy
hub / github.com/lingodotdev/lingo.dev / getWatchPatterns

Function getWatchPatterns

packages/cli/src/cli/cmd/run/watch.ts:88–126  ·  view source on GitHub ↗
(ctx: CmdRunContext)

Source from the content-addressed store, hash-verified

86}
87
88async function getWatchPatterns(ctx: CmdRunContext): Promise<string[]> {
89 if (!ctx.config) return [];
90
91 const buckets = getBuckets(ctx.config);
92 const patterns: string[] = [];
93
94 for (const bucket of buckets) {
95 // Skip if specific buckets are filtered
96 if (ctx.flags.bucket && !ctx.flags.bucket.includes(bucket.type)) {
97 continue;
98 }
99
100 for (const bucketPath of bucket.paths) {
101 // Skip if specific files are filtered
102 if (ctx.flags.file) {
103 if (
104 !ctx.flags.file.some(
105 (f) =>
106 bucketPath.pathPattern.includes(f) ||
107 minimatch(bucketPath.pathPattern, f),
108 )
109 ) {
110 continue;
111 }
112 }
113
114 // Get the source locale pattern (replace [locale] with source locale)
115 const sourceLocale = ctx.flags.sourceLocale || ctx.config.locale.source;
116 const sourcePattern = bucketPath.pathPattern.replace(
117 "[locale]",
118 sourceLocale,
119 );
120
121 patterns.push(sourcePattern);
122 }
123 }
124
125 return patterns;
126}
127
128function handleFileChange(
129 filePath: string,

Callers 1

watchFunction · 0.85

Calls 2

getBucketsFunction · 0.90
pushMethod · 0.65

Tested by

no test coverage detected