mm_machine 1.4.2 → 1.4.5

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/index.js +19 -7
  2. package/package.json +34 -34
package/index.js CHANGED
@@ -3,8 +3,7 @@
3
3
  * @author <a href="http://qww.elins.cn">邱文武</a>
4
4
  * @version 1.2
5
5
  */
6
-
7
- require('mm_expand');
6
+ var conf = require('mm_config');
8
7
 
9
8
  const fs = require('fs');
10
9
 
@@ -62,9 +61,9 @@ class Item {
62
61
  */
63
62
  "sort": 10,
64
63
  /**
65
- * 开关, true表示开启,false表示关闭
64
+ * 状态, 1表示开启,0表示未开启
66
65
  */
67
- "switch": true
66
+ "state": 1
68
67
  };
69
68
 
70
69
  /**
@@ -74,6 +73,14 @@ class Item {
74
73
  }
75
74
  }
76
75
 
76
+ /**
77
+ * 设置配置
78
+ * @param {Object} config 配置
79
+ */
80
+ Item.prototype.set_config = function(config){
81
+ this.config = conf(Object.assign(this.config, config));
82
+ }
83
+
77
84
  /**
78
85
  * @description 加载完成时
79
86
  */
@@ -345,9 +352,14 @@ Index.prototype.load_list = function(list) {
345
352
  _this.load_item(dir, obj, file);
346
353
  }
347
354
  } else {
348
- var fl = _this.dir_base + "/config.tpl.json";
349
- if (fl.hasFile()) {
350
- fl.copyFile(file);
355
+ if (_this.Drive) {
356
+ var drive = new _this.Drive();
357
+ drive.new_config(file);
358
+ } else {
359
+ var fl = _this.dir_base + "/config.tpl.json";
360
+ if (fl.hasFile()) {
361
+ fl.copyFile(file);
362
+ }
351
363
  }
352
364
  }
353
365
  });
package/package.json CHANGED
@@ -1,34 +1,34 @@
1
- {
2
- "name": "mm_machine",
3
- "version": "1.4.2",
4
- "description": "这是超级美眉框架机制构建辅助模块,用于快速构建一个机制",
5
- "main": "index.js",
6
- "scripts": {
7
- "test": "node test.js"
8
- },
9
- "repository": {
10
- "type": "git",
11
- "url": "git+https://github.com/qiuwenwu/mm_machine.git"
12
- },
13
- "keywords": [
14
- "common",
15
- "com",
16
- "run",
17
- "cmd",
18
- "load",
19
- "save",
20
- "get",
21
- "set",
22
- "add",
23
- "del"
24
- ],
25
- "author": "邱文武",
26
- "license": "ISC",
27
- "bugs": {
28
- "url": "https://github.com/qiuwenwu/mm_machine/issues"
29
- },
30
- "homepage": "https://github.com/qiuwenwu/mm_machine#readme",
31
- "dependencies": {
32
- "mm_expand": "^1.4.7"
33
- }
34
- }
1
+ {
2
+ "name": "mm_machine",
3
+ "version": "1.4.5",
4
+ "description": "这是超级美眉框架机制构建辅助模块,用于快速构建一个机制",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "test": "node test.js"
8
+ },
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/qiuwenwu/mm_machine.git"
12
+ },
13
+ "keywords": [
14
+ "common",
15
+ "com",
16
+ "run",
17
+ "cmd",
18
+ "load",
19
+ "save",
20
+ "get",
21
+ "set",
22
+ "add",
23
+ "del"
24
+ ],
25
+ "author": "邱文武",
26
+ "license": "ISC",
27
+ "bugs": {
28
+ "url": "https://github.com/qiuwenwu/mm_machine/issues"
29
+ },
30
+ "homepage": "https://github.com/qiuwenwu/mm_machine#readme",
31
+ "dependencies": {
32
+ "mm_config": "^1.0.2"
33
+ }
34
+ }