egg-controller
Advanced tools
Comparing version 0.1.10 to 0.1.12
@@ -13,9 +13,9 @@ "use strict"; | ||
const SDKDir = path.isAbsolute(config.SDKDir) ? config.SDKDir : path.join(agent.baseDir, config.SDKDir); | ||
gen_sdk_1.genAPISDKByPath(dir, SDKDir); | ||
gen_sdk_1.genAPISDKByPath(dir, SDKDir, config.templatePath); | ||
console.log('[egg-controller] gen api sdk.'); | ||
agent.watcher.watch(dir, (file) => { | ||
console.log('[egg-controller] file changed', file.path); | ||
gen_sdk_1.genAPISDKByPath(file.path, SDKDir); | ||
gen_sdk_1.genAPISDKByPath(file.path, SDKDir, config.templatePath); | ||
}); | ||
} | ||
}; |
@@ -7,2 +7,3 @@ declare const _default: { | ||
SDKDir: string; | ||
templatePath: string; | ||
}; | ||
@@ -9,0 +10,0 @@ aop: { |
@@ -10,2 +10,3 @@ "use strict"; | ||
SDKDir: path.join('app', 'assets', 'service'), | ||
templatePath: '', | ||
}, | ||
@@ -12,0 +13,0 @@ aop: { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const path = require("path"); | ||
const util_1 = require("./util"); | ||
@@ -9,3 +8,3 @@ process.on('message', (message) => { | ||
files.forEach(file => require(file)); | ||
util_1.genAPISDK(targetSDKDir, templatePath || path.join(targetSDKDir, 'sdk.template'), route => { | ||
util_1.genAPISDK(targetSDKDir, templatePath, route => { | ||
return [].concat(route.url).findIndex(url => typeof url === 'string' && url.startsWith('/api/')) >= 0; | ||
@@ -12,0 +11,0 @@ }); |
@@ -20,3 +20,3 @@ "use strict"; | ||
p.on('message', (_data) => { | ||
p.send({ targetSDKDir, files, templatePath }); | ||
p.send({ targetSDKDir, files, templatePath: templatePath || path.join(targetSDKDir, 'sdk.template') }); | ||
}); | ||
@@ -23,0 +23,0 @@ p.on('exit', () => { |
@@ -76,3 +76,3 @@ "use strict"; | ||
if (parsedPath.ext === '.ts' && filePath.indexOf('.d.ts') < 0) { | ||
const jsPath = path.join(filePath, `${parsedPath.name}.js`); | ||
const jsPath = path.join(parsedPath.dir, `${parsedPath.name}.js`); | ||
if (fs.existsSync(jsPath)) { | ||
@@ -92,3 +92,4 @@ return jsPath; | ||
if (dirStat.isFile()) { | ||
files.push(getFile(dirPath)); | ||
const filePath = getFile(dirPath); | ||
filePath && files.push(filePath); | ||
} | ||
@@ -104,8 +105,9 @@ else if (dirStat.isDirectory()) { | ||
else if (stat.isFile()) { | ||
files.push(getFile(fullPath)); | ||
const filePath = getFile(dirPath); | ||
filePath && files.push(filePath); | ||
} | ||
}); | ||
} | ||
return files.filter(f => f); | ||
return files; | ||
} | ||
exports.loadDir = loadDir; |
{ | ||
"name": "egg-controller", | ||
"version": "0.1.10", | ||
"version": "0.1.12", | ||
"description": "controller for egg.", | ||
@@ -36,4 +36,9 @@ "main": "lib/index.js", | ||
}, | ||
"bin": { | ||
"egg-controller": "./bin/index.js" | ||
}, | ||
"dependencies": { | ||
"co": "^4.6.0", | ||
"colorful": "^2.1.0", | ||
"commander": "^2.17.1", | ||
"egg-aop": "^0.5.2", | ||
@@ -40,0 +45,0 @@ "tslib": "^1.9.0" |
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
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
41882
56
988
5
+ Addedcolorful@^2.1.0
+ Addedcommander@^2.17.1
+ Addedcolorful@2.1.0(transitive)
+ Addedcommander@2.20.3(transitive)