very-express 0.0.8 → 0.0.10

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
@@ -3,33 +3,63 @@
3
3
  var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  return (mod && mod.__esModule) ? mod : { "default": mod };
5
5
  };
6
+ var _a;
6
7
  Object.defineProperty(exports, "__esModule", { value: true });
7
8
  const index_1 = __importDefault(require("./index"));
8
9
  const fs_1 = __importDefault(require("fs"));
10
+ const child_process_1 = __importDefault(require("child_process"));
9
11
  const minimist_1 = __importDefault(require("minimist"));
10
12
  const log_1 = __importDefault(require("./utils/log"));
11
13
  var args = (0, minimist_1.default)(process.argv.slice(2));
12
- console.log('\x1b[35m%s\x1b[0m', '\n========== veryExpress CLI (vex) ==========\n');
14
+ var config = {};
15
+ if (fs_1.default.existsSync('vex.config.json')) {
16
+ try {
17
+ config = JSON.parse(fs_1.default.readFileSync('vex.config.json', 'utf8'));
18
+ }
19
+ catch (err) {
20
+ log_1.default.error('failed to parse vex.config.json', err);
21
+ process.exit(1);
22
+ }
23
+ ;
24
+ }
25
+ ;
26
+ config.commitBeforeGenerate = (_a = config.commitBeforeGenerate) !== null && _a !== void 0 ? _a : false;
27
+ config.jsonSchemaDir = args.j || args.jsonSchemaDir || config.jsonSchemaDir || './jsonSchema';
28
+ config.openapiDir = args.a || args.openapiDir || config.openapiDir || './openapi';
29
+ config.outputDir = args.o || args.outputDir || config.outputDir || './src';
30
+ console.log('\x1b[35m%s\x1b[0m', '\n========== veryExpress CLI (vex) Start ==========\n');
31
+ log_1.default.writing('vex.config.json');
32
+ fs_1.default.writeFileSync('vex.config.json', JSON.stringify(config, null, 4));
13
33
  if ('h' in args) {
14
34
  console.log(`
15
35
  Usage: vex [jsonSchemaDir] [openapiDir] [outputDir]
16
36
  -h : Help
17
- -j : jsonSchemaDir (default: ./jsonSchema)
18
- -a : openApiDir (default: ./openapi)
19
- -o : outputDir (default: ./src)
37
+ -j : jsonSchemaDir (config: ${config.jsonSchemaDir})
38
+ -a : openapiDir (config: ${config.openapiDir})
39
+ -o : outputDir (config: ${config.outputDir})
20
40
  `);
21
41
  process.exit(0);
22
42
  }
