very-express 0.2.3 → 0.2.5

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/dist/cli.js CHANGED
@@ -28,19 +28,21 @@ config.jsonSchemaDir = args.j || args.jsonSchemaDir || config.jsonSchemaDir || "
28
28
  config.rootDir = args.o || args.rootDir || config.rootDir || ".";
29
29
  config.srcDir = config.srcDir || config.rootDir + "/src";
30
30
  config.openapiDir = config.openapiDir || config.rootDir + "./openapi";
31
- config.useOauth = config.useOauth || {
32
- google: false,
33
- microsoft: false,
34
- apple: false,
35
- github: false
36
- };
37
- logger_1.default.writing("vex.config.json");
31
+ config.enableSwagger = config.enableSwagger || true,
32
+ config.useUserSchema = config.useUserSchema || true,
33
+ config.useOauth = config.useOauth || {
34
+ google: false,
35
+ microsoft: false,
36
+ apple: false,
37
+ github: false
38
+ };
39
+ logger_1.default.process("vex.config.json");
38
40
  fs_1.default.writeFileSync("vex.config.json", JSON.stringify(config, null, 4));
39
41
  if (String(args._[0]).toLowerCase() === "h" || args["h"]) {
40
42
  console.log(`Very Express CLI Usage :
41
43
  vex [flag]
42
- -h | help : Help
43
- -i | init : Create generator config etc.
44
+ -h : Help
45
+ -i : Create generator config etc.
44
46
  to generate app :
45
47
  vex [jsonSchemaDir] [rootDir]
46
48
  -j : jsonSchemaDir (configured: ${config.jsonSchemaDir})
@@ -66,6 +68,7 @@ else {
66
68
  logger_1.default.error("git commit \"before vex-gen\" failed", err);
67
69
  }
68
70
  }
71
+ console.log(config);
69
72
  (0, index_1.generate)(config);
70
73
  console.log("\x1b[36m%s\x1b[0m", "\nnext step:\n", `cd ${config.rootDir}\n`, "npm install\n", "npm run dev");
71
74
  }
@@ -1,7 +1,6 @@
1
1
  import * as types from "../types/types";
2
2
  import { Schema } from "express-validator";
3
3
  export default function controllerTemplate(templateOptions: {
4
- headerComment?: string;
5
4
  template?: string;
6
5
  endpoint: string;
7
6
  modelPath: string;
@@ -5,10 +5,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const util_1 = __importDefault(require("util"));
7
7
  function controllerTemplate(templateOptions) {
8
- var _a;
9
- if (!templateOptions.headerComment) {
10
- templateOptions.headerComment = ((_a = templateOptions.compilerOptions) === null || _a === void 0 ? void 0 : _a.headerComment) || "// generated files by very-express";
11
- }
12
8
  let template = templateOptions.template || `{{headerComment}}
13
9
  import { Router, Request, Response } from 'express';
14
10
  import { checkSchema, validationResult } from 'express-validator';
@@ -162,41 +158,41 @@ class {{interfaceName}}Controller {
162
158
  export default new {{interfaceName}}Controller().router;
163
159
  `;
164
160
  const indent3 = " ";
165
- template = template.replace(/{{headerComment}}/g, templateOptions.headerComment);
161
+ template = template.replace(/{{headerComment}}/g, templateOptions.compilerOptions.headerComment || "// generated files by very-express");
166
162
  template = template.replace(/{{interfaceName}}/g, templateOptions.interfaceName);
167
163
  template = template.replace(/{{modelPath}}/g, templateOptions.modelPath);
168
- template = template.replace(/{{getListRoute}}/g, !templateOptions.validators[templateOptions.endpoint].get ?
169
- "// getListRoute disabled" : `
164
+ template = template.replace(/{{getListRoute}}/g, !templateOptions.validators[templateOptions.endpoint].get ? `
165
+ // getListRoute disabled` : `
170
166
  this.router.get('/',
171
167
  checkSchema(${util_1.default.inspect(templateOptions.validators[templateOptions.endpoint].get, { depth: null }).replace(/^/gm, indent3)}),
172
168
  this.getList${templateOptions.interfaceName}.bind(this)
173
169
  );`);
174
- template = template.replace(/{{getRoute}}/g, !templateOptions.validators[templateOptions.endpoint + "/{id}"].get ?
175
- "// getRoute disabled" : `
170
+ template = template.replace(/{{getRoute}}/g, !templateOptions.validators[templateOptions.endpoint + "/{id}"].get ? `
171
+ // getRoute disabled` : `
176
172
  this.router.get('/:id',
177
173
  checkSchema(${util_1.default.inspect(templateOptions.validators[templateOptions.endpoint + "/{id}"].get, { depth: null }).replace(/^/gm, indent3)}),
178
174
  this.get${templateOptions.interfaceName}.bind(this)
179
175
  );`);
180
- template = template.replace(/{{postRoute}}/g, !templateOptions.validators[templateOptions.endpoint].post ?
181
- "// postRoute disabled" : `
176
+ template = template.replace(/{{postRoute}}/g, !templateOptions.validators[templateOptions.endpoint].post ? `
177
+ // postRoute disabled` : `
182
178
  this.router.post('/',
183
179
  checkSchema(${util_1.default.inspect(templateOptions.validators[templateOptions.endpoint].post, { depth: null }).replace(/^/gm, indent3)}),
184
180
  this.create${templateOptions.interfaceName}.bind(this)
185
181
  );`);
186
- template = template.replace(/{{putRoute}}/g, !templateOptions.validators[templateOptions.endpoint + "/{id}"].put ?
187
- "// putRoute disabled" : `
182
+ template = template.replace(/{{putRoute}}/g, !templateOptions.validators[templateOptions.endpoint + "/{id}"].put ? `
183
+ // putRoute disabled` : `
188
184
  this.router.put('/:id',
189
185
  checkSchema(${util_1.default.inspect(templateOptions.validators[templateOptions.endpoint + "/{id}"].put, { depth: null }).replace(/^/gm, indent3)}),
190
186
  this.replace${templateOptions.interfaceName}.bind(this)
191
187
  );`);
192
- template = template.replace(/{{patchRoute}}/g, !templateOptions.validators[templateOptions.endpoint + "/{id}"].patch ?
193
- "// patchRoute disabled" : `
188
+ template = template.replace(/{{patchRoute}}/g, !templateOptions.validators[templateOptions.endpoint + "/{id}"].patch ? `
189
+ // patchRoute disabled` : `
194
190
  this.router.patch('/:id',
195
191
  checkSchema(${util_1.default.inspect(templateOptions.validators[templateOptions.endpoint + "/{id}"].patch, { depth: null }).replace(/^/gm, indent3)}),
196
192
  this.update${templateOptions.interfaceName}.bind(this)
197
193
  );`);
198
- template = template.replace(/{{deleteRoute}}/g, !templateOptions.validators[templateOptions.endpoint + "/{id}"].delete ?
199
- "// deleteRoute disabled" : `
194
+ template = template.replace(/{{deleteRoute}}/g, !templateOptions.validators[templateOptions.endpoint + "/{id}"].delete ? `
195
+ // deleteRoute disabled` : `
200
196
  this.router.delete('/:id',
201
197
  checkSchema(${util_1.default.inspect(templateOptions.validators[templateOptions.endpoint + "/{id}"].delete, { depth: null }).replace(/^/gm, indent3)}),
202
198
  this.delete${templateOptions.interfaceName}.bind(this)
@@ -1,7 +1,32 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  Object.defineProperty(exports, "__esModule", { value: true });
3
26
  exports.compile = void 0;
27
+ const utils = __importStar(require("../../utils/common"));
4
28
  function compile(compilerOptions) {
29
+ const yamlPath = utils.relativePath(compilerOptions.srcDir + "/routes", compilerOptions.openapiDir + "/openapi.gen.yaml");
5
30
  return `${compilerOptions.headerComment}
6
31
  import { Router } from "express";
7
32
  import swaggerUi, { JsonObject } from "swagger-ui-express";
@@ -14,7 +39,7 @@ export default class SwaggerRouter{
14
39
  constructor() {}
15
40
 
16
41
  public initRoutes() {
17
- this.router.use("/api", swaggerUi.serve, swaggerUi.setup(loadYaml("${compilerOptions.openapiDir}") as JsonObject));
42
+ this.router.use("/api", swaggerUi.serve, swaggerUi.setup(loadYaml(__dirname+"/${yamlPath}") as JsonObject));
18
43
  }
19
44
  }`;
20
45
  }
@@ -1,8 +1,7 @@
1
1
  import * as types from "../types/types";
2
- export default function routesTemplate(templateOptions: {
2
+ export default function routesTemplate(options: {
3
3
  template?: string;
4
4
  openapiFile?: string;
5
- enableOpenApi?: boolean;
6
5
  routes: {
7
6
  route: string;
8
7
  interfaceName: string;
@@ -1,17 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- function routesTemplate(templateOptions) {
4
- var _a;
5
- if (!templateOptions.compilerOptions.headerComment) {
6
- templateOptions.compilerOptions.headerComment = templateOptions.compilerOptions.headerComment || "// generated files by very-express";
7
- }
8
- const enableOpenApi = templateOptions.enableOpenApi || true;
9
- if (enableOpenApi && !templateOptions.compilerOptions.openapiDir) {
10
- console.log("\x1b[31m%s\x1b[0m", "[Error]", "OpenApi : routers.generator > compile() : Args \"openapiPath\" is required while enableOpenApi is true.");
11
- throw new Error("OpenApi : routers.generator > compile() : Args \"openapiPath\" is required while enableOpenApi is true.");
12
- }
13
- const headerComment = ((_a = templateOptions.compilerOptions) === null || _a === void 0 ? void 0 : _a.headerComment) || "// generated files by very-express";
14
- let template = templateOptions.template || `{{headerComment}}
3
+ function routesTemplate(options) {
4
+ let template = options.template || `{{headerComment}}
15
5
  import { Router } from 'express';
16
6
 
17
7
  {{importRoutes}}
@@ -31,11 +21,11 @@ export default class ApiRouter{
31
21
  }`;
32
22
  let importRoutes = "";
33
23
  let useRoutes = "";
34
- templateOptions === null || templateOptions === void 0 ? void 0 : templateOptions.routes.forEach((obj) => {
24
+ options.routes.forEach((obj) => {
35
25
  importRoutes += `import ${obj.interfaceName}Controller from '${obj.controllerPath}';\n`;
36
26
  useRoutes += `this.router.use('${obj.route}', ${obj.interfaceName}Controller);\n`;
37
27
  });
38
- template = template.replace(/{{headerComment}}/g, headerComment);
28
+ template = template.replace(/{{headerComment}}/g, options.compilerOptions.headerComment || "// generated files by very-express");
39
29
  template = template.replace(/{{importRoutes}}/g, importRoutes);
40
30
  template = template.replace(/{{useRoutes}}/g, useRoutes);
41
31
  return template;
@@ -34,9 +34,7 @@ const UseOAuthRouter = "app.use(OAuthRoute.router);";
34
34
  const UseSwaggerRouter = "app.use(SwaggerRoute.router);";
35
35
  const UseOAuthGoogleRouter = "app.use(OAuthGoogle.router);";
36
36
  function serverTemplate(options) {
37
- var _a;
38
- const headerComment = ((_a = options.compilerOptions) === null || _a === void 0 ? void 0 : _a.headerComment) || "// generated files by very-express";
39
- let template = options.template || `{{headerComment}}
37
+ let template = options.template || `${options.compilerOptions.headerComment || "// generated files by very-express"}
40
38
 
41
39
  import express from 'express';
42
40
  import dotenv from 'dotenv';
@@ -119,7 +117,7 @@ main();
119
117
  AppRoute.push(UseOAuthGoogleRouter);
120
118
  }
121
119
  }
122
- template = template.replace(/{{headerComment}}/g, headerComment);
120
+ template = template.replace(/{{headerComment}}/g, options.compilerOptions.headerComment || "// generated files by very-express");
123
121
  template = template.replace(/{{Import}}/g, Import.join("\n"));
124
122
  template = template.replace(/{{Config}}/g, Config.join("\n"));
125
123
  template = template.replace(/{{AppUse}}/g, AppUse.join("\n "));
package/dist/index.js CHANGED
@@ -37,6 +37,7 @@ const routeGen = __importStar(require("./generators/routes.generator"));
37
37
  const serverGen = __importStar(require("./generators/server.generator"));
38
38
  const jsonschemaFormat_1 = require("./preprocess/jsonschemaFormat");
39
39
  function generate(options) {
40
+ const openapiFile = "/openapi.gen.yaml";
40
41
  const dir = {
41
42
  routeDir: `${options.srcDir}/routes`,
42
43
  middlewareDir: `${options.srcDir}/middlewares`,
@@ -47,7 +48,10 @@ function generate(options) {
47
48
  pluginDir: `${options.srcDir}/plugins`,
48
49
  utilsDir: `${options.srcDir}/utils`,
49
50
  };
50
- const openapiFile = "/openapi.gen.yaml";
51
+ const routeData = [];
52
+ if (!options.headerComment) {
53
+ options.headerComment = common_1.default.getGenaratorHeaderComment();
54
+ }
51
55
  if (!fs_1.default.existsSync(options.rootDir)) {
52
56
  fs_1.default.mkdirSync(options.rootDir);
53
57
  }
@@ -62,11 +66,10 @@ function generate(options) {
62
66
  fs_1.default.mkdirSync(path);
63
67
  }
64
68
  });
69
+ common_1.default.copyDir(`${__dirname}/templates/utils`, dir.utilsDir, options, true);
70
+ common_1.default.copyDir(`${__dirname}/templates/services`, dir.serviceDir, options, true);
71
+ common_1.default.copyDir(`${__dirname}/templates/plugins`, dir.pluginDir, options, true);
65
72
  openapiGen.compile(openapiFile, options);
66
- common_1.default.copyDir(`${__dirname}/templates/utils`, dir.utilsDir, true);
67
- common_1.default.copyDir(`${__dirname}/templates/services`, dir.serviceDir, true);
68
- common_1.default.copyDir(`${__dirname}/templates/plugins`, dir.pluginDir, true);
69
- const routeData = [];
70
73
  const files = fs_1.default.readdirSync(options.jsonSchemaDir);
71
74
  files.forEach((schemaFileName) => {
72
75
  const schemaPath = `${options.jsonSchemaDir}/${schemaFileName}`;
@@ -90,7 +93,7 @@ function generate(options) {
90
93
  }
91
94
  });
92
95
  openapiGen.compile(openapiFile, options || common_1.default.defaultCompilerOptions);
93
- common_1.default.copyDir(`${options.openapiDir}`, options.rootDir + "/openapi", true);
96
+ common_1.default.copyDir(`${options.openapiDir}`, options.rootDir + "/openapi", options, true);
94
97
  controllerGen.compile({
95
98
  openapiFile: openapiFile,
96
99
  controllerOutDir: dir.controllerDir,
@@ -1,3 +1,5 @@
1
+ // {{headerComment}}
2
+
1
3
  import { Router } from "express";
2
4
  import passport, { PassportStatic, Profile } from "passport";
3
5
  import { AuthenticateOptionsGoogle, Strategy as GoogleStrategy, StrategyOptions, VerifyCallback } from "passport-google-oauth20";
@@ -1,4 +1,5 @@
1
- // import log from '../utils/logger.gen';
1
+ // {{headerComment}}
2
+
2
3
  import { Profile } from "passport";
3
4
  import { UserModel } from "../models/UserModel.gen";
4
5
 
@@ -1,3 +1,5 @@
1
+ // {{headerComment}}
2
+
1
3
  import mongoose from "mongoose";
2
4
  import log from "../utils/logger.gen";
3
5
 
@@ -1,3 +1,5 @@
1
+ // {{headerComment}}
2
+
1
3
  import jsYaml from "js-yaml";
2
4
  import fs from "fs";
3
5
 
@@ -1,3 +1,5 @@
1
+ // {{headerComment}}
2
+
1
3
  export function ok(msg: any, ...optionalParams: any[]): void {
2
4
  console.log("\x1b[32m%s\x1b[0m", "[OK]", msg, optionalParams.length > 0 ? optionalParams : "");
3
5
  }
@@ -1,8 +1,6 @@
1
1
  export interface compilerOptions {
2
2
  commitBeforeGenerate: boolean;
3
- headerComment?: string;
4
- modelsTemplate?: string;
5
- controllersTemplate?: string;
3
+ headerComment: string;
6
4
  jsonSchemaDir: string;
7
5
  openapiDir: string;
8
6
  rootDir: string;
@@ -1,15 +1,15 @@
1
1
  import * as types from "../types/types";
2
+ export declare function getGenaratorHeaderComment(): string;
3
+ export declare function getSimpleHeaderComment(): string;
2
4
  export declare const relativePath: (fromPath: string, toPath: string) => string;
3
5
  export declare function loadJsonSchema(jsonSchemaPath: string): types.jsonSchema | never;
4
- export declare function getGenaratorHeaderComment(comment?: string): string;
5
- export declare function getSimpleHeaderComment(): string;
6
6
  export declare function cleanXcustomValue(schemaObj: {
7
7
  [key: string]: any;
8
8
  }, additionalKeyArr?: string[] | types.additionalKeyObj): {
9
9
  [key: string]: any;
10
10
  };
11
11
  export declare function httpMethod(jsonSchemaMethod: string, documentName: string): types.httpMethod;
12
- export declare function copyDir(source: string, destination: string, overwrite?: boolean): void;
12
+ export declare function copyDir(source: string, destination: string, compilerOptions: types.compilerOptions, overwrite?: boolean): void;
13
13
  export declare function isUseOAuth(compilerOptions: types.compilerOptions): string[];
14
14
  export declare const defaultCompilerOptions: types.compilerOptions;
15
15
  declare const _default: {
@@ -26,7 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
26
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.defaultCompilerOptions = exports.isUseOAuth = exports.copyDir = exports.httpMethod = exports.cleanXcustomValue = exports.getSimpleHeaderComment = exports.getGenaratorHeaderComment = exports.loadJsonSchema = exports.relativePath = void 0;
29
+ exports.defaultCompilerOptions = exports.isUseOAuth = exports.copyDir = exports.httpMethod = exports.cleanXcustomValue = exports.loadJsonSchema = exports.relativePath = exports.getSimpleHeaderComment = exports.getGenaratorHeaderComment = void 0;
30
30
  const fs_1 = __importDefault(require("fs"));
31
31
  const path_1 = __importDefault(require("path"));
32
32
  const child_process_1 = __importDefault(require("child_process"));
@@ -38,13 +38,31 @@ function getPackageInfo() {
38
38
  globalPackages = JSON.parse(child_process_1.default.execSync("npm -g list --json").toString());
39
39
  }
40
40
  catch (error) {
41
- logger_1.default.error("Failed to execute command: npm -g list --json", error);
41
+ logger_1.default.error("Failed to read version number, on execute command: npm -g list --json", error);
42
42
  }
43
43
  return {
44
44
  version: globalPackages.dependencies["very-express"].version || "[unknown version]",
45
45
  author: globalPackages.author || "justin26l",
46
46
  };
47
47
  }
48
+ function getGenaratorHeaderComment() {
49
+ const packageInfo = getPackageInfo();
50
+ return `/* eslint-disable */
51
+ /**
52
+ * Generated by veryExpress@${packageInfo.version}
53
+ * https://www.npmjs.com/package/very-express
54
+ * author: ${packageInfo.author}
55
+ *
56
+ * Not recommended to modify it manually because it will be overwritten while re-generate.
57
+ */
58
+ `;
59
+ }
60
+ exports.getGenaratorHeaderComment = getGenaratorHeaderComment;
61
+ function getSimpleHeaderComment() {
62
+ const packageInfo = getPackageInfo();
63
+ return `// Generated by veryExpress@${packageInfo.version}`;
64
+ }
65
+ exports.getSimpleHeaderComment = getSimpleHeaderComment;
48
66
  const relativePath = (fromPath, toPath) => {
49
67
  return path_1.default.relative(fromPath, toPath).replace(/\\/g, "/");
50
68
  };
@@ -61,25 +79,6 @@ function loadJsonSchema(jsonSchemaPath) {
61
79
  }
62
80
  }
63
81
  exports.loadJsonSchema = loadJsonSchema;
64
- function getGenaratorHeaderComment(comment) {
65
- const packageInfo = getPackageInfo();
66
- return `/* eslint-disable */
67
- /**
68
- * Generated by veryExpress@${packageInfo.version}
69
- * We recommend not to modified it manually because it will be overwrite.
70
- * we suggest to modified the jsonSchema then regenerate the project .
71
- *
72
- * author: ${packageInfo.author}
73
- * version: ${packageInfo.version}${comment ? `\n * comment: ${comment}` : ""}
74
- */
75
- `;
76
- }
77
- exports.getGenaratorHeaderComment = getGenaratorHeaderComment;
78
- function getSimpleHeaderComment() {
79
- const packageInfo = getPackageInfo();
80
- return `// Generated by veryExpress@${packageInfo.version}`;
81
- }
82
- exports.getSimpleHeaderComment = getSimpleHeaderComment;
83
82
  function cleanXcustomValue(schemaObj, additionalKeyArr) {
84
83
  const obj = JSON.parse(JSON.stringify(schemaObj));
85
84
  const isAddiArrStr = Array.isArray(additionalKeyArr);
@@ -115,7 +114,7 @@ function httpMethod(jsonSchemaMethod, documentName) {
115
114
  }
116
115
  }
117
116
  exports.httpMethod = httpMethod;
118
- function copyDir(source, destination, overwrite) {
117
+ function copyDir(source, destination, compilerOptions, overwrite) {
119
118
  if (!fs_1.default.existsSync(destination)) {
120
119
  fs_1.default.mkdirSync(destination);
121
120
  }
@@ -123,7 +122,7 @@ function copyDir(source, destination, overwrite) {
123
122
  for (let i = 0; i < files.length; i++) {
124
123
  const current = fs_1.default.lstatSync(source + "/" + files[i]);
125
124
  if (current.isDirectory()) {
126
- copyDir(source + "/" + files[i], destination + "/" + files[i]);
125
+ copyDir(source + "/" + files[i], destination + "/" + files[i], compilerOptions, overwrite);
127
126
  }
128
127
  else if (!overwrite && fs_1.default.existsSync(destination + "/" + files[i])) {
129
128
  logger_1.default.info(`FILE : existed, skip file ${destination + "/" + files[i]} exist, skip`);
@@ -131,7 +130,9 @@ function copyDir(source, destination, overwrite) {
131
130
  else {
132
131
  const outPath = destination + "/" + files[i];
133
132
  logger_1.default.writing(`FILE : ${outPath}`);
134
- fs_1.default.copyFileSync(source + "/" + files[i], outPath);
133
+ let content = fs_1.default.readFileSync(source + "/" + files[i], "utf8");
134
+ content = content.replace(/{{headerComment}}/g, compilerOptions.headerComment);
135
+ fs_1.default.writeFileSync(outPath, content);
135
136
  }
136
137
  }
137
138
  }
@@ -143,7 +144,7 @@ function isUseOAuth(compilerOptions) {
143
144
  }
144
145
  exports.isUseOAuth = isUseOAuth;
145
146
  exports.defaultCompilerOptions = {
146
- headerComment: getGenaratorHeaderComment(),
147
+ headerComment: "// generated files by very-express",
147
148
  commitBeforeGenerate: false,
148
149
  rootDir: ".",
149
150
  srcDir: "./src",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "very-express",
3
- "version": "0.2.3",
3
+ "version": "0.2.5",
4
4
  "description": "based on json schema and openapi, generate Express RestApi server with mongoDb ",
5
5
  "author": "justin26l",
6
6
  "license": "MIT",
@@ -9,7 +9,7 @@
9
9
  "vex": "./dist/cli.js"
10
10
  },
11
11
  "scripts": {
12
- "build": "npm run test && tsc -p . && node ./src/copyDir.js",
12
+ "build": "npm run test && tsc -p . && node ./src/copyTsTemplates.js",
13
13
  "dev": "ts-node ./src/cli.ts -j ./output/jsonSchema -o ./output -s ./output/src",
14
14
  "prod": "node ./dist/cli.js",
15
15
  "test": "eslint ./src --ext .ts --fix",
package/tsconfig.json CHANGED
@@ -108,11 +108,11 @@
108
108
  },
109
109
  "include": [
110
110
  "src/**/*.ts",
111
- "src/generators/routes.generator.ts", "src/test.js", "src/copyDir.js" ],
111
+ "src/generators/routes.generator.ts", "src/test.js", "src/copyTsTemplates.js" ],
112
112
  "exclude": [
113
113
  "node_modules",
114
114
  "output",
115
- "src/copyDir.js",
115
+ "src/copyTsTemplates.js",
116
116
  "src/templates/**/*.gen.ts",
117
117
  ".env",
118
118
  ]
package/vex.config.json CHANGED
@@ -1,5 +1,9 @@
1
1
  {
2
2
  "commitBeforeGenerate": false,
3
+ "jsonSchemaDir": "./output/jsonSchema",
4
+ "rootDir": "./output",
5
+ "srcDir": "./output/src",
6
+ "openapiDir": "./output/openapi",
3
7
  "enableSwagger": true,
4
8
  "useUserSchema": true,
5
9
  "useOauth": {
@@ -7,9 +11,5 @@
7
11
  "microsoft": false,
8
12
  "apple": false,
9
13
  "github": false
10
- },
11
- "jsonSchemaDir": "./output/jsonSchema",
12
- "rootDir": "./output",
13
- "srcDir": "./output/src",
14
- "openapiDir": "./output/openapi"
14
+ }
15
15
  }