@_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.
Files changed (45) hide show
  1. package/cjs/app/controller/base.d.ts +1 -2
  2. package/cjs/app/controller/project.d.ts +1 -2
  3. package/cjs/app/controller/project.js +1 -1
  4. package/cjs/app/controller/view.d.ts +1 -2
  5. package/cjs/app/extend/db.d.ts +1 -1
  6. package/cjs/app/extend/logger.d.ts +1 -1
  7. package/cjs/app/extend/render-view.d.ts +1 -2
  8. package/cjs/app/extend/render-view.js +1 -1
  9. package/cjs/app/middleware/api-params-verify.d.ts +1 -2
  10. package/cjs/app/middleware/api-sign-verify.d.ts +1 -2
  11. package/cjs/app/middleware/error-handle.d.ts +2 -3
  12. package/cjs/app/middleware/error-handle.js +6 -6
  13. package/cjs/app/middleware/project-handler.d.ts +2 -2
  14. package/cjs/app/middleware/project-handler.js +3 -3
  15. package/cjs/app/middleware.d.ts +0 -2
  16. package/cjs/app/middleware.js +0 -2
  17. package/cjs/app/router/project.d.ts +1 -1
  18. package/cjs/app/router/view.d.ts +1 -1
  19. package/cjs/app/service/bese.d.ts +1 -1
  20. package/cjs/app/service/project.d.ts +1 -1
  21. package/cjs/app/service/project.js +1 -1
  22. package/cjs/bundler/utils.js +8 -0
  23. package/esm/app/controller/base.d.ts +1 -2
  24. package/esm/app/controller/project.d.ts +1 -2
  25. package/esm/app/controller/project.js +2 -2
  26. package/esm/app/controller/view.d.ts +1 -2
  27. package/esm/app/extend/db.d.ts +1 -1
  28. package/esm/app/extend/logger.d.ts +1 -1
  29. package/esm/app/extend/render-view.d.ts +1 -2
  30. package/esm/app/extend/render-view.js +1 -1
  31. package/esm/app/middleware/api-params-verify.d.ts +1 -2
  32. package/esm/app/middleware/api-sign-verify.d.ts +1 -2
  33. package/esm/app/middleware/error-handle.d.ts +2 -3
  34. package/esm/app/middleware/error-handle.js +6 -6
  35. package/esm/app/middleware/project-handler.d.ts +2 -2
  36. package/esm/app/middleware/project-handler.js +3 -3
  37. package/esm/app/middleware.d.ts +0 -2
  38. package/esm/app/middleware.js +0 -2
  39. package/esm/app/router/project.d.ts +1 -1
  40. package/esm/app/router/view.d.ts +1 -1
  41. package/esm/app/service/bese.d.ts +1 -1
  42. package/esm/app/service/project.d.ts +1 -1
  43. package/esm/app/service/project.js +1 -1
  44. package/esm/bundler/utils.js +8 -0
  45. package/package.json +1 -1
