MCPcopy Create free account
hub / github.com/boringstack-xyz/boringstack / main

Function main

apps/api/scripts/codegen/new-notification-event.ts:165–190  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

163 const filename = toFilename(eventName);
164 const identifier = toExportIdentifier(eventName);
165 const title = toReadableTitle(eventName);
166 const eventFilePath = `${EVENTS_DIR}${filename}.event.ts`;
167
168 if (existsSync(eventFilePath)) {
169 console.error(`Event file already exists: ${eventFilePath}`);
170 process.exit(1);
171 }
172
173 await writeFile(eventFilePath, buildEventFile(eventName, identifier, title));
174 await patchBarrel(identifier, filename);
175
176 console.log(`✅ Created event "${eventName}"`);
177 console.log(` ${eventFilePath}`);
178 console.log(` Identifier: ${identifier}`);
179 console.log(` Registered in: ${BARREL_PATH}`);
180 console.log("");
181 console.log("Next steps:");
182 console.log(" 1. Edit the schema + render functions to match your domain.");
183 console.log(
184 " 2. Call `notifications.send(<identifier>, { ... })` from your service."
185 );
186};
187
188await main();

Callers 1

Calls 7

parseEventNameFunction · 0.85
toFilenameFunction · 0.85
toExportIdentifierFunction · 0.85
toReadableTitleFunction · 0.85
buildEventFileFunction · 0.85
patchBarrelFunction · 0.85
errorMethod · 0.80

Tested by

no test coverage detected