MCPcopy Create free account
hub / github.com/dailydotdev/apps / scaffoldRealm

Function scaffoldRealm

packages/world-cli/bin/world.js:183–197  ·  view source on GitHub ↗
(file, realm, family)

Source from the content-addressed store, hash-verified

181}
182
183async function scaffoldRealm(file, realm, family) {
184 const addition = await builderSource(realm, family);
185 if (!(await exists(file))) {
186 await mkdir(dirname(file), { recursive: true });
187 await writeFile(file, addition);
188 return "created";
189 }
190
191 const source = await readFile(file, "utf8");
192 if (new RegExp(`export\\s+function\\s+${family}\\b`).test(source)) {
193 return "already exports this family";
194 }
195 await writeFile(file, `${source.trimEnd()}\n\n${addition}`);
196 return "added family";
197}
198
199async function scaffoldOverride(file, realm, family) {
200 if (await exists(file)) return "already exists";

Callers 1

runCreateFunction · 0.85

Calls 2

builderSourceFunction · 0.85
existsFunction · 0.70

Tested by

no test coverage detected