(dir: string, options: InitCommandOptions)
| 268 | } |
| 269 | |
| 270 | async function gitIgnoreDotTriggerDir(dir: string, options: InitCommandOptions) { |
| 271 | return await tracer.startActiveSpan("gitIgnoreDotTriggerDir", async (span) => { |
| 272 | try { |
| 273 | const projectDir = resolve(process.cwd(), dir); |
| 274 | const gitIgnorePath = join(projectDir, ".gitignore"); |
| 275 | |
| 276 | span.setAttributes({ |
| 277 | "cli.projectDir": projectDir, |
| 278 | "cli.gitIgnorePath": gitIgnorePath, |
| 279 | }); |
| 280 | |
| 281 | if (!(await pathExists(gitIgnorePath))) { |
| 282 | // Create .gitignore file |
| 283 | await createFile(gitIgnorePath, ".trigger"); |
| 284 | |
| 285 | log.step(`Added .trigger to .gitignore`); |
| 286 | |
| 287 | span.end(); |
| 288 | |
| 289 | return; |
| 290 | } |
| 291 | |
| 292 | // Check if .gitignore already contains .trigger |
| 293 | const gitIgnoreContent = await readFile(gitIgnorePath); |
| 294 | |
| 295 | if (gitIgnoreContent.includes(".trigger")) { |
| 296 | span.end(); |
| 297 | |
| 298 | return; |
| 299 | } |
| 300 | |
| 301 | const newGitIgnoreContent = `${gitIgnoreContent}\n.trigger`; |
| 302 | |
| 303 | await writeFile(gitIgnorePath, newGitIgnoreContent, "utf-8"); |
| 304 | |
| 305 | log.step(`Added .trigger to .gitignore`); |
| 306 | |
| 307 | span.end(); |
| 308 | } catch (e) { |
| 309 | if (!(e instanceof SkipCommandError)) { |
| 310 | recordSpanException(span, e); |
| 311 | } |
| 312 | |
| 313 | span.end(); |
| 314 | |
| 315 | throw e; |
| 316 | } |
| 317 | }); |
| 318 | } |
| 319 | |
| 320 | async function addConfigFileToTsConfig(dir: string, options: InitCommandOptions) { |
| 321 | return await tracer.startActiveSpan("createTriggerDir", async (span) => { |
no test coverage detected
searching dependent graphs…