@xiaoguomeiyitian/core 1.1.0 → 1.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/dist/cli.js CHANGED
@@ -6,7 +6,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  require("bytenode");
8
8
  const path_1 = __importDefault(require("path"));
9
- const { Global, copyDir, delFiles, RandomGenerator } = require("./lib_" + process.platform + '_' + process.versions.node.split('.')[0] + '.jsc');
9
+ const { Global, copyDir, delFiles, GenEntityDefs, GenServiceFunc } = require("./lib_" + process.platform + '_' + process.versions.node.split('.')[0] + '.jsc');
10
10
  // 获取当前工作目录
11
11
  const cwd = process.cwd();
12
12
  const cmd = process.argv[2];
@@ -26,3 +26,13 @@ if (cmd == "dbg") {
26
26
  process.argv = [process.argv[0], process.argv[1], process.argv[2], "-autoDeBug", "1", "-serverType", process.argv[3], "-rpcPort", process.argv[4]];
27
27
  global.G = new Global();
28
28
  }
29
+ //生成EntityDefs
30
+ if (cmd == "defs") {
31
+ new GenEntityDefs().gen("./src/shared/protocols/entityDefs.ts");
32
+ }
33
+ //生成ServiceFunc
34
+ if (cmd == "func") {
35
+ const gen = new GenServiceFunc();
36
+ gen.gen("./src/rpc/serviceProto.ts", "./src/rpc/serviceFunc.ts", ["rpc"]);
37
+ gen.gen("./src/shared/protocols/serviceProto.ts", "./src/shared/protocols/serviceFunc.ts", ["client", "server"]);
38
+ }
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  var _a;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.delFiles = exports.copyDir = exports.Entity = exports.Global = void 0;
4
+ exports.GenServiceFunc = exports.GenEntityDefs = exports.delFiles = exports.copyDir = exports.Entity = exports.Global = void 0;
5
5
  require("bytenode");
6
- _a = require("./lib_" + process.platform + '_' + process.versions.node.split('.')[0] + '.jsc'), exports.Global = _a.Global, exports.Entity = _a.Entity, exports.copyDir = _a.copyDir, exports.delFiles = _a.delFiles;
6
+ _a = require("./lib_" + process.platform + '_' + process.versions.node.split('.')[0] + '.jsc'), exports.Global = _a.Global, exports.Entity = _a.Entity, exports.copyDir = _a.copyDir, exports.delFiles = _a.delFiles, exports.GenEntityDefs = _a.GenEntityDefs, exports.GenServiceFunc = _a.GenServiceFunc;
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xiaoguomeiyitian/core",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "main": "dist/index.js",
5
5
  "types": "types/lib.d.ts",
6
6
  "bin": {
@@ -13,10 +13,10 @@
13
13
  "dist/lib_*.jsc"
14
14
  ],
15
15
  "scripts": {
16
- "jsc": "node ./gen_jsc.js ./dist/lib.js ./dist/lib.jsc",
17
16
  "build": "tsc --build --diagnostics",
18
- "pack": "npm pack --pack-destination",
19
- "bp": "npm run build && npm run pack"
17
+ "jsc": "node ./gen_jsc.js ./dist/lib.js ./dist/lib.jsc",
18
+ "pack": "npm pack --pack-destination ../sheShou/server",
19
+ "bp": "npm run build && npm run jsc && npm run pack"
20
20
  },
21
21
  "bundleDependencies": false,
22
22
  "devDependencies": {
package/types/lib.d.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  import { EventEmitter } from "events";
2
2
  import { WsConnection } from "tsrpc";
3
3
  export declare class Global {
4
+ /** cwd路径 */
5
+ _cwdDir: string;
4
6
  event: EventEmitter;
5
7
  entityDefList: any;
6
8
  serviceProto: any;
@@ -23,9 +25,9 @@ export declare class Global {
23
25
  getRpc(type: string, serverUrl: string): any;
24
26
  /**获取某类实体属性的类型 */
25
27
  getByType(type: string): any[];
26
- /**加载某个文件夹下的所有文件*/
27
- loadAllFile(source: any): void;
28
- /**热更新某个文件 @param { boolean} reChain 是否更新继承链上的其他实体 @param { boolean} reload 是否重新加载文件 */
28
+ /**加载某个文件夹下的所有文件 reChain 是否更新继承链上的其他实体 @param { boolean} reload 是否重新加载文件 默认:false */
29
+ loadAllFile(source: string, reChain?: boolean, reload?: boolean): void;
30
+ /**热更新某个文件 @param { boolean} reChain 是否更新继承链上的其他实体 @param { boolean} reload 是否重新加载文件 默认:true */
29
31
  loadfile(filePath: string, reChain?: boolean, reload?: boolean): Promise<void>;
30
32
  /**保存之前没有保存的dump数据*/
31
33
  flushDumpData(): Promise<void>;
@@ -39,6 +41,7 @@ export declare class Global {
39
41
  export declare class Entity {
40
42
  type: string; /** 实体类型 */
41
43
  id: string; /** 实体id */
44
+ /** 连接列表 */
42
45
  conns: WsConnection[];
43
46
  constructor(type: string, id?: string);
44
47
  /**获取属性类型 */
@@ -79,6 +82,12 @@ export declare class Entity {
79
82
  onPropChange(prop: string, value: any): void;
80
83
  onDestroy(): void;
81
84
  }
85
+ export declare class GenEntityDefs {
86
+ gen(filePath: any): void;
87
+ }
88
+ export declare class GenServiceFunc {
89
+ gen(fReadPath: any, fWritePath: any, types: any): void;
90
+ }
82
91
  /** 拷贝文件或目录 */
83
92
  export declare function copyDir(sourceDir: string, destDir: string): Promise<void>;
84
93
  /** 删除文件或者目录 */