@fastcar/core 0.2.50 → 0.2.52

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 (38) hide show
  1. package/annotation.d.ts +3 -0
  2. package/index.d.ts +5 -0
  3. package/package.json +1 -1
  4. package/src/FastCarApplication.ts +11 -3
  5. package/src/annotation/env/BaseName.ts +7 -0
  6. package/src/annotation.ts +2 -1
  7. package/src/constant/CommonConstant.ts +1 -0
  8. package/src/utils/DataFormat.ts +5 -0
  9. package/target/FastCarApplication.js +10 -3
  10. package/target/annotation/env/BaseName.js +9 -0
  11. package/target/annotation.js +3 -1
  12. package/target/constant/CommonConstant.js +1 -0
  13. package/target/utils/DataFormat.js +4 -0
  14. package/test/example/logs/fastcar-server.logger.log +3 -0
  15. package/test/example/logs/fastcar-server.logger1.log +9 -0
  16. package/test/example/logs/fastcar-server.sys1.log +14 -0
  17. package/test/example/logs/fastcar-server.sys2.log +2 -0
  18. package/test/example/logs/fastcar-server.sys3.log +9 -0
  19. package/test/example/logs/fastcar-server.sys4.log +1 -0
  20. package/test/example/logs/other-server.app.log +0 -0
  21. package/test/example/logs/other-server.logger.log +3 -0
  22. package/test/example/logs/other-server.sys.log +25 -0
  23. package/test/example/logs/other-server.sys1.log +12 -0
  24. package/test/example/logs/other-server.sys2.log +15 -0
  25. package/test/example/logs/other-server.sys3.log +0 -0
  26. package/test/example/logs/sys10.log +0 -0
  27. package/test/example/logs/sys11.log +0 -0
  28. package/test/example/logs/sys4.log +0 -0
  29. package/test/example/logs/sys5.log +0 -0
  30. package/test/example/logs/sys6.log +0 -0
  31. package/test/example/logs/sys7.log +0 -0
  32. package/test/example/logs/sys8.log +0 -0
  33. package/test/example/logs/sys9.log +0 -0
  34. package/test/example/resource/application-test.yml +2 -0
  35. package/test/example/resource/other-test.yml +2 -0
  36. package/test/example/resource/other.yml +10 -0
  37. package/test/example/simple/app-test.ts +48 -0
  38. package/test/example/simple/app.ts +2 -0
package/annotation.d.ts CHANGED
@@ -147,6 +147,9 @@ export function BaseFilePath(name: string): Ret;
147
147
  //设置入口文件夹路径
148
148
  export function BasePath(name: string): Ret;
149
149
 
150
+ //设置资源文件不是application的
151
+ export function BaseName(name: string): Ret;
152
+
150
153
  //自定义程序内配置
151
154
  export function ApplicationSetting(setting: { [key: string]: any }): Ret;
152
155
 
