MCPcopy Create free account
hub / github.com/TanStack/cli / createIgnore

Function createIgnore

packages/create/src/file-helpers.ts:253–273  ·  view source on GitHub ↗
(path: string, includeProjectFiles = true)

Source from the content-addressed store, hash-verified

251const PROJECT_FILES = ['package.json']
252
253export function createIgnore(path: string, includeProjectFiles = true) {
254 const ignoreList = existsSync(resolve(path, '.gitignore'))
255 ? (
256 parseGitignore(
257 readFileSync(resolve(path, '.gitignore')),
258 ) as unknown as { patterns: Array<string> }
259 ).patterns
260 : []
261 const ig = ignore().add(ignoreList)
262 return (filePath: string) => {
263 const fileName = basename(filePath)
264 if (
265 IGNORE_FILES.includes(fileName) ||
266 (includeProjectFiles && PROJECT_FILES.includes(fileName))
267 ) {
268 return true
269 }
270 const nameWithoutDotSlash = fileName.replace(/^\.\//, '')
271 return ig.ignores(nameWithoutDotSlash)
272 }
273}
274
275export function cleanUpFiles(
276 files: Record<string, string>,

Callers 4

recursivelyGatherFilesFunction · 0.85
buildAssetsDirectoryFunction · 0.85
compileStarterFunction · 0.85

Calls 2

addMethod · 0.80
replaceMethod · 0.65

Tested by

no test coverage detected