23
- const schemaDir = args.j || args.jsonSchemaDir || process.argv[2] || './jsonSchema';
24
- const openapiDir = args.a || args.openApiDir || process.argv[3] || './openapi';
25
- const outputDir = args.o || args.outputDir || process.argv[4] || './output';
26
- if (!fs_1.default.existsSync(schemaDir)) {
27
- log_1.default.error('Schema Dir Not Found:', schemaDir);
43
+ ;
44
+ if (!fs_1.default.existsSync(config.jsonSchemaDir)) {
45
+ log_1.default.error('Schema Dir Not Found:', config.jsonSchemaDir);
28
46
  process.exit(1);
29
47
  }
30
48
  ;
31
- if (!fs_1.default.existsSync(outputDir)) {
32
- fs_1.default.mkdirSync(outputDir);
49
+ if (!fs_1.default.existsSync(config.outputDir)) {
50
+ fs_1.default.mkdirSync(config.outputDir);
51
+ }
52
+ ;
53
+ if (config.commitBeforeGenerate === true) {
54
+ try {
55
+ log_1.default.info('git commit "before vex-gen"');
56
+ child_process_1.default.execSync('git add . && git commit -m "before vex-gen"', { stdio: 'inherit' });
57
+ }
58
+ catch (err) {
59
+ log_1.default.error('git commit "before vex-gen" failed', err);
60
+ }
61
+ ;
33
62
  }
34
63
  ;
35
- (0, index_1.default)(schemaDir, openapiDir, outputDir);
64
+ (0, index_1.default)(config.jsonSchemaDir, config.openapiDir, config.outputDir);
65
+ console.log('\x1b[35m%s\x1b[0m', '\n========== veryExpress CLI (vex) Complete ==========\n');
@@ -0,0 +1,5 @@
1
+ export declare function compile(packageOutPath: string, schemaDir: string, openapiDir: string, outDir: string): void;
2
+ declare const _default: {
3
+ compile: typeof compile;
4
+ };
5
+ export default _default;
@@ -0,0 +1,59 @@
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.compile = void 0;
7
+ const fs_1 = __importDefault(require("fs"));
8
+ const log_1 = __importDefault(require("../utils/log"));
9
+ function compile(packageOutPath, schemaDir, openapiDir, outDir) {
10
+ log_1.default.process(`Project : ${packageOutPath}`);
11
+ let writePackage = false;
12
+ let packjson = '';
13
+ if (!fs_1.default.existsSync(packageOutPath)) {
14
+ packjson = fs_1.default.readFileSync(__dirname + '/../templates/root/package.json').toString();
15
+ }
16
+ else {
17
+ packjson = fs_1.default.readFileSync(packageOutPath).toString();
18
+ }
19
+ ;
20
+ const packageJson = JSON.parse(packjson);
21
+ const vexgenScript = `vex -j ${schemaDir} -a ${openapiDir} -o ${outDir}`;
22
+ if (packageJson.scripts.vexgen !== vexgenScript) {
23
+ packageJson.scripts.vexgen = vexgenScript;
24
+ writePackage = true;
25
+ log_1.default.process(`package.json : Update script : vexgen > ${packageJson.scripts.vexgen}`);
26
+ }
27
+ ;
28
+ if (!packageJson.scripts.build) {
29
+ packageJson.scripts.build = 'tsc -p .';
30
+ writePackage = true;
31
+ log_1.default.process(`package.json : Update script : build > ${packageJson.scripts.build}`);
32
+ }
33
+ ;
34
+ if (!packageJson.scripts.dev) {
35
+ packageJson.scripts.dev = `nodemon --watch src --exec ts-node ${outDir}/server.ts`;
36
+ writePackage = true;
37
+ log_1.default.process(`package.json : Update script : dev > ${packageJson.scripts.dev}`);
38
+ }
39
+ ;
40
+ if (!packageJson.scripts.start) {
41
+ packageJson.scripts.start = 'node ./dist/server.js';
42
+ writePackage = true;
43
+ log_1.default.process(`package.json : Update script : start > ${packageJson.scripts.start}`);
44
+ }
45
+ ;
46
+ if (writePackage) {
47
+ log_1.default.writing(`Project : ${packageOutPath}`);
48
+ fs_1.default.writeFileSync(packageOutPath, JSON.stringify(packageJson, null, 4));
49
+ }
50
+ else {
51
+ log_1.default.info(`package.json : No changes`);
52
+ }
53
+ ;
54
+ }
55
+ exports.compile = compile;
56
+ ;
57
+ exports.default = {
58
+ compile
59
+ };
@@ -5,50 +5,32 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.compile = void 0;
7
7
  const fs_1 = __importDefault(require("fs"));
8
- const child_process_1 = __importDefault(require("child_process"));
9
8
  const server_template_1 = __importDefault(require("./server.template"));
9
+ const packageJson_generator_1 = __importDefault(require("./packageJson.generator"));
10
10
  const log_1 = __importDefault(require("../utils/log"));
11
11
  function compile(schemaDir, openapiDir, outDir, options) {
12
12
  const serverOutPath = `${outDir}/server.ts`;
13
- const packageOutPath = `${outDir}/package.json`;
14
- const envOutPath = `${outDir}/.env`;
15
- const tsconfigOutPath = `${outDir}/tsconfig.json`;
16
- const gitignoreOutPath = `${outDir}/.gitignore`;
17
- log_1.default.writing(`Server : ${serverOutPath}`);
18
- fs_1.default.writeFileSync(outDir + '/server.ts', (0, server_template_1.default)({
19
- options: options,
20
- }));
21
- log_1.default.writing(`Project : ${packageOutPath}`);
22
- let packjson = '';
23
- if (!fs_1.default.existsSync(packageOutPath)) {
24
- packjson = fs_1.default.readFileSync(__dirname + '/../templates/root/package.json').toString();
13
+ const packageOutPath = `./package.json`;
14
+ const envOutPath = `./.env`;
15
+ const tsconfigOutPath = `./tsconfig.json`;
16
+ const gitignoreOutPath = `./.gitignore`;
17
+ if (!fs_1.default.existsSync(serverOutPath)) {
18
+ log_1.default.writing(`Server : ${serverOutPath}`);
19
+ fs_1.default.writeFileSync(outDir + '/server.ts', (0, server_template_1.default)({
20
+ options: options,
21
+ }));
25
22
  }
26
- else {
27
- packjson = fs_1.default.readFileSync(packageOutPath).toString();
28
- }
29
- const packageJson = JSON.parse(packjson);
30
- packageJson['scripts'] = {
31
- "vex-gen": `vex -j ${schemaDir} -a ${openapiDir} -o ${outDir}`,
32
- "build": "tsc -p .",
33
- "dev": `nodemon --watch src --exec ts-node ${outDir}/server.ts`,
34
- "start": "node ./dist/server.js",
35
- };
36
- fs_1.default.writeFileSync(packageOutPath, JSON.stringify(packageJson, null, 4));
37
- if (!fs_1.default.existsSync(tsconfigOutPath)) {
38
- try {
39
- log_1.default.writing(`Project : ${tsconfigOutPath}`);
40
- child_process_1.default.execSync('tsc --init', { cwd: outDir, stdio: 'inherit' });
41
- }
42
- catch (error) {
43
- log_1.default.error('Error on command: tsc --init');
44
- }
45
- }
46
- ;
47
23
  if (!fs_1.default.existsSync(envOutPath)) {
48
24
  log_1.default.writing(`Project : ${envOutPath}`);
49
25
  fs_1.default.copyFileSync(__dirname + '/../templates/root/.env', envOutPath);
50
26
  }
51
27
  ;
28
+ if (!fs_1.default.existsSync(tsconfigOutPath)) {
29
+ log_1.default.writing(`Project : ${tsconfigOutPath}`);
30
+ fs_1.default.copyFileSync(__dirname + '/../templates/root/tsconfig.json', tsconfigOutPath);
31
+ }
32
+ ;
33
+ packageJson_generator_1.default.compile(packageOutPath, schemaDir, openapiDir, outDir);
52
34
  }
53
35
  exports.compile = compile;
54
36
  ;
@@ -23,8 +23,8 @@ app.use(helmet({
23
23
  xDnsPrefetchControl: { allow: false },
24
24
  }));
25
25
 
26
- app.listen(process.env.VERYEXPRESS_PORT, () => {
27
- console.log('Server is running on port ' + process.env.VERYEXPRESS_PORT );
26
+ app.listen(process.env.EXPRESS_PORT, () => {
27
+ console.log('Server is running on port ' + process.env.EXPRESS_PORT );
28
28
  });
29
29
  `;
30
30
  template = template.replace(/{{headerComment}}/g, headerComment);
package/dist/index.js CHANGED
@@ -27,7 +27,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
29
  const fs_1 = __importDefault(require("fs"));
30
- const child_process_1 = __importDefault(require("child_process"));
31
30
  const json2mongoose_1 = __importDefault(require("json2mongoose"));
32
31
  const openapiGen = __importStar(require("./generators/openapi.generator"));
33
32
  const log_1 = __importDefault(require("./utils/log"));
@@ -36,13 +35,6 @@ const controllerGen = __importStar(require("./generators/controllers.generator")
36
35
  const routeGen = __importStar(require("./generators/routes.generator"));
37
36
  const serverGen = __importStar(require("./generators/server.generator"));
38
37
  function generate(schemaDir, openapiDir, outDir, options) {
39
- try {
40
- child_process_1.default.execSync('git add . && git commit -m "before vex-gen"', { stdio: 'inherit' });
41
- }
42
- catch (err) {
43
- log_1.default.error('git commit "before vex-gen" failed', err);
44
- }
45
- ;
46
38
  const dir = {
47
39
  routeDir: `${outDir}/routes`,
48
40
  middlewareDir: `${outDir}/middlewares`,
@@ -52,6 +44,7 @@ function generate(schemaDir, openapiDir, outDir, options) {
52
44
  serviceDir: `${outDir}/services`,
53
45
  utilsDir: `${outDir}/utils`,
54
46
  };
47
+ const openapipath = `${openapiDir}/openapi.gen.yaml`;
55
48
  if (!fs_1.default.existsSync(outDir)) {
56
49
  fs_1.default.mkdirSync(outDir);
57
50
  }
@@ -66,32 +59,36 @@ function generate(schemaDir, openapiDir, outDir, options) {
66
59
  }
67
60
  ;
68
61
  });
62
+ log_1.default.process(`Router : ${openapipath}`);
69
63
  let routeData = [];
70
64
  const files = fs_1.default.readdirSync(schemaDir);
71
65
  files.forEach((schemaFileName) => {
66
+ const schemaPath = `${schemaDir}/${schemaFileName}`;
72
67
  try {
73
- if (!schemaFileName.endsWith('.json'))
68
+ if (!schemaFileName.endsWith('.json')) {
69
+ log_1.default.warn(`Skipping Non Json File : ${schemaPath}`);
74
70
  return;
75
- const file = fs_1.default.readFileSync(`${schemaDir}/${schemaFileName}`);
71
+ }
72
+ const file = fs_1.default.readFileSync(`${schemaPath}`);
76
73
  const jsonSchema = JSON.parse(file.toString());
77
74
  const documentConfig = jsonSchema["x-documentConfig"];
78
75
  if (!documentConfig)
79
- log_1.default.error(`x-documentConfig not found in ${schemaDir}/${schemaFileName}`);
76
+ log_1.default.error(`x-documentConfig not found in ${schemaPath}`);
80
77
  if (!documentConfig.documentName)
81
- log_1.default.error(`x-documentConfig.documentName not found in ${schemaDir}/${schemaFileName}`);
78
+ log_1.default.error(`x-documentConfig.documentName not found in ${schemaPath}`);
82
79
  if (!documentConfig.interfaceName)
83
- log_1.default.error(`x-documentConfig.interfaceName not found in ${schemaDir}/${schemaFileName}`);
80
+ log_1.default.error(`x-documentConfig.interfaceName not found in ${schemaPath}`);
84
81
  if (!documentConfig.methods)
85
- log_1.default.error(`x-documentConfig.methods is not found in ${schemaDir}/${schemaFileName}`);
82
+ log_1.default.error(`x-documentConfig.methods is not found in ${schemaPath}`);
86
83
  if (!Array.isArray(documentConfig.methods))
87
- log_1.default.error(`x-documentConfig.methods is invalid in ${schemaDir}/${schemaFileName}`);
84
+ log_1.default.error(`x-documentConfig.methods is invalid in ${schemaPath}`);
88
85
  if (typeof jsonSchema.properties !== 'object')
89
- log_1.default.error(`properties is invalid in ${schemaDir}/${schemaFileName}`);
90
- if (!fs_1.default.existsSync(`${schemaDir}/${schemaFileName}.nogen.ts`)) {
91
- json2mongoose_1.default.typesGen.compileFromFile(`${schemaDir}/${schemaFileName}`, `${dir.typeDir}/${documentConfig.interfaceName}.gen.ts`, options || common_1.default.defaultCompilerOptions);
86
+ log_1.default.error(`properties is invalid in ${schemaPath}`);
87
+ if (!fs_1.default.existsSync(`${schemaPath}.nogen.ts`)) {
88
+ json2mongoose_1.default.typesGen.compileFromFile(`${schemaPath}`, `${dir.typeDir}/${documentConfig.interfaceName}.gen.ts`, options || common_1.default.defaultCompilerOptions);
92
89
  }
93
- if (!fs_1.default.existsSync(`${schemaDir}/${schemaFileName}Model.nogen.ts`)) {
94
- 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);
90
+ if (!fs_1.default.existsSync(`${schemaPath}Model.nogen.ts`)) {
91
+ json2mongoose_1.default.modelsGen.compileFromFile(`${schemaPath}`, `${common_1.default.relativePath(dir.modelDir, dir.typeDir)}/${documentConfig.interfaceName}.gen`, `${dir.modelDir}/${documentConfig.interfaceName}Model.gen.ts`, options || common_1.default.defaultCompilerOptions);
95
92
  }
96
93
  ;
97
94
  routeData.push({
@@ -101,18 +98,18 @@ function generate(schemaDir, openapiDir, outDir, options) {
101
98
  });
102
99
  }
103
100
  catch (err) {
104
- log_1.default.error(`Processing File : ${schemaDir}/${schemaFileName}\n`, err);
101
+ log_1.default.error(`Processing File : ${schemaPath}\n`, err);
105
102
  }
106
103
  ;
107
104
  });
108
105
  if (!fs_1.default.existsSync(openapiDir + '/openapi.nogen.yaml')) {
109
- openapiGen.compile(schemaDir, openapiDir + '/openapi.gen.yaml');
106
+ openapiGen.compile(schemaDir, openapipath);
110
107
  }
111
108
  ;
112
109
  common_1.default.copyDir(`${openapiDir}`, outDir + '/openapi');
113
110
  common_1.default.copyDir(`${__dirname}/templates/utils`, dir.utilsDir);
114
- controllerGen.compile(openapiDir + '/openapi.gen.yaml', `${common_1.default.relativePath(dir.controllerDir, dir.modelDir)}`, dir.controllerDir, options || common_1.default.defaultCompilerOptions);
115
- routeGen.compile(routeData, openapiDir + '/openapi.gen.yaml', `${dir.routeDir}/routes.gen.ts`, options || common_1.default.defaultCompilerOptions);
111
+ controllerGen.compile(openapipath, `${common_1.default.relativePath(dir.controllerDir, dir.modelDir)}`, dir.controllerDir, options || common_1.default.defaultCompilerOptions);
112
+ routeGen.compile(routeData, openapipath, `${dir.routeDir}/routes.gen.ts`, options || common_1.default.defaultCompilerOptions);
116
113
  serverGen.compile(schemaDir, openapiDir, outDir, options || { headerComment: common_1.default.getSimpleHeaderComment() });
117
114
  }
118
115
  exports.default = generate;
@@ -0,0 +1,2 @@
1
+ # veryExpress generated
2
+ EXPRESS_PORT=3000
@@ -0,0 +1,28 @@
1
+ {
2
+ "main": "index.js",
3
+ "scripts": {
4
+ "vexgen": "vex",
5
+ "build": "tsc -p .",
6
+ "start": "node dist/server.js",
7
+ "dev": "nodemon --exec ts-node src/server.ts"
8
+ },
9
+ "dependencies": {
10
+ "dotenv": "^16.3.1",
11
+ "nodemon": "^2.0.22",
12
+ "express": "^4.18.2",
13
+ "express-validator": "^7.0.1",
14
+ "helmet": "^7.1.0",
15
+ "passport": "^0.7.0",
16
+ "passport-google-oauth20": "^2.0.0",
17
+ "swagger-ui-express": "^5.0.0"
18
+ },
19
+ "devDependencies": {
20
+ "@types/express": "^4.17.21",
21
+ "@types/node": "^20.10.5",
22
+ "@types/passport": "^1.0.16",
23
+ "@types/passport-google-oauth20": "^2.0.14",
24
+ "@types/swagger-ui-express": "^4.1.6",
25
+ "ts-node": "^10.9.2",
26
+ "typescript": "^5.3.3"
27
+ }
28
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "compilerOptions": {
3
+ /* Visit https://aka.ms/tsconfig to read more about this file */
4
+
5
+ /* Language and Environment */
6
+ "target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
7
+
8
+ /* Modules */
9
+ "module": "commonjs", /* Specify what module code is generated. */
10
+
11
+ /* Emit */
12
+ "outDir": "./dist", /* Specify an output folder for all emitted files. */
13
+ "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
14
+ "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
15
+
16
+ /* Type Checking */
17
+ "strict": true, /* Enable all strict type-checking options. */
18
+ "skipLibCheck": true /* Skip type checking all .d.ts files. */
19
+ }
20
+ }
21
+
@@ -0,0 +1,11 @@
1
+ import jsYaml from 'js-yaml';
2
+ import fs from 'fs';
3
+
4
+ export function loadYaml(yamlFilePath: string) {
5
+ try {
6
+ return jsYaml.load(fs.readFileSync(yamlFilePath, 'utf8'));
7
+ } catch (e: any) {
8
+ console.log('\x1b[41m%s\x1b[0m', '[ERROR]', 'Error Load OpenApi File :\n', e);
9
+ process.exit(0);
10
+ }
11
+ };
@@ -6,15 +6,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.defaultCompilerOptions = exports.copyDir = exports.cleanXcustomValue = exports.getSimpleHeaderComment = exports.getGenaratorHeaderComment = exports.loadYaml = exports.relativePath = void 0;
7
7
  const fs_1 = __importDefault(require("fs"));
8
8
  const path_1 = __importDefault(require("path"));
9
+ const child_process_1 = __importDefault(require("child_process"));
9
10
  const js_yaml_1 = __importDefault(require("js-yaml"));
10
11
  const log_1 = __importDefault(require("./log"));
11
12
  function getPackageInfo() {
12
- var _a;
13
- const packageJson = fs_1.default.readFileSync("./package.json", "utf8");
14
- const packageJsonObject = JSON.parse(packageJson);
13
+ let globalPackages = {};
14
+ try {
15
+ globalPackages = JSON.parse(child_process_1.default.execSync('npm -g list --json').toString());
16
+ }
17
+ catch (error) {
18
+ log_1.default.error('Failed to execute command: npm -g list --json', error);
19
+ }
15
20
  return {
16
- version: ((_a = packageJsonObject.dependencies['very-express']) === null || _a === void 0 ? void 0 : _a.replace('^', '')) || "[unknown version]",
17
- author: packageJsonObject.author || "justin26l",
21
+ version: globalPackages.dependencies['very-express'].version || "[unknown version]",
22
+ author: globalPackages.author || "justin26l",
18
23
  };
19
24
  }
20
25
  const relativePath = (fromPath, toPath) => {
@@ -1,9 +1,13 @@
1
1
  export declare function processing(msg: any, ...optionalParams: any[]): void;
2
2
  export declare function writing(msg: any, ...optionalParams: any[]): void;
3
+ export declare function info(msg: any, ...optionalParams: any[]): void;
4
+ export declare function warn(msg: any, ...optionalParams: any[]): void;
3
5
  export declare function error(msg: any, ...optionalParams: any[]): void;
4
6
  declare const _default: {
5
7
  process: typeof processing;
6
8
  writing: typeof writing;
9
+ info: typeof info;
10
+ warn: typeof warn;
7
11
  error: typeof error;
8
12
  };
9
13
  export default _default;
package/dist/utils/log.js CHANGED
@@ -1,21 +1,31 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.error = exports.writing = exports.processing = void 0;
3
+ exports.error = exports.warn = exports.info = exports.writing = exports.processing = void 0;
4
4
  function processing(msg, ...optionalParams) {
5
- console.log('\x1b[36m%s\x1b[0m', '[Processing]', msg, optionalParams.length > 0 ? optionalParams : '');
5
+ console.log('\x1b[34m%s\x1b[0m', '[PROCESSING]', msg, optionalParams.length > 0 ? optionalParams : '');
6
6
  }
7
7
  exports.processing = processing;
8
8
  function writing(msg, ...optionalParams) {
9
- console.log('\x1b[32m%s\x1b[0m', '[Writing]', msg, optionalParams.length > 0 ? optionalParams : '');
9
+ console.log('\x1b[32m%s\x1b[0m', '[WRITING]', msg, optionalParams.length > 0 ? optionalParams : '');
10
10
  }
11
11
  exports.writing = writing;
12
+ function info(msg, ...optionalParams) {
13
+ console.log('\x1b[36m%s\x1b[0m', '[INFO]', msg, optionalParams.length > 0 ? optionalParams : '');
14
+ }
15
+ exports.info = info;
16
+ function warn(msg, ...optionalParams) {
17
+ console.log('\x1b[33m%s\x1b[0m', '[WARN]', msg, optionalParams.length > 0 ? optionalParams : '');
18
+ }
19
+ exports.warn = warn;
12
20
  function error(msg, ...optionalParams) {
13
- console.log('\x1b[31m%s\x1b[0m', '[Error]', msg, optionalParams.length > 0 ? optionalParams : '');
21
+ console.log('\x1b[41m%s\x1b[0m', '[ERROR]', msg, optionalParams.length > 0 ? optionalParams : '');
14
22
  process.exit(1);
15
23
  }
16
24
  exports.error = error;
17
25
  exports.default = {
18
26
  process: processing,
19
27
  writing,
28
+ info,
29
+ warn,
20
30
  error,
21
31
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "very-express",
3
- "version": "0.0.8",
3
+ "version": "0.0.10",
4
4
  "description": "based on json schema and openapi, generate Express RestApi server with mongoDb ",
5
5
  "author": "justin26l",
6
6
  "license": "MIT",
@@ -27,7 +27,6 @@
27
27
  "url": "git+https://github.com/Justin26l/VeryExpress.git"
28
28
  },
29
29
  "dependencies": {
30
- "@types/express-session": "^1.17.10",
31
30
  "express-session": "^1.17.3",
32
31
  "js-yaml": "4.1.0",
33
32
  "json-schema-to-openapi-schema": "^0.4.0",
@@ -35,6 +34,7 @@
35
34
  "minimist": "^1.2.8"
36
35
  },
37
36
  "devDependencies": {
37
+ "@types/express-session": "^1.17.10",
38
38
  "@types/express": "^4.17.21",
39
39
  "@types/js-yaml": "^4.0.9",
40
40
  "@types/minimist": "^1.2.5",
@@ -48,8 +48,7 @@
48
48
  "helmet": "^7.1.0",
49
49
  "js-yaml": "^4.1.0",
50
50
  "json-schema-to-openapi-schema": "^0.4.0",
51
- "json2mongoose": "^0.1.5",
52
- "ncp": "^2.0.0",
51
+ "json2mongoose": "^0.1.6",
53
52
  "passport": "^0.7.0",
54
53
  "passport-google-oauth20": "^2.0.0",
55
54
  "swagger-ui-express": "^5.0.0",