package/index.d.ts CHANGED
@@ -70,6 +70,11 @@ export class FastCarApplication extends Events {
70
70
  */
71
71
  getBasePath(): string;
72
72
 
73
+ /***
74
+ * @version 1.0 获取项目的基础资源路径
75
+ */
76
+ getBaseName(): string;
77
+
73
78
  /**
74
79
  * @version 1.0 加载系统配置 加载顺序为 default json < yaml < env
75
80
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fastcar/core",
3
- "version": "0.2.50",
3
+ "version": "0.2.52",
4
4
  "homepage": "https://github.com/williamDazhangyu/fast-car",
5
5
  "main": "target/index.js",
6
6
  "author": "william_zhong",
@@ -45,6 +45,7 @@ class FastCarApplication extends Events {
45
45
  protected resourcePath: string = ""; //资源路径
46
46
  protected delayHotIds: Map<string, { fp: string; loadType: number }>;
47
47
  protected reloadTimerId: NodeJS.Timeout | null;
48
+ protected basename: string = CommonConstant.Application;
48
49
 
49
50
  constructor() {
50
51
  super();
@@ -97,7 +98,7 @@ class FastCarApplication extends Events {
97
98
  });
98
99
 
99
100
  this.on("sysReload", (fp: string) => {
100
- if (fp.indexOf(CommonConstant.Application) != -1) {
101
+ if (fp.indexOf(this.basename) != -1) {
101
102
  this.addDelayHot(fp, 2);
102
103
  }
103
104
  });
@@ -165,16 +166,23 @@ class FastCarApplication extends Events {
165
166
  return this.basePath;
166
167
  }
167
168
 
169
+ /**
170
+ * @version 1.0 获取项目读取的基本配置路径
171
+ */
172
+ getBaseName(): string {
173
+ return this.basename;
174
+ }
175
+
168
176
  /***
169
177
  * @version 1.0 加载系统配置 加载顺序为 default json < yaml < env
170
178
  *
171
179
  */
172
180
  loadSysConfig() {
173
- this.sysConfig = FileUtil.getApplicationConfig(this.getResourcePath(), CommonConstant.Application, this.sysConfig);
181
+ this.sysConfig = FileUtil.getApplicationConfig(this.getResourcePath(), this.basename, this.sysConfig);
174
182
 
175
183
  let env = (Reflect.get(this, CommonConstant.ENV) || this.sysConfig.application.env || "devlopment") as string;
176
184
 
177
- this.sysConfig = FileUtil.getApplicationConfig(this.getResourcePath(), `${CommonConstant.Application}-${env}`, this.sysConfig);
185
+ this.sysConfig = FileUtil.getApplicationConfig(this.getResourcePath(), `${this.basename}-${env}`, this.sysConfig);
178
186
 
179
187
  //自定义环境变量设置
180
188
  process.env.NODE_ENV = env;
@@ -0,0 +1,7 @@
1
+ import { CommonConstant } from "../../constant/CommonConstant";
2
+
3
+ export default function BaseName(name: string) {
4
+ return function (target: any) {
5
+ Reflect.set(target.prototype, CommonConstant.BaseName, name);
6
+ };
7
+ }
package/src/annotation.ts CHANGED
@@ -47,6 +47,7 @@ import ApplicationDestory from "./annotation/lifeCycle/ApplicationDestory";
47
47
  import ApplicationSetting from "./annotation/env/ApplicationSetting";
48
48
  import AliasInjection from "./annotation/bind/AliasInjection";
49
49
  import ResourcePath from "./annotation/env/ResourcePath";
50
+ import BaseName from "./annotation/env/BaseName";
50
51
 
51
52
  //注解暴露出去
52
53
  export {
@@ -100,4 +101,4 @@ export {
100
101
  Transactional, //事务管理
101
102
  };
102
103
 
103
- export { ENV, BaseFilePath, BasePath, ApplicationSetting };
104
+ export { ENV, BaseFilePath, BasePath, BaseName, ApplicationSetting };
@@ -10,6 +10,7 @@ export const CommonConstant = {
10
10
  FastcarSetting: Symbol("FastcarSetting"),
11
11
  ResourcePath: "resourcePath",
12
12
  APPId: "appid",
13
+ BaseName: "basename", //设置基础的文件名称
13
14
  };
14
15
 
15
16
  export const FileResSuffix = ["json", "yml", "js"];
@@ -35,6 +35,11 @@ class DataFormat {
35
35
  if (value == "false") {
36
36
  return false;
37
37
  }
38
+
39
+ //增加判断是不是数值类型
40
+ if (!isNaN(parseInt(value))) {
41
+ return !!parseInt(value);
42
+ }
38
43
  }
39
44
 
40
45
  return !!value;
@@ -34,6 +34,7 @@ let FastCarApplication = FastCarApplication_1 = class FastCarApplication extends
34
34
  constructor() {
35
35
  super();
36
36
  this.resourcePath = ""; //资源路径
37
+ this.basename = CommonConstant_1.CommonConstant.Application;
37
38
  this.sysConfig = SysConfig_1.SYSDefaultConfig;
38
39
  this.componentMap = new Map();
39
40
  this.componentDeatils = new Map();
@@ -76,7 +77,7 @@ let FastCarApplication = FastCarApplication_1 = class FastCarApplication extends
76
77
  this.addDelayHot(fp, 1);
77
78
  });
78
79
  this.on("sysReload", (fp) => {
79
- if (fp.indexOf(CommonConstant_1.CommonConstant.Application) != -1) {
80
+ if (fp.indexOf(this.basename) != -1) {
80
81
  this.addDelayHot(fp, 2);
81
82
  }
82
83
  });
@@ -138,14 +139,20 @@ let FastCarApplication = FastCarApplication_1 = class FastCarApplication extends
138
139
  getBasePath() {
139
140
  return this.basePath;
140
141
  }
142
+ /**
143
+ * @version 1.0 获取项目读取的基本配置路径
144
+ */
145
+ getBaseName() {
146
+ return this.basename;
147
+ }
141
148
  /***
142
149
  * @version 1.0 加载系统配置 加载顺序为 default json < yaml < env
143
150
  *
144
151
  */
145
152
  loadSysConfig() {
146
- this.sysConfig = FileUtil_1.default.getApplicationConfig(this.getResourcePath(), CommonConstant_1.CommonConstant.Application, this.sysConfig);
153
+ this.sysConfig = FileUtil_1.default.getApplicationConfig(this.getResourcePath(), this.basename, this.sysConfig);
147
154
  let env = (Reflect.get(this, CommonConstant_1.CommonConstant.ENV) || this.sysConfig.application.env || "devlopment");
148
- this.sysConfig = FileUtil_1.default.getApplicationConfig(this.getResourcePath(), `${CommonConstant_1.CommonConstant.Application}-${env}`, this.sysConfig);
155
+ this.sysConfig = FileUtil_1.default.getApplicationConfig(this.getResourcePath(), `${this.basename}-${env}`, this.sysConfig);
149
156
  //自定义环境变量设置
150
157
  process.env.NODE_ENV = env;
151
158
  //判断程序内是否有配置
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const CommonConstant_1 = require("../../constant/CommonConstant");
4
+ function BaseName(name) {
5
+ return function (target) {
6
+ Reflect.set(target.prototype, CommonConstant_1.CommonConstant.BaseName, name);
7
+ };
8
+ }
9
+ exports.default = BaseName;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ApplicationSetting = exports.BasePath = exports.BaseFilePath = exports.ENV = exports.Transactional = exports.SqlSession = exports.Entity = exports.Table = exports.PrimaryKey = exports.Field = exports.DBType = exports.DSIndex = exports.DS = exports.ResourcePath = exports.Rule = exports.ValidForm = exports.ValidCustom = exports.Type = exports.Size = exports.NotNull = exports.DefaultVal = exports.AddChildValid = exports.AddRequireModule = exports.Log = exports.Readonly = exports.Override = exports.NotImplemented = exports.Deprecate = exports.ExceptionMonitor = exports.AliasInjection = exports.CallDependency = exports.Autowired = exports.Application = exports.Injection = exports.Repository = exports.Service = exports.Controller = exports.Configure = exports.BeanName = exports.Hotter = exports.ComponentInjection = exports.Component = exports.ComponentScanExclusion = exports.ComponentScan = exports.ApplicationDestory = exports.ApplicationInit = exports.ApplicationRunner = exports.ApplicationStop = exports.ApplicationStart = void 0;
3
+ exports.ApplicationSetting = exports.BaseName = exports.BasePath = exports.BaseFilePath = exports.ENV = exports.Transactional = exports.SqlSession = exports.Entity = exports.Table = exports.PrimaryKey = exports.Field = exports.DBType = exports.DSIndex = exports.DS = exports.ResourcePath = exports.Rule = exports.ValidForm = exports.ValidCustom = exports.Type = exports.Size = exports.NotNull = exports.DefaultVal = exports.AddChildValid = exports.AddRequireModule = exports.Log = exports.Readonly = exports.Override = exports.NotImplemented = exports.Deprecate = exports.ExceptionMonitor = exports.AliasInjection = exports.CallDependency = exports.Autowired = exports.Application = exports.Injection = exports.Repository = exports.Service = exports.Controller = exports.Configure = exports.BeanName = exports.Hotter = exports.ComponentInjection = exports.Component = exports.ComponentScanExclusion = exports.ComponentScan = exports.ApplicationDestory = exports.ApplicationInit = exports.ApplicationRunner = exports.ApplicationStop = exports.ApplicationStart = void 0;
4
4
  const Application_1 = require("./annotation/Application");
5
5
  exports.Application = Application_1.default;
6
6
  const Autowired_1 = require("./annotation/bind/Autowired");
@@ -99,3 +99,5 @@ const AliasInjection_1 = require("./annotation/bind/AliasInjection");
99
99
  exports.AliasInjection = AliasInjection_1.default;
100
100
  const ResourcePath_1 = require("./annotation/env/ResourcePath");
101
101
  exports.ResourcePath = ResourcePath_1.default;
102
+ const BaseName_1 = require("./annotation/env/BaseName");
103
+ exports.BaseName = BaseName_1.default;
@@ -13,5 +13,6 @@ exports.CommonConstant = {
13
13
  FastcarSetting: Symbol("FastcarSetting"),
14
14
  ResourcePath: "resourcePath",
15
15
  APPId: "appid",
16
+ BaseName: "basename", //设置基础的文件名称
16
17
  };
17
18
  exports.FileResSuffix = ["json", "yml", "js"];
@@ -32,6 +32,10 @@ class DataFormat {
32
32
  if (value == "false") {
33
33
  return false;
34
34
  }
35
+ //增加判断是不是数值类型
36
+ if (!isNaN(parseInt(value))) {
37
+ return !!parseInt(value);
38
+ }
35
39
  }
36
40
  return !!value;
37
41
  }
@@ -4,3 +4,6 @@
4
4
  {"timestamp":"2023-10-11 09:56:00.302","level":"INFO","label":"fastcar-server.logger","message":"自定义的日志输出"}
5
5
  {"timestamp":"2023-10-11 09:56:00.304","level":"WARN","label":"fastcar-server.logger","message":"自定义警告"}
6
6
  {"timestamp":"2023-10-11 09:56:00.305","level":"ERROR","label":"fastcar-server.logger","message":"自定义报错"}
7
+ {"timestamp":"2023-10-25 14:34:00.264","level":"INFO","label":"fastcar-server.logger","message":"自定义的日志输出"}
8
+ {"timestamp":"2023-10-25 14:34:00.265","level":"WARN","label":"fastcar-server.logger","message":"自定义警告"}
9
+ {"timestamp":"2023-10-25 14:34:00.267","level":"ERROR","label":"fastcar-server.logger","message":"自定义报错"}
@@ -0,0 +1,9 @@
1
+ {"timestamp":"2023-10-25 14:35:19.238","level":"INFO","label":"fastcar-server.logger","message":"自定义的日志输出"}
2
+ {"timestamp":"2023-10-25 14:35:19.239","level":"WARN","label":"fastcar-server.logger","message":"自定义警告"}
3
+ {"timestamp":"2023-10-25 14:35:19.240","level":"ERROR","label":"fastcar-server.logger","message":"自定义报错"}
4
+ {"timestamp":"2023-10-25 14:35:59.908","level":"INFO","label":"fastcar-server.logger","message":"自定义的日志输出"}
5
+ {"timestamp":"2023-10-25 14:35:59.909","level":"WARN","label":"fastcar-server.logger","message":"自定义警告"}
6
+ {"timestamp":"2023-10-25 14:35:59.910","level":"ERROR","label":"fastcar-server.logger","message":"自定义报错"}
7
+ {"timestamp":"2023-10-25 14:36:26.263","level":"INFO","label":"fastcar-server.logger","message":"自定义的日志输出"}
8
+ {"timestamp":"2023-10-25 14:36:26.264","level":"WARN","label":"fastcar-server.logger","message":"自定义警告"}
9
+ {"timestamp":"2023-10-25 14:36:26.265","level":"ERROR","label":"fastcar-server.logger","message":"自定义报错"}
@@ -1 +1,15 @@
1
1
  {"timestamp":"2023-10-11 09:56:07.330","level":"INFO","label":"fastcar-server.sys","message":"application stop"}
2
+ {"timestamp":"2023-10-25 14:34:00.90","level":"INFO","label":"fastcar-server.sys","message":"Start scanning component"}
3
+ {"timestamp":"2023-10-25 14:34:00.248","level":"INFO","label":"fastcar-server.sys","message":"Complete component scan"}
4
+ {"timestamp":"2023-10-25 14:34:00.250","level":"INFO","label":"fastcar-server.sys","message":"Call application initialization method"}
5
+ {"timestamp":"2023-10-25 14:34:00.252","level":"INFO","label":"fastcar-server.sys","message":"start server app is run"}
6
+ {"timestamp":"2023-10-25 14:34:00.253","level":"INFO","label":"fastcar-server.sys","message":"version 1.0.0"}
7
+ {"timestamp":"2023-10-25 14:34:02.279","level":"INFO","label":"fastcar-server.sys","message":"exit reason","splat":"[\"beforeExit exit\"]"}
8
+ {"timestamp":"2023-10-25 14:34:02.280","level":"INFO","label":"fastcar-server.sys","message":"Call the method before the application stops"}
9
+ {"timestamp":"2023-10-25 14:35:19.73","level":"INFO","label":"fastcar-server.sys","message":"Start scanning component"}
10
+ {"timestamp":"2023-10-25 14:35:19.226","level":"INFO","label":"fastcar-server.sys","message":"Complete component scan"}
11
+ {"timestamp":"2023-10-25 14:35:19.228","level":"INFO","label":"fastcar-server.sys","message":"Call application initialization method"}
12
+ {"timestamp":"2023-10-25 14:35:19.230","level":"INFO","label":"fastcar-server.sys","message":"start server app is run"}
13
+ {"timestamp":"2023-10-25 14:35:19.231","level":"INFO","label":"fastcar-server.sys","message":"version 1.0.0"}
14
+ {"timestamp":"2023-10-25 14:35:21.260","level":"INFO","label":"fastcar-server.sys","message":"exit reason","splat":"[\"beforeExit exit\"]"}
15
+ {"timestamp":"2023-10-25 14:35:21.262","level":"INFO","label":"fastcar-server.sys","message":"Call the method before the application stops"}
@@ -0,0 +1,2 @@
1
+ {"timestamp":"2023-10-25 14:35:26.267","level":"INFO","label":"fastcar-server.sys","message":"application stop"}
2
+ {"timestamp":"2023-10-25 14:35:29.748","level":"INFO","label":"fastcar-server.sys","message":"Start scanning component"}
@@ -0,0 +1,9 @@
1
+ {"timestamp":"2023-10-25 14:36:01.919","level":"INFO","label":"fastcar-server.sys","message":"exit reason","splat":"[\"beforeExit exit\"]"}
2
+ {"timestamp":"2023-10-25 14:36:01.920","level":"INFO","label":"fastcar-server.sys","message":"Call the method before the application stops"}
3
+ {"timestamp":"2023-10-25 14:36:01.920","level":"INFO","label":"fastcar-server.sys","message":"exit reason","splat":"[\"beforeExit exit\"]"}
4
+ {"timestamp":"2023-10-25 14:36:01.921","level":"INFO","label":"fastcar-server.sys","message":"Call the method before the application stops"}
5
+ {"timestamp":"2023-10-25 14:36:06.933","level":"INFO","label":"fastcar-server.sys","message":"application stop"}
6
+ {"timestamp":"2023-10-25 14:36:28.275","level":"INFO","label":"fastcar-server.sys","message":"exit reason","splat":"[\"beforeExit exit\"]"}
7
+ {"timestamp":"2023-10-25 14:36:28.275","level":"INFO","label":"fastcar-server.sys","message":"Call the method before the application stops"}
8
+ {"timestamp":"2023-10-25 14:36:28.276","level":"INFO","label":"fastcar-server.sys","message":"exit reason","splat":"[\"beforeExit exit\"]"}
9
+ {"timestamp":"2023-10-25 14:36:28.277","level":"INFO","label":"fastcar-server.sys","message":"Call the method before the application stops"}
@@ -0,0 +1 @@
1
+ {"timestamp":"2023-10-25 14:36:33.280","level":"INFO","label":"fastcar-server.sys","message":"application stop"}
File without changes
@@ -0,0 +1,3 @@
1
+ {"timestamp":"2023-10-25 14:35:29.943","level":"INFO","label":"other-server.logger","message":"自定义的日志输出"}
2
+ {"timestamp":"2023-10-25 14:35:29.944","level":"WARN","label":"other-server.logger","message":"自定义警告"}
3
+ {"timestamp":"2023-10-25 14:35:29.945","level":"ERROR","label":"other-server.logger","message":"自定义报错"}
@@ -0,0 +1,25 @@
1
+ {"timestamp":"2023-10-25 14:35:59.689","level":"INFO","label":"other-server.sys","message":"Start scanning component"}
2
+ {"timestamp":"2023-10-25 14:36:26.34","level":"INFO","label":"other-server.sys","message":"Start scanning component"}
3
+ {"timestamp":"2023-10-25 14:36:33.799","level":"INFO","label":"other-server.sys","message":"Start scanning component"}
4
+ {"timestamp":"2023-10-25 14:36:34.84","level":"INFO","label":"other-server.sys","message":"Complete component scan"}
5
+ {"timestamp":"2023-10-25 14:36:34.86","level":"INFO","label":"other-server.sys","message":"Call application initialization method"}
6
+ {"timestamp":"2023-10-25 14:36:34.89","level":"INFO","label":"other-server.sys","message":"start server app is run"}
7
+ {"timestamp":"2023-10-25 14:36:34.90","level":"INFO","label":"other-server.sys","message":"version 1.0.0"}
8
+ {"timestamp":"2023-10-25 14:36:34.105","level":"INFO","label":"other-server.sys","message":"exit reason","splat":"[\"beforeExit exit\"]"}
9
+ {"timestamp":"2023-10-25 14:36:34.106","level":"INFO","label":"other-server.sys","message":"Call the method before the application stops"}
10
+ {"timestamp":"2023-10-25 14:36:39.118","level":"INFO","label":"other-server.sys","message":"application stop"}
11
+ {"timestamp":"2023-10-25 14:41:43.901","level":"INFO","label":"other-server.sys","message":"Start scanning component"}
12
+ {"timestamp":"2023-10-25 14:41:44.189","level":"INFO","label":"other-server.sys","message":"Complete component scan"}
13
+ {"timestamp":"2023-10-25 14:41:44.191","level":"INFO","label":"other-server.sys","message":"Call application initialization method"}
14
+ {"timestamp":"2023-10-25 14:41:44.193","level":"INFO","label":"other-server.sys","message":"start server app is run"}
15
+ {"timestamp":"2023-10-25 14:41:44.194","level":"INFO","label":"other-server.sys","message":"version 1.0.0"}
16
+ {"timestamp":"2023-10-25 14:41:44.199","level":"INFO","label":"other-server.sys","message":"exit reason","splat":"[\"beforeExit exit\"]"}
17
+ {"timestamp":"2023-10-25 14:41:44.199","level":"INFO","label":"other-server.sys","message":"Call the method before the application stops"}
18
+ {"timestamp":"2023-10-25 14:41:49.209","level":"INFO","label":"other-server.sys","message":"application stop"}
19
+ {"timestamp":"2023-10-25 14:42:25.346","level":"INFO","label":"other-server.sys","message":"Start scanning component"}
20
+ {"timestamp":"2023-10-25 14:42:25.643","level":"INFO","label":"other-server.sys","message":"Complete component scan"}
21
+ {"timestamp":"2023-10-25 14:42:25.645","level":"INFO","label":"other-server.sys","message":"Call application initialization method"}
22
+ {"timestamp":"2023-10-25 14:42:25.647","level":"INFO","label":"other-server.sys","message":"start server app is run"}
23
+ {"timestamp":"2023-10-25 14:42:25.648","level":"INFO","label":"other-server.sys","message":"version 1.0.0"}
24
+ {"timestamp":"2023-10-25 14:42:25.684","level":"INFO","label":"other-server.sys","message":"exit reason","splat":"[\"beforeExit exit\"]"}
25
+ {"timestamp":"2023-10-25 14:42:25.685","level":"INFO","label":"other-server.sys","message":"Call the method before the application stops"}
@@ -0,0 +1,12 @@
1
+ {"timestamp":"2023-10-25 14:35:31.960","level":"INFO","label":"other-server.sys","message":"exit reason","splat":"[\"beforeExit exit\"]"}
2
+ {"timestamp":"2023-10-25 14:35:31.961","level":"INFO","label":"other-server.sys","message":"Call the method before the application stops"}
3
+ {"timestamp":"2023-10-25 14:35:31.961","level":"INFO","label":"other-server.sys","message":"exit reason","splat":"[\"beforeExit exit\"]"}
4
+ {"timestamp":"2023-10-25 14:35:31.962","level":"INFO","label":"other-server.sys","message":"Call the method before the application stops"}
5
+ {"timestamp":"2023-10-25 14:41:29.283","level":"INFO","label":"other-server.sys","message":"Start scanning component"}
6
+ {"timestamp":"2023-10-25 14:41:29.625","level":"INFO","label":"other-server.sys","message":"Complete component scan"}
7
+ {"timestamp":"2023-10-25 14:41:29.626","level":"INFO","label":"other-server.sys","message":"Call application initialization method"}
8
+ {"timestamp":"2023-10-25 14:41:29.629","level":"INFO","label":"other-server.sys","message":"start server app is run"}
9
+ {"timestamp":"2023-10-25 14:41:29.630","level":"INFO","label":"other-server.sys","message":"version 1.0.0"}
10
+ {"timestamp":"2023-10-25 14:41:29.647","level":"INFO","label":"other-server.sys","message":"exit reason","splat":"[\"beforeExit exit\"]"}
11
+ {"timestamp":"2023-10-25 14:41:29.648","level":"INFO","label":"other-server.sys","message":"Call the method before the application stops"}
12
+ {"timestamp":"2023-10-25 14:41:34.666","level":"INFO","label":"other-server.sys","message":"application stop"}
@@ -0,0 +1,15 @@
1
+ {"timestamp":"2023-10-25 14:46:34.128","level":"INFO","label":"other-server.sys","message":"Start scanning component"}
2
+ {"timestamp":"2023-10-25 14:46:34.462","level":"INFO","label":"other-server.sys","message":"Complete component scan"}
3
+ {"timestamp":"2023-10-25 14:46:34.463","level":"INFO","label":"other-server.sys","message":"Call application initialization method"}
4
+ {"timestamp":"2023-10-25 14:46:34.466","level":"INFO","label":"other-server.sys","message":"start server app is run"}
5
+ {"timestamp":"2023-10-25 14:46:34.467","level":"INFO","label":"other-server.sys","message":"version 1.0.0"}
6
+ {"timestamp":"2023-10-25 14:46:34.471","level":"INFO","label":"other-server.sys","message":"exit reason","splat":"[\"beforeExit exit\"]"}
7
+ {"timestamp":"2023-10-25 14:46:34.472","level":"INFO","label":"other-server.sys","message":"Call the method before the application stops"}
8
+ {"timestamp":"2023-10-25 14:46:39.478","level":"INFO","label":"other-server.sys","message":"application stop"}
9
+ {"timestamp":"2023-10-25 14:46:55.210","level":"INFO","label":"other-server.sys","message":"Start scanning component"}
10
+ {"timestamp":"2023-10-25 14:46:55.494","level":"INFO","label":"other-server.sys","message":"Complete component scan"}
11
+ {"timestamp":"2023-10-25 14:46:55.497","level":"INFO","label":"other-server.sys","message":"Call application initialization method"}
12
+ {"timestamp":"2023-10-25 14:46:55.500","level":"INFO","label":"other-server.sys","message":"start server app is run"}
13
+ {"timestamp":"2023-10-25 14:46:55.501","level":"INFO","label":"other-server.sys","message":"version 1.0.0"}
14
+ {"timestamp":"2023-10-25 14:46:55.507","level":"INFO","label":"other-server.sys","message":"exit reason","splat":"[\"beforeExit exit\"]"}
15
+ {"timestamp":"2023-10-25 14:46:55.508","level":"INFO","label":"other-server.sys","message":"Call the method before the application stops"}
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,2 @@
1
+ settings:
2
+ name: "这是一个测试文件"
@@ -0,0 +1,10 @@
1
+ application:
2
+ scan:
3
+ exclude: ["noclude"]
4
+ settings:
5
+ log:
6
+ consoleLevel: info
7
+ fileLevel: info
8
+ maxsize: 1024
9
+ maxFiles: 10
10
+ printConsole: true
@@ -0,0 +1,48 @@
1
+ import "reflect-metadata";
2
+ import Application from "../../../src/annotation/Application";
3
+ import ENV from "../../../src/annotation/env/ENV";
4
+ import FastCarApplication from "../../../src/FastCarApplication";
5
+ import BaseFilePath from "../../../src/annotation/env/BaseFilePath";
6
+ import BasePath from "../../../src/annotation/env/BasePath";
7
+ import ApplicationHook from "../../../src/interface/ApplicationHook";
8
+ import Log from "../../../src/annotation/stereotype/Log";
9
+ import Logger from "../../../src/interface/Logger";
10
+ import ApplicationSetting from "../../../src/annotation/env/ApplicationSetting";
11
+ import { ComponentScanExclusion } from "../../../src/annotation";
12
+ import BaseName from "../../../src/annotation/env/BaseName";
13
+
14
+ @Application
15
+ @ENV("test") //设置环境变量
16
+ @BasePath(__dirname) //直接运行ts文件时可不用
17
+ @BaseFilePath(__filename)
18
+ @ApplicationSetting({
19
+ appid: "other-server",
20
+ })
21
+ @BaseName("other")
22
+ @ComponentScanExclusion("app.ts")
23
+ class APP implements ApplicationHook {
24
+ app!: FastCarApplication;
25
+
26
+ @Log("app")
27
+ logger!: Logger;
28
+
29
+ beforeStartServer(): void {
30
+ this.logger.debug("beforeStartServer-----");
31
+ }
32
+
33
+ startServer(): void {
34
+ this.logger.debug("startServer------");
35
+ }
36
+
37
+ beforeStopServer(): void {
38
+ this.logger.debug("beforeStopServer-----");
39
+ }
40
+
41
+ stopServer(): void {
42
+ this.logger.debug("stopServer-----");
43
+ }
44
+ }
45
+
46
+ let appInsatcne = new APP();
47
+ console.log("打印文件读取名称", appInsatcne.app.getBaseName());
48
+ console.log("打印文件内容", appInsatcne.app.getSetting("name"));
@@ -10,7 +10,9 @@ import ApplicationHook from "../../../src/interface/ApplicationHook";
10
10
  import Log from "../../../src/annotation/stereotype/Log";
11
11
  import Logger from "../../../src/interface/Logger";
12
12
  import ApplicationSetting from "../../../src/annotation/env/ApplicationSetting";
13
+ import { ComponentScanExclusion } from "../../../src/annotation";
13
14
 
15
+ @ComponentScanExclusion("app-test.ts")
14
16
  @Application
15
17
  @ENV("test") //设置环境变量
16
18
  @BasePath(__dirname) //直接运行ts文件时可不用