Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/utils/gitignore.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ const parseIgnore = require('parse-gitignore')

const { fileExistsAsync, readFileAsync, writeFileAsync } = require('../lib/fs')

const { log } = require('./command-helpers')

const hasGitIgnore = async function (dir) {
const gitIgnorePath = path.join(dir, '.gitignore')
const hasIgnore = await fileExistsAsync(gitIgnorePath)
Expand All @@ -30,6 +32,8 @@ const ensureNetlifyIgnore = async function (dir) {
}
/* Not ignoring .netlify folder. Add to .gitignore */
if (!ignorePatterns || !ignorePatterns.patterns.some((pattern) => /(^|\/|\\)\.netlify($|\/|\\)/.test(pattern))) {
log()
log('Adding local .netlify folder to .gitignore file...')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
log('Adding local .netlify folder to .gitignore file...')
log('Adding local .netlify folder to .gitignore file.')

const newContents = `${gitIgnoreContents}\n${ignoreContent}`
await writeFileAsync(gitIgnorePath, newContents, 'utf8')
}
Expand Down