chanjs 1.0.28 → 1.0.30

Sign up to get free protection for your applications and to get access to all the features.
package/README.en.md ADDED
@@ -0,0 +1,100 @@
1
+ # [中文](./README.md) | English
2
+
3
+ # <center>Chan.js MVC Framework</center>
4
+
5
+ Chan.js is a lightweight MVC framework developed in pure JavaScript based on Express. It embodies functional programming concepts, offering superior performance, clear code, and easy-to-follow processes that ensure high maintainability.
6
+
7
+ ## 特性
8
+
9
+ - Built on top of Express
10
+ - Supports ES6 syntax
11
+ - Modular Design
12
+ - Supports multiple module routes
13
+ - Supports multiple module views
14
+ - Supports multiple module controllers
15
+ - Supports multiple module services
16
+ - Plugin-based architecture
17
+ - Lightweight (core code within 300 lines)
18
+ - Long-term maintenance
19
+
20
+ ## Conventions Over Configuration
21
+
22
+ ```code
23
+ |- app
24
+ |- config 配置
25
+ |- module 模块1
26
+ |- module1 模块1
27
+ |- controller 控制器
28
+ |- service 服务模型
29
+ |- view 视图模板
30
+ |- router.js 路由
31
+ |- module2 模块2
32
+ |- controller 控制器
33
+ |- service 服务模型
34
+ |- view 视图模板
35
+ |- router.js路由
36
+ |- extend 扩展
37
+ |- middleware 中间件
38
+ |- plugin 插件
39
+ |- plus-module1 插件1
40
+ |- controller 控制器
41
+ |- service 服务模型
42
+ |- view 视图模板
43
+ |- router.js 路由
44
+ |- module2 插件2
45
+ |- controller 控制器
46
+ |- service 服务模型
47
+ |- view 视图模板
48
+ |- router.js路由
49
+ |- public 静态文件
50
+ |- index.js
51
+ ```
52
+
53
+ ### Initialization Process
54
+
55
+ - Initialization
56
+ - Load configuration
57
+ - Load modules
58
+ - Load services
59
+ - Load controllers
60
+ - Load routers
61
+ - Load extensions
62
+ - Load plugins
63
+ - Load services
64
+ - Load controllers
65
+ - Load routers
66
+ - beforeStart() Hook to merge configurations from the database into the configuration
67
+ - run() Start the server
68
+
69
+ ### Official Website
70
+
71
+ A CMS system developed with Chan.js
72
+ Website:<https://www.chancms.top>
73
+
74
+ ### Highlights
75
+
76
+ - Configuration files
77
+ - Multi-module MVC structure
78
+ - Plugin MVC support
79
+ - CORS cross-origin configuration support
80
+ - MySQL database support
81
+ - Route control
82
+ - Art-template template engine
83
+ - Static resources management
84
+ - Cookie handling
85
+ - Logging capabilities
86
+
87
+ ### 运行
88
+
89
+ ```javascript
90
+ const Chanjs = require("chanjs");
91
+ const chan = new Chanjs();
92
+ // Load middleware
93
+ chan.beforeStart(fn);
94
+ // Scan modules
95
+ chan.start();
96
+ // Start the server
97
+ chan.run();
98
+ ```
99
+
100
+ This framework is designed for developers who seek a balance between simplicity and functionality, providing a robust foundation for building web applications with ease.
package/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ # 中文 | [English](./README.en.md)
2
+
1
3
  # <center>Chan.js mvc框架</center>
2
4
 
3
5
  Chan.js 基于express 纯js研发的轻量级mvc框架。基于函数式编程思想,性能优越,代码清晰,流程易读,可持续维护高。
package/core/chan.js CHANGED
@@ -26,7 +26,6 @@ class Chan {
26
26
  this.router = express.Router();
27
27
  this.loadConfig();
28
28
  this.loadExtends();
29
- //加载核心(日志、favicon 图标、cookie、json、url、模板引擎、静态资源)
30
29
  this.loadCore();
31
30
  this.loadKnex();
32
31
  this.loadCors();
@@ -4,6 +4,8 @@ const path = require('path');
4
4
  * @description 根目录
5
5
  */
6
6
  const ROOT_PATH = process.cwd();
7
+ // 读取package.json文件
8
+ const {version='1.0.0',author='明空'} = require(path.join(ROOT_PATH, 'package.json'));
7
9
 
8
10
  /**
9
11
  * @description 程序目录
@@ -12,10 +14,11 @@ const APP_PATH = path.join(ROOT_PATH, 'app');
12
14
 
13
15
  let config = {
14
16
  JSON_LIMIT:"100kb",
15
- SqlDebug:true,
16
17
  logger : {
17
18
  level: 'dev',
18
19
  },
20
+ version,
21
+ author,
19
22
  env:'dev',
20
23
  template:'default',
21
24
  views:[], //模板路径
@@ -30,7 +33,7 @@ let config = {
30
33
  port: "3306",
31
34
  user: "root",
32
35
  password: "123456",
33
- database: "chanyue",
36
+ database: "chancms",
34
37
  charset: "utf8mb4",
35
38
  }
36
39
  }
package/package.json CHANGED
@@ -1,12 +1,14 @@
1
1
  {
2
2
  "name": "chanjs",
3
- "version": "1.0.28",
3
+ "version": "1.0.30",
4
4
  "description": "chanjs基于express 纯js研发的轻量级mvc框架。",
5
5
  "main": "core/chan.js",
6
6
  "module": "core/chan.js",
7
7
  "keywords": [
8
8
  "\"chanjs\"",
9
9
  "\"express mvc\"",
10
+ "\"express mysql\"",
11
+ "\"express knex\"",
10
12
  "\"chancms\"",
11
13
  "\"nodejs\""
12
14
  ],
package/publish.bat ADDED
@@ -0,0 +1,4 @@
1
+ npm config set proxy null
2
+ npm cache clean --force
3
+ npm config set registry http://registry.npmmirror.com
4
+ npm publish