MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / substitute

Function substitute

apps/host-cloudflare/scripts/preview.ts:204–208  ·  view source on GitHub ↗
(pattern: RegExp, replacement: string)

Source from the content-addressed store, hash-verified

202 const basePath = resolve(APP_DIR, "wrangler.jsonc");
203 let text = readFileSync(basePath, "utf8");
204 const substitute = (pattern: RegExp, replacement: string): void => {
205 if (!pattern.test(text))
206 fail(`wrangler.jsonc no longer matches ${pattern} — update preview.ts`);
207 text = text.replace(pattern, replacement);
208 };
209 substitute(/"name":\s*"executor-cloudflare"/, `"name": "${worker}"`);
210 substitute(/"database_name":\s*"[^"]*"/, `"database_name": "${databaseName}"`);
211 substitute(/"database_id":\s*"[^"]*"/, `"database_id": "${databaseId}"`);

Callers 1

writePreviewConfigFunction · 0.85

Calls 2

failFunction · 0.70
replaceMethod · 0.65

Tested by

no test coverage detected