@mongez/pkgist 1.0.2 → 1.0.4
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/README.md +25 -13
- package/builder.ts +2 -22
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
- package/src/publish/npm-publisher.ts +1 -1
- package/src/build/family-builder.ts +0 -76
- package/src/build/index.ts +0 -4
- package/src/build/package-builder.ts +0 -155
- package/src/build/parallel-builder.ts +0 -36
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import pLimit from "p-limit";
|
|
2
|
-
import type { BuildResult } from "./package-builder.js";
|
|
3
|
-
import { logger } from "../utils/logger.js";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Run an array of async build tasks with a concurrency cap.
|
|
7
|
-
* Each task is a zero-argument function that returns a Promise<BuildResult>.
|
|
8
|
-
*/
|
|
9
|
-
export async function runParallel(
|
|
10
|
-
tasks: (() => Promise<BuildResult>)[],
|
|
11
|
-
concurrency: number,
|
|
12
|
-
): Promise<BuildResult[]> {
|
|
13
|
-
if (tasks.length === 0) return [];
|
|
14
|
-
|
|
15
|
-
const limit = pLimit(Math.max(1, concurrency));
|
|
16
|
-
|
|
17
|
-
logger.info(`Running ${tasks.length} task(s) with concurrency=${concurrency}`);
|
|
18
|
-
|
|
19
|
-
const results = await Promise.all(
|
|
20
|
-
tasks.map((task) => limit(task)),
|
|
21
|
-
);
|
|
22
|
-
|
|
23
|
-
const succeeded = results.filter((r) => r.success).length;
|
|
24
|
-
const failed = results.filter((r) => !r.success).length;
|
|
25
|
-
|
|
26
|
-
if (failed > 0) {
|
|
27
|
-
logger.warn(`${succeeded} succeeded, ${failed} failed`);
|
|
28
|
-
for (const r of results.filter((r) => !r.success)) {
|
|
29
|
-
logger.error(` FAILED: ${r.packageName} — ${r.error?.message ?? "unknown error"}`);
|
|
30
|
-
}
|
|
31
|
-
} else {
|
|
32
|
-
logger.success(`All ${succeeded} package(s) built successfully`);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return results;
|
|
36
|
-
}
|