MCPcopy
hub / github.com/triggerdotdev/trigger.dev / gitIgnoreDotTriggerDir

Function gitIgnoreDotTriggerDir

packages/cli-v3/src/commands/init.ts:270–318  ·  view source on GitHub ↗
(dir: string, options: InitCommandOptions)

Source from the content-addressed store, hash-verified

268}
269
270async 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
320async function addConfigFileToTsConfig(dir: string, options: InitCommandOptions) {
321 return await tracer.startActiveSpan("createTriggerDir", async (span) => {

Callers 1

_initCommandFunction · 0.85

Calls 5

pathExistsFunction · 0.90
createFileFunction · 0.90
readFileFunction · 0.90
recordSpanExceptionFunction · 0.85
startActiveSpanMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…