Skip to content

Commit

Permalink
fix:调整循环调用接口
Browse files Browse the repository at this point in the history
  • Loading branch information
SunLxy committed Aug 30, 2022
1 parent f5ac56a commit c64fbfe
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
5 changes: 3 additions & 2 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,3 +132,7 @@ export const getPackages = async (workspaces: string | string[]) => {
throw err
}
}
export const splitArr = (packageList: {package: string; tag: string}[]) => {
//对数据进行长度划分
const lg = Math.ceil(packageList.length / 50)
}
19 changes: 11 additions & 8 deletions src/utils/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,22 @@ export const request = async (
newEntries?: {tag: string; package: string}[]
): Promise<Results | Results[]> => {
if (Array.isArray(newEntries) && newEntries.length) {
const assets = await Promise.all(
newEntries.map(async item => {
const lg = newEntries.length
try {
const resultArr: Results[] = []
for (let index = 0; index < lg; index++) {
const item = newEntries[index]
const json = await npmPublish({
...options,
tag: tag || item.tag,
package: item.package
})
return json
})
).catch(error => {
throw error
})
return assets
resultArr.push(json)
}
return resultArr
} catch (err) {
throw err
}
} else if (options.package) {
const json = await npmPublish({
...options
Expand Down

0 comments on commit c64fbfe

Please sign in to comment.