grpc-code-gen
Advanced tools
Comparing version 6.0.10 to 6.1.0
@@ -33,8 +33,23 @@ "use strict"; | ||
const firstUrl = gitUrls.splice(0, 1); | ||
// 检测是否有依赖proto配置,先匹配出依赖项 | ||
const libs = gitUrls.reduce((prev, next, index) => { | ||
if (typeof (next) === 'object' && next.type === 'lib') { | ||
gitUrls.splice(index, 1); | ||
return Object.assign({}, prev, { [next.url]: next }); | ||
} | ||
return Object.assign({}, prev); | ||
}, {}); | ||
let allResult = []; | ||
let alljson = {}; | ||
yield Promise.all(gitUrls.map((url) => __awaiter(this, void 0, void 0, function* () { | ||
// 检测是否有依赖 | ||
let libUrl; | ||
if (typeof (url) === 'object' && url.deps && url.deps.length) { | ||
libUrl = url.deps.reduce((prev, next) => { | ||
return libs[next] ? [...prev, libs[next]] : [...prev]; | ||
}, []); | ||
} | ||
const newUrl = typeof url === 'string' ? url : url.url; | ||
const root = yield load_proto_1.loadProto({ | ||
gitUrls: [...firstUrl, url], | ||
gitUrls: libUrl && libUrl.length ? [...firstUrl, ...libUrl, url] : [...firstUrl, url], | ||
branch, | ||
@@ -41,0 +56,0 @@ accessToken, |
{ | ||
"name": "grpc-code-gen", | ||
"version": "6.0.10", | ||
"version": "6.1.0", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "repository": "https://github.com/yunkeCN/grpc-code-gen.git", |
@@ -21,3 +21,13 @@ # grpc-code-gen | ||
}, | ||
'git@git.myscrm.cn:2c/panther-statistics-proto.git', | ||
// 服务依赖proto | ||
{ | ||
url: 'git@git.myscrm.cn:ykcommon/common-proto.git', | ||
branch: 'master', | ||
type:'lib' | ||
}, | ||
{ | ||
url: 'git@git.myscrm.cn:2c/panther-statistics-proto.git', | ||
// panther-statistics 服务proto依赖于 common-proto | ||
deps:['git@git.myscrm.cn:ykcommon/common.git'] | ||
}, | ||
'git@git.myscrm.cn:2c/panther-third-proto.git', | ||
@@ -118,2 +128,5 @@ ], | ||
### 版本说明 | ||
- v6.1.0 版本 | ||
gitUrls配置新增依赖项 | ||
- v6.0.6 版本 | ||
@@ -120,0 +133,0 @@ 新增 access 日志链路 |
@@ -54,2 +54,13 @@ import * as fs from 'fs-extra'; | ||
const firstUrl = gitUrls.splice(0, 1) | ||
// 检测是否有依赖proto配置,先匹配出依赖项 | ||
const libs:any = (gitUrls as any).reduce((prev: (GitUrlsItem|string)[], next: GitUrlsItem | string, index: number)=>{ | ||
if (typeof (next) === 'object' && next.type === 'lib') { | ||
gitUrls.splice(index,1) | ||
return { ...prev, [next.url]: next } | ||
} | ||
return { ...prev} | ||
},{}) | ||
let allResult: Array<{ result: any, root: any, [propname: string]: any }> = [] | ||
@@ -59,5 +70,13 @@ let alljson: { [propname: string]: any } = {} | ||
await Promise.all(gitUrls.map(async (url: GitUrlsItem | string) => { | ||
// 检测是否有依赖 | ||
let libUrl:any | ||
if (typeof (url) === 'object' && url.deps && url.deps.length) { | ||
libUrl = url.deps.reduce((prev:string[], next:string)=>{ | ||
return libs[next] ? [...prev, libs[next]] : [...prev] | ||
},[]) | ||
} | ||
const newUrl: string = typeof url === 'string' ? url : url.url | ||
const root = await loadProto({ | ||
gitUrls: [...firstUrl, url], | ||
gitUrls: libUrl && libUrl.length ? [...firstUrl, ...libUrl, url] : [...firstUrl, url], | ||
branch, | ||
@@ -64,0 +83,0 @@ accessToken, |
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
293260
36
2637
148