@_tc/template-core 0.0.1-bate.23 → 0.0.1-bate.25
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/cjs/app/controller/base.d.ts +1 -2
- package/cjs/app/controller/project.d.ts +1 -2
- package/cjs/app/controller/project.js +1 -1
- package/cjs/app/controller/view.d.ts +1 -2
- package/cjs/app/extend/db.d.ts +1 -1
- package/cjs/app/extend/logger.d.ts +1 -1
- package/cjs/app/extend/render-view.d.ts +1 -2
- package/cjs/app/extend/render-view.js +1 -1
- package/cjs/app/middleware/api-params-verify.d.ts +1 -2
- package/cjs/app/middleware/api-sign-verify.d.ts +1 -2
- package/cjs/app/middleware/error-handle.d.ts +2 -3
- package/cjs/app/middleware/error-handle.js +6 -6
- package/cjs/app/middleware/project-handler.d.ts +2 -2
- package/cjs/app/middleware/project-handler.js +3 -3
- package/cjs/app/middleware.d.ts +0 -2
- package/cjs/app/middleware.js +0 -2
- package/cjs/app/router/project.d.ts +1 -1
- package/cjs/app/router/view.d.ts +1 -1
- package/cjs/app/service/bese.d.ts +1 -1
- package/cjs/app/service/project.d.ts +1 -1
- package/cjs/app/service/project.js +1 -1
- package/cjs/bundler/utils.js +8 -0
- package/esm/app/controller/base.d.ts +1 -2
- package/esm/app/controller/project.d.ts +1 -2
- package/esm/app/controller/project.js +2 -2
- package/esm/app/controller/view.d.ts +1 -2
- package/esm/app/extend/db.d.ts +1 -1
- package/esm/app/extend/logger.d.ts +1 -1
- package/esm/app/extend/render-view.d.ts +1 -2
- package/esm/app/extend/render-view.js +1 -1
- package/esm/app/middleware/api-params-verify.d.ts +1 -2
- package/esm/app/middleware/api-sign-verify.d.ts +1 -2
- package/esm/app/middleware/error-handle.d.ts +2 -3
- package/esm/app/middleware/error-handle.js +6 -6
- package/esm/app/middleware/project-handler.d.ts +2 -2
- package/esm/app/middleware/project-handler.js +3 -3
- package/esm/app/middleware.d.ts +0 -2
- package/esm/app/middleware.js +0 -2
- package/esm/app/router/project.d.ts +1 -1
- package/esm/app/router/view.d.ts +1 -1
- package/esm/app/service/bese.d.ts +1 -1
- package/esm/app/service/project.d.ts +1 -1
- package/esm/app/service/project.js +1 -1
- package/esm/bundler/utils.js +8 -0
- package/package.json +1 -1
|
@@ -39,7 +39,7 @@ const getProjectController = (app) => {
|
|
|
39
39
|
const { key: projectKey } = ctx.params;
|
|
40
40
|
const projectConfig = this.service.project.getProject(projectKey);
|
|
41
41
|
if (!projectConfig) {
|
|
42
|
-
this.fail(ctx, 10001,
|
|
42
|
+
this.fail(ctx, 10001, "获取项目异常");
|
|
43
43
|
return;
|
|
44
44
|
}
|
|
45
45
|
this.success(ctx, projectConfig);
|
package/cjs/app/extend/db.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { KoaApp } from "../type";
|
|
1
|
+
import type { KoaApp } from "../type";
|
|
2
2
|
export default function getDB(app: KoaApp): Promise<{}>;
|
|
@@ -7,7 +7,7 @@ const paths_1 = require("../../packages/core/paths");
|
|
|
7
7
|
const nunjucks_1 = __importDefault(require("nunjucks"));
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
exports.default = (app) => {
|
|
10
|
-
const viewsPath = path_1.default.join((0, paths_1.getAppPath)(app, "
|
|
10
|
+
const viewsPath = path_1.default.join((0, paths_1.getAppPath)(app, "frame"), "./public");
|
|
11
11
|
const env = nunjucks_1.default.configure(viewsPath, {
|
|
12
12
|
autoescape: true,
|
|
13
13
|
throwOnUndefined: false,
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { KoaApp } from
|
|
2
|
-
import
|
|
3
|
-
import type Koa from 'koa';
|
|
1
|
+
import type { Ctx, KoaApp } from "../type";
|
|
2
|
+
import type Koa from "koa";
|
|
4
3
|
declare const _default: (app: KoaApp) => (ctx: Ctx, next: Koa.Next) => Promise<void>;
|
|
5
4
|
export default _default;
|
|
@@ -6,13 +6,13 @@ exports.default = (app) => async (ctx, next) => {
|
|
|
6
6
|
}
|
|
7
7
|
catch (error) {
|
|
8
8
|
const err = error;
|
|
9
|
-
const { status = 200, message, detail, code = 50000, returnError
|
|
9
|
+
const { status = 200, message, detail, code = 50000, returnError } = err;
|
|
10
10
|
app.extends.logger?.info(`error info -> ${JSON.stringify(error)}`);
|
|
11
|
-
app.extends.logger?.error(
|
|
12
|
-
app.extends.logger?.error(
|
|
13
|
-
if (message?.includes(
|
|
11
|
+
app.extends.logger?.error("-- [excption] --", error);
|
|
12
|
+
app.extends.logger?.error("-- [excption] info --", status, message, detail);
|
|
13
|
+
if (message?.includes("template not found")) {
|
|
14
14
|
ctx.status = 302;
|
|
15
|
-
ctx.redirect(app.options?.homePage ??
|
|
15
|
+
ctx.redirect(app.options?.homePage ?? "/");
|
|
16
16
|
return;
|
|
17
17
|
}
|
|
18
18
|
if (returnError) {
|
|
@@ -26,7 +26,7 @@ exports.default = (app) => async (ctx, next) => {
|
|
|
26
26
|
ctx.status = 200;
|
|
27
27
|
ctx.body = {
|
|
28
28
|
code: 50000,
|
|
29
|
-
message:
|
|
29
|
+
message: "网络错误",
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
32
|
}
|
|
@@ -3,13 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.default = () => async (ctx, next) => {
|
|
4
4
|
const key = ctx.headers.proj_key;
|
|
5
5
|
const { path } = ctx;
|
|
6
|
-
if (path.indexOf(
|
|
7
|
-
if (!key || [
|
|
6
|
+
if (path.indexOf("/api/proj/") !== -1) {
|
|
7
|
+
if (!key || ["undefined", "null"].includes(key)) {
|
|
8
8
|
ctx.status = 200;
|
|
9
9
|
ctx.body = {
|
|
10
10
|
code: 110,
|
|
11
11
|
data: null,
|
|
12
|
-
message:
|
|
12
|
+
message: "请求不合法",
|
|
13
13
|
};
|
|
14
14
|
return;
|
|
15
15
|
}
|
package/cjs/app/middleware.d.ts
CHANGED
package/cjs/app/middleware.js
CHANGED
|
@@ -3,8 +3,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
require("../packages/core/index.js");
|
|
7
|
-
require("./typings");
|
|
8
6
|
const path_1 = require("path");
|
|
9
7
|
const koa_compress_1 = __importDefault(require("koa-compress"));
|
|
10
8
|
// import koaNunjucks from "koa-nunjucks-2";
|
package/cjs/app/router/view.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ const bese_1 = __importDefault(require("./bese"));
|
|
|
8
8
|
const getProjectService = (app) => {
|
|
9
9
|
const BaseService = (0, bese_1.default)(app);
|
|
10
10
|
// const modelData = require('../../model')(app) as ModelItem[];
|
|
11
|
-
const modelData = (core_1.loaderModel)(app);
|
|
11
|
+
const modelData = (0, core_1.loaderModel)(app);
|
|
12
12
|
return class ProjectService extends BaseService {
|
|
13
13
|
constructor() {
|
|
14
14
|
super(...arguments);
|
package/cjs/bundler/utils.js
CHANGED
|
@@ -185,6 +185,14 @@ function flattenHtmlPlugin(suffix = ".html") {
|
|
|
185
185
|
delEmptyDir(fullPath);
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
|
+
/**
|
|
189
|
+
* ------------------
|
|
190
|
+
*/
|
|
191
|
+
// 输出最终的 文件路径
|
|
192
|
+
const endFiles = glob.sync("**/*" + suffix, { cwd: feDir });
|
|
193
|
+
for (const f of endFiles) {
|
|
194
|
+
console.log("final file path -----> ", f);
|
|
195
|
+
}
|
|
188
196
|
},
|
|
189
197
|
};
|
|
190
198
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import getBaseController from
|
|
1
|
+
import getBaseController from "./base";
|
|
2
2
|
const getProjectController = (app) => {
|
|
3
3
|
const BaseController = getBaseController(app);
|
|
4
4
|
return class ProjectController extends BaseController {
|
|
@@ -32,7 +32,7 @@ const getProjectController = (app) => {
|
|
|
32
32
|
const { key: projectKey } = ctx.params;
|
|
33
33
|
const projectConfig = this.service.project.getProject(projectKey);
|
|
34
34
|
if (!projectConfig) {
|
|
35
|
-
this.fail(ctx, 10001,
|
|
35
|
+
this.fail(ctx, 10001, "获取项目异常");
|
|
36
36
|
return;
|
|
37
37
|
}
|
|
38
38
|
this.success(ctx, projectConfig);
|
package/esm/app/extend/db.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { KoaApp } from "../type";
|
|
2
|
-
import type { Ctx } from "../type";
|
|
1
|
+
import type { Ctx, KoaApp } from "../type";
|
|
3
2
|
declare const _default: (app: KoaApp) => (view: string, ctx: Ctx, context?: Record<string, unknown>) => void;
|
|
4
3
|
export default _default;
|
|
5
4
|
//# sourceMappingURL=render-view.d.ts.map
|
|
@@ -2,7 +2,7 @@ import { getAppPath } from "../../packages/core/paths";
|
|
|
2
2
|
import nunjucks from "nunjucks";
|
|
3
3
|
import path from "path";
|
|
4
4
|
export default (app) => {
|
|
5
|
-
const viewsPath = path.join(getAppPath(app, "
|
|
5
|
+
const viewsPath = path.join(getAppPath(app, "frame"), "./public");
|
|
6
6
|
const env = nunjucks.configure(viewsPath, {
|
|
7
7
|
autoescape: true,
|
|
8
8
|
throwOnUndefined: false,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type Koa from "koa";
|
|
2
|
-
import { KoaApp } from "../type";
|
|
3
|
-
import { Ctx } from "../type";
|
|
2
|
+
import type { KoaApp, Ctx } from "../type";
|
|
4
3
|
declare const _default: (app: KoaApp) => (ctx: Ctx, next: Koa.Next) => Promise<any>;
|
|
5
4
|
export default _default;
|
|
6
5
|
//# sourceMappingURL=api-params-verify.d.ts.map
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type Koa from "koa";
|
|
2
|
-
import { KoaApp } from "../type";
|
|
3
|
-
import { Ctx } from "../type";
|
|
2
|
+
import type { Ctx, KoaApp } from "../type";
|
|
4
3
|
declare const _default: (app: KoaApp) => (ctx: Ctx, next: Koa.Next) => Promise<void>;
|
|
5
4
|
export default _default;
|
|
6
5
|
//# sourceMappingURL=api-sign-verify.d.ts.map
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { KoaApp } from
|
|
2
|
-
import
|
|
3
|
-
import type Koa from 'koa';
|
|
1
|
+
import type { Ctx, KoaApp } from "../type";
|
|
2
|
+
import type Koa from "koa";
|
|
4
3
|
declare const _default: (app: KoaApp) => (ctx: Ctx, next: Koa.Next) => Promise<void>;
|
|
5
4
|
export default _default;
|
|
6
5
|
//# sourceMappingURL=error-handle.d.ts.map
|
|
@@ -4,13 +4,13 @@ export default (app) => async (ctx, next) => {
|
|
|
4
4
|
}
|
|
5
5
|
catch (error) {
|
|
6
6
|
const err = error;
|
|
7
|
-
const { status = 200, message, detail, code = 50000, returnError
|
|
7
|
+
const { status = 200, message, detail, code = 50000, returnError } = err;
|
|
8
8
|
app.extends.logger?.info(`error info -> ${JSON.stringify(error)}`);
|
|
9
|
-
app.extends.logger?.error(
|
|
10
|
-
app.extends.logger?.error(
|
|
11
|
-
if (message?.includes(
|
|
9
|
+
app.extends.logger?.error("-- [excption] --", error);
|
|
10
|
+
app.extends.logger?.error("-- [excption] info --", status, message, detail);
|
|
11
|
+
if (message?.includes("template not found")) {
|
|
12
12
|
ctx.status = 302;
|
|
13
|
-
ctx.redirect(app.options?.homePage ??
|
|
13
|
+
ctx.redirect(app.options?.homePage ?? "/");
|
|
14
14
|
return;
|
|
15
15
|
}
|
|
16
16
|
if (returnError) {
|
|
@@ -24,7 +24,7 @@ export default (app) => async (ctx, next) => {
|
|
|
24
24
|
ctx.status = 200;
|
|
25
25
|
ctx.body = {
|
|
26
26
|
code: 50000,
|
|
27
|
-
message:
|
|
27
|
+
message: "网络错误",
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
30
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Ctx } from
|
|
2
|
-
import type Koa from
|
|
1
|
+
import type { Ctx } from "../type";
|
|
2
|
+
import type Koa from "koa";
|
|
3
3
|
declare const _default: () => (ctx: Ctx, next: Koa.Next) => Promise<void>;
|
|
4
4
|
export default _default;
|
|
5
5
|
//# sourceMappingURL=project-handler.d.ts.map
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
export default () => async (ctx, next) => {
|
|
2
2
|
const key = ctx.headers.proj_key;
|
|
3
3
|
const { path } = ctx;
|
|
4
|
-
if (path.indexOf(
|
|
5
|
-
if (!key || [
|
|
4
|
+
if (path.indexOf("/api/proj/") !== -1) {
|
|
5
|
+
if (!key || ["undefined", "null"].includes(key)) {
|
|
6
6
|
ctx.status = 200;
|
|
7
7
|
ctx.body = {
|
|
8
8
|
code: 110,
|
|
9
9
|
data: null,
|
|
10
|
-
message:
|
|
10
|
+
message: "请求不合法",
|
|
11
11
|
};
|
|
12
12
|
return;
|
|
13
13
|
}
|
package/esm/app/middleware.d.ts
CHANGED
package/esm/app/middleware.js
CHANGED
package/esm/app/router/view.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import getBaseService from "./bese";
|
|
|
3
3
|
const getProjectService = (app) => {
|
|
4
4
|
const BaseService = getBaseService(app);
|
|
5
5
|
// const modelData = require('../../model')(app) as ModelItem[];
|
|
6
|
-
const modelData =
|
|
6
|
+
const modelData = loaderModel(app);
|
|
7
7
|
return class ProjectService extends BaseService {
|
|
8
8
|
async getModelList() {
|
|
9
9
|
return modelData;
|
package/esm/bundler/utils.js
CHANGED
|
@@ -143,6 +143,14 @@ function flattenHtmlPlugin(suffix = ".html") {
|
|
|
143
143
|
delEmptyDir(fullPath);
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
|
+
/**
|
|
147
|
+
* ------------------
|
|
148
|
+
*/
|
|
149
|
+
// 输出最终的 文件路径
|
|
150
|
+
const endFiles = glob.sync("**/*" + suffix, { cwd: feDir });
|
|
151
|
+
for (const f of endFiles) {
|
|
152
|
+
console.log("final file path -----> ", f);
|
|
153
|
+
}
|
|
146
154
|
},
|
|
147
155
|
};
|
|
148
156
|
}
|