6 examples of 'nodejs gitignore' in JavaScript

Every line of 'nodejs gitignore' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
15addToGitIgnore(line) {
16 const file = './.gitignore'
17
18 let gitignore = read(file)
19 if (gitignore.includes(line)) return
20 gitignore += '\n' + line
21
22 write(file, gitignore)
23}
13async function updateGitIgnore(dir) {
14 // add our ember build directories to .gitignore
15 let gitIgnorePath = path.join(dir, '.gitignore');
16 let contents = await readFile(gitIgnorePath);
17 await writeFile(gitIgnorePath, [
18 contents.toString(),
19 '# Ember build',
20 `${emberBuildDir}/`,
21 `${emberTestBuildDir}/`,
22 ''
23 ].join('\n'));
24}
465createGitIgnore(outDir, entries) {
466 this.log(`Creating '.gitignore' ...`);
467
468 fs.writeFileSync(
469 String(outDir) + '/.gitignore',
470 entries.join("\n"),
471 'utf8'
472 );
473}
22export function createGitIgnore(projectName) {
23 log.verbose('creating .gitignore file', { projectName });
24
25 writeFile(
26 `${projectName}/${constants.github.gitIgnore.fileName}`,
27 loadTemplate('./../../templates/git/gitignore')
28 );
29}
165protected npmignore() {
166 return `
167/coverage/
168/docs/
169*.ts
170!*.d.ts
171tsconfig.test.json
172*.tsbuildinfo
173 `.trim();
174 }
38function createGitIgnoreFile(dirPath) {
39 fs.copySync(
40 `${templatesPath}/starterFileGitignore.txt`,
41 `${dirPath}/.gitignore`
42 );
43}

Related snippets