MCPcopy Create free account
hub / github.com/Snapchat/Valdi / readModuleName

Function readModuleName

npm_modules/cli/src/preview/previewGenerator.ts:287–294  ·  view source on GitHub ↗
(moduleDir: string)

Source from the content-addressed store, hash-verified

285
286/** Read the valdi_module name from a BUILD.bazel file in the given directory */
287export function readModuleName(moduleDir: string): string {
288 const buildContent = fs.readFileSync(path.join(moduleDir, 'BUILD.bazel'), 'utf8');
289 const nameMatch = buildContent.match(/valdi_module\s*\([^)]*name\s*=\s*"(\w+)"/s);
290 if (!nameMatch) {
291 throw new Error(`Could not find valdi_module name in ${moduleDir}/BUILD.bazel`);
292 }
293 return nameMatch[1]!;
294}
295
296/** Detect whether this workspace is the core Valdi repo */
297export function isValdiWorkspace(workspaceRoot: string): boolean {

Callers 2

computeModuleLabelFunction · 0.85

Calls 3

readFileSyncMethod · 0.80
joinMethod · 0.45
matchMethod · 0.45

Tested by

no test coverage detected