@@ -1,5 +1,4 @@
1
- import { KoaApp } from "../type";
2
- import { Ctx } from "../type";
1
+ import type { KoaApp, Ctx } from "../type";
3
2
  declare const _default: (app: KoaApp) => {
4
3
  new (): {
5
4
  readonly app: KoaApp;
@@ -1,5 +1,4 @@
1
- import { KoaApp } from '../type';
2
- import { Ctx } from '../type';
1
+ import type { KoaApp, Ctx } from "../type";
3
2
  export interface IProjectController {
4
3
  getModelList(ctx: Ctx): Promise<void>;
5
4
  getProjectList(ctx: Ctx): Promise<void>;
@@ -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);
@@ -1,5 +1,4 @@
1
- import { KoaApp } from "../type";
2
- import { Ctx } from "../type";
1
+ import type { KoaApp, Ctx } from "../type";
3
2
  declare const getViewController: (app: KoaApp) => {
4
3
  new (): {
5
4
  renderPage(ctx: Ctx): Promise<void>;
@@ -1,2 +1,2 @@
1
- import { KoaApp } from "../type";
1
+ import type { KoaApp } from "../type";
2
2
  export default function getDB(app: KoaApp): Promise<{}>;
@@ -1,4 +1,4 @@
1
- import { KoaApp } from "../type";
1
+ import type { KoaApp } from "../type";
2
2
  interface MConsole {
3
3
  log: (...args: any[]) => void;
4
4
  info: (...args: any[]) => void;
@@ -1,4 +1,3 @@
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;
@@ -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, "business"), "./public");
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
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;
@@ -1,5 +1,4 @@
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;
@@ -1,5 +1,4 @@
1
- import { KoaApp } from '../type';
2
- import { Ctx } from '../type';
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, } = err;
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('-- [excption] --', error);
12
- app.extends.logger?.error('-- [excption] info --', status, message, detail);
13
- if (message?.includes('template not found')) {
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
  }
@@ -1,4 +1,4 @@
1
- import { Ctx } from '../type';
2
- import type Koa from 'koa';
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;
@@ -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('/api/proj/') !== -1) {
7
- if (!key || ['undefined', 'null'].includes(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
  }
@@ -1,5 +1,3 @@
1
- import "../packages/core/index.js";
2
- import "./typings";
3
1
  import type { KoaApp } from "./typings";
4
2
  declare const _default: (app: KoaApp) => void;
5
3
  export default _default;
@@ -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";
@@ -1,4 +1,4 @@
1
- import { KoaApp } from '../type';
1
+ import type { KoaApp } from '../type';
2
2
  import type Router from 'koa-router';
3
3
  declare const _default: (app: KoaApp, router: Router) => void;
4
4
  export default _default;
@@ -1,4 +1,4 @@
1
- import { KoaApp } from "../type";
1
+ import type { KoaApp } from "../type";
2
2
  import type Router from "koa-router";
3
3
  declare const _default: (app: KoaApp, router: Router) => void;
4
4
  export default _default;
@@ -1,4 +1,4 @@
1
- import { KoaApp } from "../type";
1
+ import type { KoaApp } from "../type";
2
2
  import superagent from "superagent";
3
3
  declare const _default: (app: KoaApp) => {
4
4
  new (): {
@@ -1,4 +1,4 @@
1
- import { KoaApp } from "../type";
1
+ import type { KoaApp } from "../type";
2
2
  export interface ProjectItem {
3
3
  key: string;
4
4
  name: string;
@@ -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);
@@ -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,5 +1,4 @@
1
- import { KoaApp } from "../type";
2
- import { Ctx } from "../type";
1
+ import type { KoaApp, Ctx } from "../type";
3
2
  declare const _default: (app: KoaApp) => {
4
3
  new (): {
5
4
  readonly app: KoaApp;
@@ -1,5 +1,4 @@
1
- import { KoaApp } from '../type';
2
- import { Ctx } from '../type';
1
+ import type { KoaApp, Ctx } from "../type";
3
2
  export interface IProjectController {
4
3
  getModelList(ctx: Ctx): Promise<void>;
5
4
  getProjectList(ctx: Ctx): Promise<void>;
@@ -1,4 +1,4 @@
1
- import getBaseController from './base';
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);
@@ -1,5 +1,4 @@
1
- import { KoaApp } from "../type";
2
- import { Ctx } from "../type";
1
+ import type { KoaApp, Ctx } from "../type";
3
2
  declare const getViewController: (app: KoaApp) => {
4
3
  new (): {
5
4
  renderPage(ctx: Ctx): Promise<void>;
@@ -1,3 +1,3 @@
1
- import { KoaApp } from "../type";
1
+ import type { KoaApp } from "../type";
2
2
  export default function getDB(app: KoaApp): Promise<{}>;
3
3
  //# sourceMappingURL=db.d.ts.map
@@ -1,4 +1,4 @@
1
- import { KoaApp } from "../type";
1
+ import type { KoaApp } from "../type";
2
2
  interface MConsole {
3
3
  log: (...args: any[]) => void;
4
4
  info: (...args: any[]) => void;
@@ -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, "business"), "./public");
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 '../type';
2
- import { Ctx } from '../type';
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, } = err;
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('-- [excption] --', error);
10
- app.extends.logger?.error('-- [excption] info --', status, message, detail);
11
- if (message?.includes('template not found')) {
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 '../type';
2
- import type Koa from 'koa';
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('/api/proj/') !== -1) {
5
- if (!key || ['undefined', 'null'].includes(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
  }
@@ -1,5 +1,3 @@
1
- import "../packages/core/index.js";
2
- import "./typings";
3
1
  import type { KoaApp } from "./typings";
4
2
  declare const _default: (app: KoaApp) => void;
5
3
  export default _default;
@@ -1,5 +1,3 @@
1
- import "../packages/core/index.js";
2
- import "./typings";
3
1
  import { resolve } from "path";
4
2
  import compress from "koa-compress";
5
3
  // import koaNunjucks from "koa-nunjucks-2";
@@ -1,4 +1,4 @@
1
- import { KoaApp } from '../type';
1
+ import type { KoaApp } from '../type';
2
2
  import type Router from 'koa-router';
3
3
  declare const _default: (app: KoaApp, router: Router) => void;
4
4
  export default _default;
@@ -1,4 +1,4 @@
1
- import { KoaApp } from "../type";
1
+ import type { KoaApp } from "../type";
2
2
  import type Router from "koa-router";
3
3
  declare const _default: (app: KoaApp, router: Router) => void;
4
4
  export default _default;
@@ -1,4 +1,4 @@
1
- import { KoaApp } from "../type";
1
+ import type { KoaApp } from "../type";
2
2
  import superagent from "superagent";
3
3
  declare const _default: (app: KoaApp) => {
4
4
  new (): {
@@ -1,4 +1,4 @@
1
- import { KoaApp } from "../type";
1
+ import type { KoaApp } from "../type";
2
2
  export interface ProjectItem {
3
3
  key: string;
4
4
  name: string;
@@ -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 = (loaderModel)(app);
6
+ const modelData = loaderModel(app);
7
7
  return class ProjectService extends BaseService {
8
8
  async getModelList() {
9
9
  return modelData;
@@ -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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@_tc/template-core",
3
- "version": "0.0.1-bate.23",
3
+ "version": "0.0.1-bate.25",
4
4
  "description": "A TypeScript Koa framework template - Monorepo root",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",