egg-controller
Advanced tools
Comparing version 0.1.13 to 0.1.14
11
app.js
@@ -10,12 +10,7 @@ "use strict"; | ||
if (config.autoLoad) { | ||
[].concat(config.dir).forEach(dir => { | ||
if (!path.isAbsolute(dir)) { | ||
dir = path.join(app.baseDir, dir); | ||
} | ||
if (fs.existsSync(dir)) { | ||
util_1.loadDir(dir).forEach(file => require(file)); | ||
} | ||
}); | ||
[].concat(config.dir) | ||
.map(dir => path.isAbsolute(dir) ? dir : path.join(app.baseDir, dir)) | ||
.forEach(dir => fs.existsSync(dir) && util_1.loadDir(dir).forEach(file => require(file))); | ||
} | ||
register_1.registerRoute(app); | ||
}; |
@@ -1,1 +0,1 @@ | ||
export declare function genAPISDK(projectPath: string): Promise<void>; | ||
export declare function genAPISDK(baseDir: string): Promise<void>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const tslib_1 = require("tslib"); | ||
const egg_mock_1 = require("egg-mock"); | ||
const path = require("path"); | ||
const meta_1 = require("../meta"); | ||
function genAPISDK(projectPath) { | ||
const utils = require('egg-utils'); | ||
function genAPISDK(baseDir) { | ||
return tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
const app = egg_mock_1.default.app({ baseDir: projectPath }); | ||
const framework = utils.getFrameworkPath({ baseDir }); | ||
const egg = require(framework); | ||
const app = new egg.Application(); | ||
const config = app.config.controller; | ||
yield meta_1.genAPISDKByPath(config.dir, config.SDKDir, config.templatePath); | ||
yield Promise.all([].concat(config.dir) | ||
.map(dir => path.isAbsolute(dir) ? dir : path.join(app.baseDir, dir)) | ||
.map((dir) => tslib_1.__awaiter(this, void 0, void 0, function* () { return meta_1.genAPISDKByPath(dir, config.SDKDir, config.templatePath); }))); | ||
console.log('[egg-controller] gen api sdk.'); | ||
@@ -12,0 +17,0 @@ }); |
@@ -15,2 +15,3 @@ "use strict"; | ||
gen_sdk_1.genAPISDK(baseDir) | ||
.then(_ => process.exit(0)) | ||
.catch(error => console.log('Gen Error:\n', error)); | ||
@@ -17,0 +18,0 @@ }); |
{ | ||
"name": "egg-controller", | ||
"version": "0.1.13", | ||
"version": "0.1.14", | ||
"description": "controller for egg.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
42351
993
7