Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add types to gitignore.ts #6527

Merged
merged 6 commits into from May 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 19 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Expand Up @@ -193,6 +193,7 @@
"@types/jsonwebtoken": "9.0.6",
"@types/node": "20.9.0",
"@types/node-fetch": "2.6.11",
"@types/parse-gitignore": "^1.0.2",
"@types/prettyjson": "0.0.33",
"@types/semver": "7.5.8",
"@types/uuid": "9.0.8",
Expand Down
8 changes: 2 additions & 6 deletions src/utils/gitignore.ts
@@ -1,22 +1,19 @@
import { readFile, writeFile } from 'fs/promises'
import path from 'path'

// @ts-expect-error TS(7016) FIXME: Could not find a declaration file for module 'pars... Remove this comment to see the full error message
import parseIgnore from 'parse-gitignore'

import { fileExistsAsync } from '../lib/fs.js'

import { log } from './command-helpers.js'

// @ts-expect-error TS(7006) FIXME: Parameter 'dir' implicitly has an 'any' type.
const hasGitIgnore = async function (dir) {
const hasGitIgnore = async function (dir: string) {
const gitIgnorePath = path.join(dir, '.gitignore')
const hasIgnore = await fileExistsAsync(gitIgnorePath)
return hasIgnore
}

// @ts-expect-error TS(7006) FIXME: Parameter 'dir' implicitly has an 'any' type.
export const ensureNetlifyIgnore = async function (dir) {
export const ensureNetlifyIgnore = async function (dir: string) {
const gitIgnorePath = path.join(dir, '.gitignore')
const ignoreContent = '# Local Netlify folder\n.netlify\n'

Expand All @@ -35,7 +32,6 @@ export const ensureNetlifyIgnore = async function (dir) {
// ignore
}
/* Not ignoring .netlify folder. Add to .gitignore */
// @ts-expect-error TS(7006) FIXME: Parameter 'pattern' implicitly has an 'any' type.
if (!ignorePatterns || !ignorePatterns.patterns.some((pattern) => /(^|\/|\\)\.netlify($|\/|\\)/.test(pattern))) {
log()
log('Adding local .netlify folder to .gitignore file...')
Expand Down