Unverified Commit f74bdef4 authored by Tim Neutkens's avatar Tim Neutkens Committed by GitHub

Add more known folders to is-folder-empty check in create-next-app (#88218)

## What?

Allows creating a new Next.js app when there's an existing `.claude`,
`.vscode`, or `.cursor` folder/file.
parent d13d1ba2
...@@ -4,7 +4,9 @@ import { join } from 'node:path' ...@@ -4,7 +4,9 @@ import { join } from 'node:path'
import { green, blue } from 'picocolors' import { green, blue } from 'picocolors'
export function isFolderEmpty(root: string, name: string): boolean { export function isFolderEmpty(root: string, name: string): boolean {
const validFiles = [ const validFilesOrFolders = [
'.claude',
'.cursor',
'.DS_Store', '.DS_Store',
'.git', '.git',
'.gitattributes', '.gitattributes',
...@@ -16,6 +18,8 @@ export function isFolderEmpty(root: string, name: string): boolean { ...@@ -16,6 +18,8 @@ export function isFolderEmpty(root: string, name: string): boolean {
'.idea', '.idea',
'.npmignore', '.npmignore',
'.travis.yml', '.travis.yml',
'.vscode',
'.zed',
'LICENSE', 'LICENSE',
'Thumbs.db', 'Thumbs.db',
'docs', 'docs',
...@@ -28,10 +32,10 @@ export function isFolderEmpty(root: string, name: string): boolean { ...@@ -28,10 +32,10 @@ export function isFolderEmpty(root: string, name: string): boolean {
] ]
const conflicts = readdirSync(root).filter( const conflicts = readdirSync(root).filter(
(file) => (fileOrFolder) =>
!validFiles.includes(file) && !validFilesOrFolders.includes(fileOrFolder) &&
// Support IntelliJ IDEA-based editors // Support IntelliJ IDEA-based editors
!/\.iml$/.test(file) !/\.iml$/.test(fileOrFolder)
) )
if (conflicts.length > 0) { if (conflicts.length > 0) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment