()
| 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 | |
| 188 | await main(); |
no test coverage detected