owl-cli 7.0.0 → 7.2.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.
Files changed (2) hide show
  1. package/bin/owl-init.js +26 -5
  2. package/package.json +1 -1
package/bin/owl-init.js CHANGED
@@ -2,6 +2,25 @@
2
2
 
3
3
  const fs = require('fs')
4
4
  const {join, resolve} = require('path')
5
+ const path = require('path')
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
+
5
24
 
6
25
  let cwd = process.cwd();
7
26
 
@@ -28,11 +47,11 @@ fs.mkdirSync(modelsDir)
28
47
 
29
48
  //在models Dir 目录下创建一个example.json
30
49
  let exampleDir = resolve( __dirname,"../examples/models")
31
- fs.readdirSync(exampleDir).map(name => {
32
- let fullname = resolve(exampleDir,name)
33
- let dst = resolve(modelsDir,name)
34
- fs.copyFileSync(fullname, dst)
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');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "owl-cli",
3
- "version": "7.0.0",
3
+ "version": "7.2.0",
4
4
  "main": "index.js",
5
5
  "preferGlobal": true,
6
6
  "bin": {