owl-cli 7.0.0 → 7.1.0
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/owl-init.js +26 -5
- package/package.json +1 -1
package/bin/owl-init.js
CHANGED
|
@@ -3,6 +3,25 @@
|
|
|
3
3
|
const fs = require('fs')
|
|
4
4
|
const {join, resolve} = require('path')
|
|
5
5
|
|
|
6
|
+
|
|
7
|
+
// 创建递归复制函数
|
|
8
|
+
function copyRecursiveSync(src, dest) {
|
|
9
|
+
const stats = fs.statSync(src)
|
|
10
|
+
|
|
11
|
+
if (stats.isDirectory()) {
|
|
12
|
+
// 如果是目录,创建目标目录
|
|
13
|
+
fs.mkdirSync(dest, { recursive: true })
|
|
14
|
+
// 读取目录内容并递归复制
|
|
15
|
+
fs.readdirSync(src).forEach(item => {
|
|
16
|
+
copyRecursiveSync(path.join(src, item), path.join(dest, item))
|
|
17
|
+
})
|
|
18
|
+
} else {
|
|
19
|
+
// 如果是文件,直接复制
|
|
20
|
+
fs.copyFileSync(src, dest)
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
|
|
6
25
|
let cwd = process.cwd();
|
|
7
26
|
|
|
8
27
|
//复制owlconfig.json到 当前目录
|
|
@@ -28,11 +47,11 @@ fs.mkdirSync(modelsDir)
|
|
|
28
47
|
|
|
29
48
|
//在models Dir 目录下创建一个example.json
|
|
30
49
|
let exampleDir = resolve( __dirname,"../examples/models")
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
50
|
+
copyRecursiveSync(exampleDir,modelsDir);
|
|
51
|
+
|
|
52
|
+
let appsDir = resolve( __dirname,"../examples/owlsysAps");
|
|
53
|
+
let destAppsDir = join(cwd,"owlsysAps");
|
|
54
|
+
copyRecursiveSync(appsDir,destAppsDir);
|
|
36
55
|
|
|
37
56
|
//在project目录下面创建一个build.properties
|
|
38
57
|
|
|
@@ -42,6 +61,8 @@ let fullname = resolve(buildPropertiesPath,'build.properties');
|
|
|
42
61
|
let dstBuildProperties = resolve(cwd,'build.properties')
|
|
43
62
|
fs.copyFileSync(fullname, dstBuildProperties)
|
|
44
63
|
|
|
64
|
+
|
|
65
|
+
|
|
45
66
|
//生成.gitignore
|
|
46
67
|
let gitignorePath = join(__dirname,'../examples/gitignore');
|
|
47
68
|
let gitignoreSrc = resolve(gitignorePath,'gitignore_example.txt');
|