chanjs 2.5.2 → 2.5.3
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/App.js +4 -2
- package/extend/art-template.js +3 -2
- package/middleware/template.js +2 -2
- package/package.json +1 -1
package/App.js
CHANGED
|
@@ -129,7 +129,9 @@ class Chan {
|
|
|
129
129
|
*/
|
|
130
130
|
async config() {
|
|
131
131
|
let config = await loadConfig();
|
|
132
|
+
console.log('[App.config] 开始加载配置,config keys:', Object.keys(config));
|
|
132
133
|
Chan.config = config;
|
|
134
|
+
console.log('[App.config] 配置加载完成,Chan.config.modules:', Chan.config.modules);
|
|
133
135
|
}
|
|
134
136
|
|
|
135
137
|
/**
|
|
@@ -209,7 +211,7 @@ class Chan {
|
|
|
209
211
|
const config = Chan.config;
|
|
210
212
|
const {
|
|
211
213
|
views = [],
|
|
212
|
-
|
|
214
|
+
NODE_ENV = "dev",
|
|
213
215
|
APP_NAME = "ChanCMS",
|
|
214
216
|
APP_VERSION = "1.0.0",
|
|
215
217
|
cookieKey,
|
|
@@ -226,7 +228,7 @@ class Chan {
|
|
|
226
228
|
setCookie(this.app, cookieKey);
|
|
227
229
|
setBody(this.app, BODY_LIMIT);
|
|
228
230
|
Cors(this.app, cors);
|
|
229
|
-
setTemplate(this.app, { views, NODE_ENV
|
|
231
|
+
setTemplate(this.app, { views, NODE_ENV });
|
|
230
232
|
setHeader(this.app, { APP_NAME, APP_VERSION });
|
|
231
233
|
}
|
|
232
234
|
|
package/extend/art-template.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import template from "art-template";
|
|
2
2
|
import dayjs from "dayjs";
|
|
3
3
|
|
|
4
|
-
template.defaults.native = false; // 禁用原生模板引擎 防止模板直接调用nodejs语法
|
|
5
|
-
template.defaults.debug = false; // 禁用调试模式
|
|
4
|
+
//template.defaults.native = false; // 禁用原生模板引擎 防止模板直接调用nodejs语法
|
|
5
|
+
//template.defaults.debug = false; // 禁用调试模式
|
|
6
|
+
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* 日期格式化过滤器
|
package/middleware/template.js
CHANGED
|
@@ -23,10 +23,10 @@ import { importjs } from "../global/import.js";
|
|
|
23
23
|
*/
|
|
24
24
|
export let setTemplate = (app, config) => {
|
|
25
25
|
const { views, NODE_ENV } = config;
|
|
26
|
-
const all = [...views
|
|
26
|
+
const all = [...views];
|
|
27
27
|
app.set("view options", {
|
|
28
28
|
debug: NODE_ENV === "dev",
|
|
29
|
-
cache:
|
|
29
|
+
cache: true,
|
|
30
30
|
minimize: true,
|
|
31
31
|
});
|
|
32
32
|
app.set("view engine", "html");
|