create-sks-admin 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cli.js +12 -2
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -33,13 +33,23 @@ console.log(`
|
|
|
33
33
|
`)
|
|
34
34
|
|
|
35
35
|
const projectPath = path.resolve(process.cwd(), projectName)
|
|
36
|
+
const isCurrentDir = projectName === '.'
|
|
36
37
|
|
|
37
|
-
// Check if folder exists
|
|
38
|
-
if (fs.existsSync(projectPath)) {
|
|
38
|
+
// Check if folder exists (skip for current dir)
|
|
39
|
+
if (!isCurrentDir && fs.existsSync(projectPath)) {
|
|
39
40
|
log.error(`Folder "${projectName}" already exists!`)
|
|
40
41
|
process.exit(1)
|
|
41
42
|
}
|
|
42
43
|
|
|
44
|
+
// For current directory, check if it's empty (allow .git and other hidden files)
|
|
45
|
+
if (isCurrentDir) {
|
|
46
|
+
const files = fs.readdirSync(projectPath).filter(f => !f.startsWith('.'))
|
|
47
|
+
if (files.length > 0) {
|
|
48
|
+
log.error('Current directory is not empty! Use an empty folder or provide a project name.')
|
|
49
|
+
process.exit(1)
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
43
53
|
try {
|
|
44
54
|
// Step 1: Create Next.js app
|
|
45
55
|
log.info('Creating Next.js app...')
|