odac 1.0.0 ā 1.0.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/CHANGELOG.md +10 -0
- package/bin/odac.js +1 -21
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/bin/odac.js
CHANGED
|
@@ -20,31 +20,14 @@ async function run() {
|
|
|
20
20
|
const projectName = args[0] || '.'
|
|
21
21
|
const targetDir = path.resolve(process.cwd(), projectName)
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
if (fs.existsSync(targetDir)) {
|
|
25
|
-
const files = fs.readdirSync(targetDir)
|
|
26
|
-
const isNotEmpty = files.some(file =>
|
|
27
|
-
!['.git', '.DS_Store', '.gitignore', '.idea', '.vscode'].includes(file)
|
|
28
|
-
)
|
|
29
|
-
|
|
30
|
-
if (isNotEmpty) {
|
|
31
|
-
console.error(`ā Error: Directory "${projectName === '.' ? 'Current directory' : projectName}" is not empty.`)
|
|
32
|
-
console.error(' Please run in an empty directory or specify a new project name.')
|
|
33
|
-
process.exit(1)
|
|
34
|
-
}
|
|
35
|
-
} else {
|
|
36
|
-
fs.mkdirSync(targetDir, { recursive: true })
|
|
37
|
-
}
|
|
23
|
+
if (!fs.existsSync(targetDir)) fs.mkdirSync(targetDir, { recursive: true })
|
|
38
24
|
|
|
39
|
-
// 4. Copy Template
|
|
40
25
|
console.log(`š Initializing new Odac project in: ${targetDir}`)
|
|
41
26
|
const templateDir = path.resolve(__dirname, '../template')
|
|
42
27
|
|
|
43
28
|
try {
|
|
44
|
-
// Recursive copy
|
|
45
29
|
fs.cpSync(templateDir, targetDir, { recursive: true })
|
|
46
30
|
|
|
47
|
-
// Update package.json
|
|
48
31
|
const pkgPath = path.join(targetDir, 'package.json')
|
|
49
32
|
const frameworkPkg = require('../package.json')
|
|
50
33
|
|
|
@@ -52,7 +35,6 @@ async function run() {
|
|
|
52
35
|
pkg.name = projectName === '.' ? path.basename(targetDir) : projectName
|
|
53
36
|
pkg.version = '0.0.1'
|
|
54
37
|
|
|
55
|
-
// Inject framework dependency
|
|
56
38
|
if (!pkg.dependencies) pkg.dependencies = {}
|
|
57
39
|
pkg.dependencies[frameworkPkg.name] = `^${frameworkPkg.version}`
|
|
58
40
|
|
|
@@ -78,7 +60,6 @@ async function run() {
|
|
|
78
60
|
cwd: targetDir
|
|
79
61
|
})
|
|
80
62
|
} catch (err) {
|
|
81
|
-
// User probably cancelled with Ctrl+C
|
|
82
63
|
console.log('\nš Server stopped.')
|
|
83
64
|
}
|
|
84
65
|
|
|
@@ -87,7 +68,6 @@ async function run() {
|
|
|
87
68
|
}
|
|
88
69
|
|
|
89
70
|
} else if (command === 'dev') {
|
|
90
|
-
// Start the framework
|
|
91
71
|
require('../index.js')
|
|
92
72
|
} else {
|
|
93
73
|
console.log('Usage:')
|