very-express 0.0.3 → 0.0.4

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
@@ -6,9 +6,22 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  const index_1 = __importDefault(require("./index"));
8
8
  const fs_1 = __importDefault(require("fs"));
9
- const schemaDir = process.argv[2] || './jsonSchema';
10
- const openapi = process.argv[3] || './openapi';
11
- const outputDir = process.argv[4] || './output';
9
+ const minimist_1 = __importDefault(require("minimist"));
10
+ var args = (0, minimist_1.default)(process.argv.slice(2));
11
+ console.log('\x1b[35m%s\x1b[0m', '\n========== veryExpress CLI (vex) ==========\n');
12
+ if ('h' in args) {
13
+ console.log(`
14
+ Usage: vex [jsonSchemaDir] [openapiDir] [outputDir]
15
+ -h : Help
16
+ -j : jsonSchemaDir
17
+ -a : openApiDir
18
+ -o : outputDir
19
+ `);
20
+ process.exit(0);
21
+ }
22
+ const schemaDir = args.j || args.jsonSchemaDir || process.argv[2] || './jsonSchema';
23
+ const openapiDir = args.a || args.openApiDir || process.argv[3] || './openapi';
24
+ const outputDir = args.o || args.outputDir || process.argv[4] || './output';
12
25
  if (!fs_1.default.existsSync(schemaDir)) {
13
26
  console.log('\x1b[31m%s\x1b[0m', 'Schema Dir Not Found:', schemaDir);
14
27
  process.exit(1);
@@ -18,4 +31,4 @@ if (!fs_1.default.existsSync(outputDir)) {
18
31
  fs_1.default.mkdirSync(outputDir);
19
32
  }
20
33
  ;
21
- (0, index_1.default)(schemaDir, openapi, outputDir);
34
+ (0, index_1.default)(schemaDir, openapiDir, outputDir);
@@ -31,6 +31,7 @@ const fs_1 = __importDefault(require("fs"));
31
31
  const js_yaml_1 = __importDefault(require("js-yaml"));
32
32
  const templates_1 = __importDefault(require("../templates"));
33
33
  const types = __importStar(require("../types/types"));
34
+ const log_1 = __importDefault(require("../utils/log"));
34
35
  function compile(openapiPath, controllerToModelDir, outDir, options) {
35
36
  const file = fs_1.default.readFileSync(openapiPath, 'utf8');
36
37
  const openApi = js_yaml_1.default.load(file);
@@ -38,7 +39,7 @@ function compile(openapiPath, controllerToModelDir, outDir, options) {
38
39
  Object.keys(openApi.paths).forEach((endpoint) => {
39
40
  const interfaceName = openApi.paths[endpoint].summary;
40
41
  endpointsValidator[endpoint] = {};
41
- console.log('\x1b[36m%s\x1b[0m', '[Processing]', `Controller : ${endpoint} -> ${interfaceName}Controller`);
42
+ log_1.default.process(`Controller : ${endpoint} -> ${interfaceName}Controller`);
42
43
  Object.keys(openApi.paths[endpoint]).forEach((method) => {
43
44
  if (!Object.values(types.method).includes(method))
44
45
  return;
@@ -62,7 +63,7 @@ function compile(openapiPath, controllerToModelDir, outDir, options) {
62
63
  ;
63
64
  const outPath = `${outDir}/${interfaceName}Controller.gen.ts`;
64
65
  const controllerToModelPath = `${controllerToModelDir}/${interfaceName}Model.gen`;
65
- console.log('\x1b[32m%s\x1b[0m', '[Writing]', `Controller : ${outPath}`);
66
+ log_1.default.process(`Controller : ${outPath}`);
66
67
  fs_1.default.writeFileSync(outPath, templates_1.default.controllerTemplate({
67
68
  endpoint: endpoint,
68
69
  modelPath: controllerToModelPath,
@@ -31,7 +31,8 @@ const json_schema_to_openapi_schema_1 = __importDefault(require("json-schema-to-
31
31
  const js_yaml_1 = __importDefault(require("js-yaml"));
32
32
  const fs_1 = __importDefault(require("fs"));
33
33
  const types = __importStar(require("../types/types"));
34
- const utils_1 = __importDefault(require("../utils"));
34
+ const common_1 = __importDefault(require("../utils/common"));
35
+ const log_1 = __importDefault(require("../utils/log"));
35
36
  function compile(schemaDir, outPath) {
36
37
  let openapiJson = {
37
38
  openapi: "3.0.0",
@@ -49,7 +50,7 @@ function compile(schemaDir, outPath) {
49
50
  files.forEach((file) => {
50
51
  if (!file.endsWith('.json'))
51
52
  return;
52
- console.log('\x1b[36m%s\x1b[0m', '[Processing]', `OpenApi : ${schemaDir + '/' + file}`);
53
+ log_1.default.process(`OpenApi : ${schemaDir + '/' + file}`);
53
54
  const jsonSchemaBuffer = fs_1.default.readFileSync(`${schemaDir}/${file}`);
54
55
  const jsonSchema = JSON.parse(jsonSchemaBuffer.toString());
55
56
  openapiJson = jsonToOpenapiPath(openapiJson, jsonSchema);
@@ -57,7 +58,7 @@ function compile(schemaDir, outPath) {
57
58
  });
58
59
  const validOpenApi = (0, json_schema_to_openapi_schema_1.default)(openapiJson, { version: 3.0 });
59
60
  const openapiYaml = js_yaml_1.default.dump(validOpenApi);
60
- console.log('\x1b[32m%s\x1b[0m', '[Writing]', `OpenApi : ${outPath}`);
61
+ log_1.default.writing(`OpenApi : ${outPath}`);
61
62
  fs_1.default.writeFileSync(outPath, openapiYaml);
62
63
  }
63
64
  exports.compile = compile;
@@ -67,7 +68,7 @@ function jsonToOpenapiPath(openapiJson, jsonSchema) {
67
68
  const lowerDocName = documentConfig.documentName.toLowerCase();
68
69
  const interfaceName = documentConfig.interfaceName;
69
70
  const properties = jsonSchema.properties;
70
- const methods = documentConfig.method;
71
+ const methods = documentConfig.methods;
71
72
  let routes = {
72
73
  ['/' + lowerDocName]: {
73
74
  summary: interfaceName,
@@ -155,14 +156,14 @@ function jsonToOpenapiComponentSchema(openapiJson, jsonSchema) {
155
156
  const documentConfig = jsonSchema["x-documentConfig"];
156
157
  const lowerDocName = documentConfig.documentName.toLowerCase();
157
158
  const interfaceName = documentConfig.interfaceName;
158
- const methods = documentConfig.method;
159
+ const methods = documentConfig.methods;
159
160
  const componentSchemaResponse = {
160
161
  type: 'object',
161
- properties: (0, json_schema_to_openapi_schema_1.default)(utils_1.default.cleanXcustomValue(jsonSchema.properties, ['index', 'unique', 'required']), { version: 3.0 }),
162
+ properties: (0, json_schema_to_openapi_schema_1.default)(common_1.default.cleanXcustomValue(jsonSchema.properties, ['index', 'unique', 'required']), { version: 3.0 }),
162
163
  };
163
164
  const componentSchemaBody = {
164
165
  type: 'object',
165
- properties: (0, json_schema_to_openapi_schema_1.default)(utils_1.default.cleanXcustomValue(jsonSchema.properties, ['_id', 'index', 'unique', 'required']), { version: 3.0 }),
166
+ properties: (0, json_schema_to_openapi_schema_1.default)(common_1.default.cleanXcustomValue(jsonSchema.properties, ['_id', 'index', 'unique', 'required']), { version: 3.0 }),
166
167
  };
167
168
  methods.forEach((method) => {
168
169
  switch (method) {
@@ -6,8 +6,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.compile = void 0;
7
7
  const fs_1 = __importDefault(require("fs"));
8
8
  const templates_1 = __importDefault(require("../templates"));
9
+ const log_1 = __importDefault(require("../utils/log"));
9
10
  function compile(routesArr, openapiPath, outPath, options) {
10
- console.log('\x1b[32m%s\x1b[0m', '[Writing]', `Router : ${outPath}`);
11
+ log_1.default.writing(`Router : ${outPath}`);
11
12
  fs_1.default.writeFileSync(outPath, templates_1.default.routesTemplate({
12
13
  routes: routesArr,
13
14
  openapiPath: openapiPath,
@@ -6,19 +6,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.compile = void 0;
7
7
  const fs_1 = __importDefault(require("fs"));
8
8
  const templates_1 = __importDefault(require("../templates"));
9
+ const log_1 = __importDefault(require("../utils/log"));
9
10
  function compile(outDir, options) {
10
11
  const serverOutPath = `${outDir}/server.ts`;
11
12
  const envOutPath = `${outDir}/.env`;
12
13
  const gitignoreOutPath = `${outDir}/.gitignore`;
13
- console.log('\x1b[32m%s\x1b[0m', '[Writing]', `Server : ${serverOutPath}`);
14
+ log_1.default.writing(`Server : ${serverOutPath}`);
14
15
  fs_1.default.writeFileSync(outDir + '/server.ts', templates_1.default.serverTemplate({
15
16
  options: options,
16
17
  }));
17
- console.log('\x1b[32m%s\x1b[0m', '[Writing]', `Server : ${envOutPath}`);
18
+ log_1.default.writing(`Server : ${envOutPath}`);
18
19
  fs_1.default.writeFileSync(`${outDir}/.env`, `# veryExpress generated
19
20
  VERYEXPRESS_PORT=3000
20
21
  `);
21
- console.log('\x1b[32m%s\x1b[0m', '[Writing]', `Server : ${gitignoreOutPath}`);
22
+ log_1.default.writing(`Server : ${gitignoreOutPath}`);
22
23
  fs_1.default.writeFileSync(`${outDir}/.env`, `# veryExpress generated
23
24
  node_modules
24
25
  dist
package/dist/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { compilerOptions } from './types/types';
2
- export default function generate(schemaDir: string, openapiDir: string, outDir: string, options?: compilerOptions): void;
1
+ import * as types from './types/types';
2
+ export default function generate(schemaDir: string, openapiDir: string, outDir: string, options?: types.compilerOptions): void;
package/dist/index.js CHANGED
@@ -29,7 +29,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
29
29
  const fs_1 = __importDefault(require("fs"));
30
30
  const json2mongoose_1 = __importDefault(require("json2mongoose"));
31
31
  const openapiGen = __importStar(require("./generators/openapi.generator"));
32
- const utils_1 = __importDefault(require("./utils"));
32
+ const log_1 = __importDefault(require("./utils/log"));
33
+ const common_1 = __importDefault(require("./utils/common"));
33
34
  const controllerGen = __importStar(require("./generators/controllers.generator"));
34
35
  const routeGen = __importStar(require("./generators/routes.generator"));
35
36
  const serverGen = __importStar(require("./generators/server.generator"));
@@ -50,38 +51,53 @@ function generate(schemaDir, openapiDir, outDir, options) {
50
51
  if (!fs_1.default.existsSync(openapiDir)) {
51
52
  fs_1.default.mkdirSync(openapiDir);
52
53
  }
54
+ ;
53
55
  Object.values(dir).forEach((path) => {
54
56
  if (!fs_1.default.existsSync(path)) {
55
57
  fs_1.default.mkdirSync(path);
56
58
  }
59
+ ;
57
60
  });
58
- openapiGen.compile(schemaDir, openapiDir + '/openapi.gen.yaml');
59
- utils_1.default.copyDir(`${openapiDir}`, outDir + '/openapi');
60
- utils_1.default.copyDir(`${__dirname}/templates/utils`, dir.utilsDir);
61
61
  let routeData = [];
62
62
  const files = fs_1.default.readdirSync(schemaDir);
63
63
  files.forEach((schemaFileName) => {
64
64
  try {
65
65
  if (!schemaFileName.endsWith('.json'))
66
66
  return;
67
- const fileName = schemaFileName.replace('.json', '');
68
- json2mongoose_1.default.typesGen.compileFromFile(`${schemaDir}/${schemaFileName}`, `${dir.typeDir}/${fileName}.gen.ts`, options || utils_1.default.defaultCompilerOptions);
69
- json2mongoose_1.default.modelsGen.compileFromFile(`${schemaDir}/${schemaFileName}`, `${utils_1.default.relativePath(dir.modelDir, dir.typeDir)}/${fileName}.gen`, `${dir.modelDir}/${fileName}Model.gen.ts`, options || utils_1.default.defaultCompilerOptions);
70
- const schema = JSON.parse(fs_1.default.readFileSync(`${schemaDir}/${schemaFileName}`, 'utf-8'));
67
+ const file = fs_1.default.readFileSync(`${schemaDir}/${schemaFileName}`);
68
+ const jsonSchema = JSON.parse(file.toString());
69
+ const documentConfig = jsonSchema["x-documentConfig"];
70
+ if (!documentConfig)
71
+ log_1.default.error(`x-documentConfig not found in ${schemaDir}/${schemaFileName}`);
72
+ if (!documentConfig.documentName)
73
+ log_1.default.error(`x-documentConfig.documentName not found in ${schemaDir}/${schemaFileName}`);
74
+ if (!documentConfig.interfaceName)
75
+ log_1.default.error(`x-documentConfig.interfaceName not found in ${schemaDir}/${schemaFileName}`);
76
+ if (!documentConfig.methods)
77
+ log_1.default.error(`x-documentConfig.methods is not found in ${schemaDir}/${schemaFileName}`);
78
+ if (!Array.isArray(documentConfig.methods))
79
+ log_1.default.error(`x-documentConfig.methods is invalid in ${schemaDir}/${schemaFileName}`);
80
+ if (typeof jsonSchema.properties !== 'object')
81
+ log_1.default.error(`properties is invalid in ${schemaDir}/${schemaFileName}`);
82
+ json2mongoose_1.default.typesGen.compileFromFile(`${schemaDir}/${schemaFileName}`, `${dir.typeDir}/${documentConfig.interfaceName}.gen.ts`, options || common_1.default.defaultCompilerOptions);
83
+ json2mongoose_1.default.modelsGen.compileFromFile(`${schemaDir}/${schemaFileName}`, `${common_1.default.relativePath(dir.modelDir, dir.typeDir)}/${documentConfig.interfaceName}.gen`, `${dir.modelDir}/${documentConfig.interfaceName}Model.gen.ts`, options || common_1.default.defaultCompilerOptions);
71
84
  routeData.push({
72
- route: `/${schema['x-documentConfig'].documentName}`,
73
- controllerClassName: schema['x-documentConfig'].interfaceName,
74
- controllerPath: utils_1.default.relativePath(dir.routeDir, dir.controllerDir) + '/' + schema['x-documentConfig'].interfaceName + 'Controller.gen',
85
+ route: `/${documentConfig.documentName}`,
86
+ controllerClassName: documentConfig.interfaceName,
87
+ controllerPath: common_1.default.relativePath(dir.routeDir, dir.controllerDir) + '/' + documentConfig.interfaceName + 'Controller.gen',
75
88
  });
76
89
  }
77
90
  catch (err) {
78
- console.error('\x1b[31m%s\x1b[0m', `Processing File : ${schemaDir}/${schemaFileName}\n`, err);
91
+ log_1.default.error(`Processing File : ${schemaDir}/${schemaFileName}\n`, err);
79
92
  }
80
93
  ;
81
94
  });
82
- controllerGen.compile(openapiDir + '/openapi.gen.yaml', `${utils_1.default.relativePath(dir.controllerDir, dir.modelDir)}`, dir.controllerDir, options || utils_1.default.defaultCompilerOptions);
83
- routeGen.compile(routeData, openapiDir + '/openapi.gen.yaml', `${dir.routeDir}/routes.gen.ts`, options || utils_1.default.defaultCompilerOptions);
84
- serverGen.compile(outDir, options || { headerComment: utils_1.default.getSimpleHeaderComment() });
95
+ openapiGen.compile(schemaDir, openapiDir + '/openapi.gen.yaml');
96
+ common_1.default.copyDir(`${openapiDir}`, outDir + '/openapi');
97
+ common_1.default.copyDir(`${__dirname}/templates/utils`, dir.utilsDir);
98
+ controllerGen.compile(openapiDir + '/openapi.gen.yaml', `${common_1.default.relativePath(dir.controllerDir, dir.modelDir)}`, dir.controllerDir, options || common_1.default.defaultCompilerOptions);
99
+ routeGen.compile(routeData, openapiDir + '/openapi.gen.yaml', `${dir.routeDir}/routes.gen.ts`, options || common_1.default.defaultCompilerOptions);
100
+ serverGen.compile(outDir, options || { headerComment: common_1.default.getSimpleHeaderComment() });
85
101
  }
86
102
  exports.default = generate;
87
103
  ;
@@ -6,12 +6,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.loadYaml = void 0;
7
7
  const js_yaml_1 = __importDefault(require("js-yaml"));
8
8
  const fs_1 = __importDefault(require("fs"));
9
+ const log_1 = __importDefault(require("../../utils/log"));
9
10
  function loadYaml(yamlFilePath) {
10
11
  try {
11
12
  return js_yaml_1.default.load(fs_1.default.readFileSync(yamlFilePath, 'utf8'));
12
13
  }
13
14
  catch (e) {
14
- console.error('Error Load OpenApi File :\n', e.message || e);
15
+ log_1.default.error('Error Load OpenApi File :\n', e.message || e);
15
16
  }
16
17
  }
17
18
  exports.loadYaml = loadYaml;
@@ -26,7 +26,7 @@ export interface documentConfig {
26
26
  documentType?: 'primary' | 'secondary';
27
27
  interfaceName: string;
28
28
  keyPrefix?: string;
29
- method: method[];
29
+ methods: method[];
30
30
  }
31
31
  export declare enum method {
32
32
  get = "get",
@@ -0,0 +1,22 @@
1
+ import { compilerOptions } from "../types/types";
2
+ export declare const relativePath: (fromPath: string, toPath: string) => string;
3
+ export declare function loadYaml(yamlFilePath: string): void;
4
+ export declare function getGenaratorHeaderComment(comment?: string): string;
5
+ export declare function getSimpleHeaderComment(): string;
6
+ export declare function cleanXcustomValue(schemaObj: {
7
+ [key: string]: any;
8
+ }, additionalKeyArr?: string[]): {
9
+ [key: string]: any;
10
+ };
11
+ export declare function copyDir(source: string, destination: string): void;
12
+ export declare const defaultCompilerOptions: compilerOptions;
13
+ declare const _default: {
14
+ getGenaratorHeaderComment: typeof getGenaratorHeaderComment;
15
+ getSimpleHeaderComment: typeof getSimpleHeaderComment;
16
+ defaultCompilerOptions: compilerOptions;
17
+ relativePath: (fromPath: string, toPath: string) => string;
18
+ cleanXcustomValue: typeof cleanXcustomValue;
19
+ loadYaml: typeof loadYaml;
20
+ copyDir: typeof copyDir;
21
+ };
22
+ export default _default;
@@ -0,0 +1,105 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.defaultCompilerOptions = exports.copyDir = exports.cleanXcustomValue = exports.getSimpleHeaderComment = exports.getGenaratorHeaderComment = exports.loadYaml = exports.relativePath = void 0;
7
+ const fs_1 = __importDefault(require("fs"));
8
+ const path_1 = __importDefault(require("path"));
9
+ const js_yaml_1 = __importDefault(require("js-yaml"));
10
+ const log_1 = __importDefault(require("./log"));
11
+ function getPackageInfo() {
12
+ var _a;
13
+ const packageJson = fs_1.default.readFileSync("./package.json", "utf8");
14
+ const packageJsonObject = JSON.parse(packageJson);
15
+ return {
16
+ version: ((_a = packageJsonObject.dependencies['very-express']) === null || _a === void 0 ? void 0 : _a.replace('^', '')) || "[unknown version]",
17
+ author: packageJsonObject.author || "justin26l",
18
+ };
19
+ }
20
+ const relativePath = (fromPath, toPath) => {
21
+ return path_1.default.relative(fromPath, toPath).replace(/\\/g, '/');
22
+ };
23
+ exports.relativePath = relativePath;
24
+ function loadYaml(yamlFilePath) {
25
+ try {
26
+ const doc = js_yaml_1.default.load(fs_1.default.readFileSync(yamlFilePath, 'utf8'));
27
+ }
28
+ catch (e) {
29
+ log_1.default.error('Error Load OpenApi File :\n', e.message || e);
30
+ }
31
+ }
32
+ exports.loadYaml = loadYaml;
33
+ ;
34
+ function getGenaratorHeaderComment(comment) {
35
+ const packageInfo = getPackageInfo();
36
+ return `/* eslint-disable */
37
+ /**
38
+ * Generated by veryExpress@${packageInfo.version}
39
+ * DO NOT MODIFY MANUALLY. Instead, modify the JsonSchema file,
40
+ * then run veryExpress to regenerate this file.
41
+ *
42
+ * author: ${packageInfo.author}
43
+ * version: ${packageInfo.version}${comment ? `\n * comment: ${comment}` : ''}
44
+ */
45
+ `;
46
+ }
47
+ exports.getGenaratorHeaderComment = getGenaratorHeaderComment;
48
+ ;
49
+ function getSimpleHeaderComment() {
50
+ const packageInfo = getPackageInfo();
51
+ return `// Generated by veryExpress@${packageInfo.version}`;
52
+ }
53
+ exports.getSimpleHeaderComment = getSimpleHeaderComment;
54
+ ;
55
+ function cleanXcustomValue(schemaObj, additionalKeyArr) {
56
+ let obj = Object.assign(schemaObj);
57
+ for (const key in obj) {
58
+ if (key.startsWith("x-")) {
59
+ delete obj[key];
60
+ }
61
+ else if (additionalKeyArr && additionalKeyArr.includes(key)) {
62
+ delete obj[key];
63
+ }
64
+ else if (typeof obj[key] === "object") {
65
+ cleanXcustomValue(obj[key], additionalKeyArr);
66
+ }
67
+ }
68
+ return obj;
69
+ }
70
+ exports.cleanXcustomValue = cleanXcustomValue;
71
+ ;
72
+ function copyDir(source, destination) {
73
+ if (!fs_1.default.existsSync(destination)) {
74
+ fs_1.default.mkdirSync(destination);
75
+ }
76
+ const files = fs_1.default.readdirSync(source);
77
+ for (let i = 0; i < files.length; i++) {
78
+ const current = fs_1.default.lstatSync(source + '/' + files[i]);
79
+ if (current.isDirectory()) {
80
+ copyDir(source + '/' + files[i], destination + '/' + files[i]);
81
+ }
82
+ else if (current.isSymbolicLink()) {
83
+ const symlink = fs_1.default.readlinkSync(source + '/' + files[i]);
84
+ fs_1.default.symlinkSync(symlink, destination + '/' + files[i]);
85
+ }
86
+ else {
87
+ const outPath = destination + '/' + files[i];
88
+ log_1.default.writing(`Utils : ${outPath}`);
89
+ fs_1.default.copyFileSync(source + '/' + files[i], outPath);
90
+ }
91
+ }
92
+ }
93
+ exports.copyDir = copyDir;
94
+ exports.defaultCompilerOptions = {
95
+ headerComment: getGenaratorHeaderComment(),
96
+ };
97
+ exports.default = {
98
+ getGenaratorHeaderComment,
99
+ getSimpleHeaderComment,
100
+ defaultCompilerOptions: exports.defaultCompilerOptions,
101
+ relativePath: exports.relativePath,
102
+ cleanXcustomValue,
103
+ loadYaml,
104
+ copyDir,
105
+ };
@@ -0,0 +1,9 @@
1
+ export declare function processing(msg: any, ...optionalParams: any[]): void;
2
+ export declare function writing(msg: any, ...optionalParams: any[]): void;
3
+ export declare function error(msg: any, ...optionalParams: any[]): void;
4
+ declare const _default: {
5
+ process: typeof processing;
6
+ writing: typeof writing;
7
+ error: typeof error;
8
+ };
9
+ export default _default;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.error = exports.writing = exports.processing = void 0;
4
+ function processing(msg, ...optionalParams) {
5
+ console.log('\x1b[36m%s\x1b[0m', '[Processing]', msg, optionalParams.length > 0 ? optionalParams : '');
6
+ }
7
+ exports.processing = processing;
8
+ function writing(msg, ...optionalParams) {
9
+ console.log('\x1b[32m%s\x1b[0m', '[Writing]', msg, optionalParams.length > 0 ? optionalParams : '');
10
+ }
11
+ exports.writing = writing;
12
+ function error(msg, ...optionalParams) {
13
+ console.log('\x1b[31m%s\x1b[0m', '[Error]', msg, optionalParams.length > 0 ? optionalParams : '');
14
+ process.exit(1);
15
+ }
16
+ exports.error = error;
17
+ exports.default = {
18
+ process: processing,
19
+ writing,
20
+ error,
21
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "very-express",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "description": "based on json schema and openapi, generate Express RestApi server with mongoDb ",
5
5
  "author": "justin26l",
6
6
  "license": "MIT",
@@ -29,11 +29,13 @@
29
29
  "dependencies": {
30
30
  "js-yaml": "4.1.0",
31
31
  "json-schema-to-openapi-schema": "^0.4.0",
32
- "json2mongoose": "^0.1.5"
32
+ "json2mongoose": "^0.1.5",
33
+ "minimist": "^1.2.8"
33
34
  },
34
35
  "devDependencies": {
35
36
  "@types/express": "^4.17.21",
36
37
  "@types/js-yaml": "^4.0.9",
38
+ "@types/minimist": "^1.2.5",
37
39
  "@types/node": "^20.10.4",
38
40
  "@types/swagger-ui-express": "^4.1.6",
39
41
  "dotenv": "^16.3.1",