@tzwzx/codesweep 1.1.4 → 1.2.0
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 +44 -1
- package/dist/cli.d.ts +2 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +5 -1
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +5 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -6
- package/dist/index.js.map +1 -1
- package/dist/runner.d.ts +3 -2
- package/dist/runner.d.ts.map +1 -1
- package/dist/runner.js +35 -10
- package/dist/runner.js.map +1 -1
- package/dist/types.d.ts +9 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -41,6 +41,7 @@ codesweep <command> [options]
|
|
|
41
41
|
- **`init`** — Create a starter `codesweep.yml` in the current directory. Reserved as a subcommand; see note below.
|
|
42
42
|
- **mode** — Any mode defined in `codesweep.yml` (for example `check` or `fix`).
|
|
43
43
|
- **`--config` / `-c <path>`** — Path to the config file (default: `./codesweep.yml`).
|
|
44
|
+
- **`--quiet` / `-q`** — Print only what failed. See [Quiet mode](#quiet-mode).
|
|
44
45
|
- **`--help` / `-h`** — Show help.
|
|
45
46
|
|
|
46
47
|
Examples:
|
|
@@ -50,13 +51,55 @@ codesweep init
|
|
|
50
51
|
codesweep check
|
|
51
52
|
codesweep fix
|
|
52
53
|
codesweep check --config ./packages/app/codesweep.yml
|
|
54
|
+
codesweep check --quiet
|
|
53
55
|
```
|
|
54
56
|
|
|
55
57
|
Exit code `0` on success, `1` on failure. Elapsed time is printed when the run finishes.
|
|
56
58
|
|
|
59
|
+
## Quiet mode
|
|
60
|
+
|
|
61
|
+
`--quiet` buffers what each command prints and shows only the ones that failed. A run where everything passes produces **no output at all** — the exit code carries the result.
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
codesweep check # every tool's progress, summaries and exit lines
|
|
65
|
+
codesweep check --quiet # (nothing)
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
This is aimed at CI, where a green build should not bury the next reader in thousands of lines of "no issues found". It also means a noisy analyzer costs nothing while it passes, so you can keep it in the pipeline without drowning the log.
|
|
69
|
+
|
|
70
|
+
When something does fail, each failing command is printed with its full output:
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
❌ Command failed: npm run typecheck
|
|
74
|
+
src/app.ts(12,7): error TS2322: Type 'string' is not assignable to type 'number'.
|
|
75
|
+
|
|
76
|
+
❌ codesweep check failed (8.21s)
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Every command still runs to completion, so one run surfaces every error at once — quiet mode changes what is printed, never what is executed.
|
|
80
|
+
|
|
81
|
+
A dedicated CI mode pairs well with it:
|
|
82
|
+
|
|
83
|
+
```yaml
|
|
84
|
+
check:
|
|
85
|
+
- parallel:
|
|
86
|
+
- npm run lint
|
|
87
|
+
- npm run typecheck
|
|
88
|
+
|
|
89
|
+
check-ci:
|
|
90
|
+
- parallel:
|
|
91
|
+
- npm run lint
|
|
92
|
+
- npm run typecheck
|
|
93
|
+
- npm run test
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
codesweep check-ci --quiet
|
|
98
|
+
```
|
|
99
|
+
|
|
57
100
|
## Library usage
|
|
58
101
|
|
|
59
|
-
codesweep can also be called programmatically: `import { codesweep } from "@tzwzx/codesweep"` and `await codesweep("check")` (optionally passing a config path as the second argument).
|
|
102
|
+
codesweep can also be called programmatically: `import { codesweep } from "@tzwzx/codesweep"` and `await codesweep("check")` (optionally passing a config path as the second argument, and `{ quiet: true }` as the third).
|
|
60
103
|
|
|
61
104
|
## Config: `codesweep.yml`
|
|
62
105
|
|
package/dist/cli.d.ts
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
* codesweep check # Run quality checks
|
|
11
11
|
* codesweep fix # Auto-fix then check
|
|
12
12
|
* codesweep check --config ./custom.yml # Use custom config file
|
|
13
|
+
* codesweep check --quiet # Print only what failed
|
|
13
14
|
*/
|
|
14
15
|
/**
|
|
15
16
|
* True when the entry path refers to the module at moduleUrl.
|
|
@@ -21,6 +22,7 @@ export interface CliArgs {
|
|
|
21
22
|
config?: string;
|
|
22
23
|
help: boolean;
|
|
23
24
|
mode?: string;
|
|
25
|
+
quiet: boolean;
|
|
24
26
|
}
|
|
25
27
|
/** Parse argv into structured CLI args. Throws on invalid option syntax. */
|
|
26
28
|
export declare const parseCliArgs: (argv: readonly string[]) => CliArgs;
|
package/dist/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;;;GAYG;AAUH;;;;GAIG;AACH,eAAO,MAAM,YAAY,UAAW,MAAM,GAAG,SAAS,aAAa,MAAM,KAAG,OAS3E,CAAC;AAmBF,MAAM,WAAW,OAAO;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,OAAO,CAAC;CAChB;AAED,4EAA4E;AAC5E,eAAO,MAAM,YAAY,SAAU,SAAS,MAAM,EAAE,KAAG,OAiBtD,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,MAAM,SAAgB,OAAO,KAAG,OAAO,CAAC,MAAM,CA0B1D,CAAC"}
|
package/dist/cli.js
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
* codesweep check # Run quality checks
|
|
11
11
|
* codesweep fix # Auto-fix then check
|
|
12
12
|
* codesweep check --config ./custom.yml # Use custom config file
|
|
13
|
+
* codesweep check --quiet # Print only what failed
|
|
13
14
|
*/
|
|
14
15
|
import { realpathSync } from "node:fs";
|
|
15
16
|
import process from "node:process";
|
|
@@ -46,6 +47,7 @@ Commands:
|
|
|
46
47
|
|
|
47
48
|
Options:
|
|
48
49
|
--config, -c <path> Path to the config file (default: ./codesweep.yml)
|
|
50
|
+
--quiet, -q Print only what failed; a passing run prints nothing
|
|
49
51
|
--help, -h Show help
|
|
50
52
|
`;
|
|
51
53
|
/** Parse argv into structured CLI args. Throws on invalid option syntax. */
|
|
@@ -56,12 +58,14 @@ export const parseCliArgs = (argv) => {
|
|
|
56
58
|
options: {
|
|
57
59
|
config: { short: "c", type: "string" },
|
|
58
60
|
help: { short: "h", type: "boolean" },
|
|
61
|
+
quiet: { short: "q", type: "boolean" },
|
|
59
62
|
},
|
|
60
63
|
});
|
|
61
64
|
return {
|
|
62
65
|
config: values.config,
|
|
63
66
|
help: values.help === true,
|
|
64
67
|
mode: positionals[0],
|
|
68
|
+
quiet: values.quiet === true,
|
|
65
69
|
};
|
|
66
70
|
};
|
|
67
71
|
/**
|
|
@@ -84,7 +88,7 @@ export const runCli = async (args) => {
|
|
|
84
88
|
console.log(`Created ${createdPath}`);
|
|
85
89
|
}
|
|
86
90
|
else {
|
|
87
|
-
await codesweep(args.mode, args.config);
|
|
91
|
+
await codesweep(args.mode, args.config, { quiet: args.quiet });
|
|
88
92
|
}
|
|
89
93
|
return 0;
|
|
90
94
|
}
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,OAAO,EAAE,SAAS,EAAE,MAA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AC,CAAC,CAAC;QACtE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,OAAO,CAAC,IAAI,CAAC,MAAM,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;AACnC,CAAC,CAAC;AAEF,kFAAkF;AAClF,wEAAwE;AACxE,uEAAuE;AACvE,IAAI,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,OAAO,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;IACnD,IAAI,CAAC;QACH,MAAM,IAAI,EAAE,CAAC;IACf,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QACtE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Mode } from "./types.js";
|
|
2
|
-
export type { CodesweepConfig, Stage, ParallelStage, SequentialStage, Mode } from "./types.js";
|
|
1
|
+
import type { Mode, RunOptions } from "./types.js";
|
|
2
|
+
export type { CodesweepConfig, Stage, ParallelStage, SequentialStage, Mode, RunOptions, } from "./types.js";
|
|
3
3
|
export { isParallelStage, isSequentialStage, loadConfig } from "./config.js";
|
|
4
4
|
export { initConfig } from "./init.js";
|
|
5
5
|
export { runParallel, runSequential } from "./runner.js";
|
|
@@ -11,7 +11,9 @@ export { runParallel, runSequential } from "./runner.js";
|
|
|
11
11
|
*
|
|
12
12
|
* @param mode - Mode name to run (must be defined in the config file).
|
|
13
13
|
* @param configPath - Path to the config file (default: `./codesweep.yml`).
|
|
14
|
+
* @param options - Run options. With `quiet`, output from commands that pass is
|
|
15
|
+
* discarded and a fully successful run prints nothing.
|
|
14
16
|
* @throws {Error} If the mode is undefined, or any command in the pipeline fails.
|
|
15
17
|
*/
|
|
16
|
-
export declare const codesweep: (mode: Mode, configPath?: string) => Promise<void>;
|
|
18
|
+
export declare const codesweep: (mode: Mode, configPath?: string, options?: RunOptions) => Promise<void>;
|
|
17
19
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAS,IAAI,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAS,IAAI,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE1D,YAAY,EACV,eAAe,EACf,KAAK,EACL,aAAa,EACb,eAAe,EACf,IAAI,EACJ,UAAU,GACX,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC7E,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAoBzD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,SAAS,SACd,IAAI,eACG,MAAM,YACV,UAAU,KAClB,OAAO,CAAC,IAAI,CAwBd,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -6,12 +6,14 @@ export { initConfig } from "./init.js";
|
|
|
6
6
|
export { runParallel, runSequential } from "./runner.js";
|
|
7
7
|
const MILLISECONDS_PER_SECOND = 1000;
|
|
8
8
|
const formatDuration = (startTime) => ((performance.now() - startTime) / MILLISECONDS_PER_SECOND).toFixed(2);
|
|
9
|
-
const runStage = (stage) => isParallelStage(stage)
|
|
10
|
-
|
|
9
|
+
const runStage = (stage, options) => isParallelStage(stage)
|
|
10
|
+
? runParallel(stage.parallel, options)
|
|
11
|
+
: runSequential(stage.sequential, options);
|
|
12
|
+
const runPipeline = async (stages, options) => {
|
|
11
13
|
for (const stage of stages) {
|
|
12
14
|
// Stages run serially by design ("serial between stages"); parallelizing would break the contract.
|
|
13
15
|
// oxlint-disable-next-line no-await-in-loop
|
|
14
|
-
await runStage(stage);
|
|
16
|
+
await runStage(stage, options);
|
|
15
17
|
}
|
|
16
18
|
};
|
|
17
19
|
/**
|
|
@@ -22,9 +24,11 @@ const runPipeline = async (stages) => {
|
|
|
22
24
|
*
|
|
23
25
|
* @param mode - Mode name to run (must be defined in the config file).
|
|
24
26
|
* @param configPath - Path to the config file (default: `./codesweep.yml`).
|
|
27
|
+
* @param options - Run options. With `quiet`, output from commands that pass is
|
|
28
|
+
* discarded and a fully successful run prints nothing.
|
|
25
29
|
* @throws {Error} If the mode is undefined, or any command in the pipeline fails.
|
|
26
30
|
*/
|
|
27
|
-
export const codesweep = async (mode, configPath) => {
|
|
31
|
+
export const codesweep = async (mode, configPath, options = {}) => {
|
|
28
32
|
const config = loadConfig(configPath);
|
|
29
33
|
const stages = config[mode];
|
|
30
34
|
if (!stages) {
|
|
@@ -33,9 +37,11 @@ export const codesweep = async (mode, configPath) => {
|
|
|
33
37
|
}
|
|
34
38
|
const startTime = performance.now();
|
|
35
39
|
try {
|
|
36
|
-
await runPipeline(stages);
|
|
40
|
+
await runPipeline(stages, options);
|
|
37
41
|
const duration = formatDuration(startTime);
|
|
38
|
-
|
|
42
|
+
if (!options.quiet) {
|
|
43
|
+
console.log(`\n✅ codesweep ${mode} passed (${duration}s)\n`);
|
|
44
|
+
}
|
|
39
45
|
}
|
|
40
46
|
catch (error) {
|
|
41
47
|
const duration = formatDuration(startTime);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AA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;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,KAAK,EAC5B,IAAU,EACV,UAAmB,EACnB,OAAO,GAAe,EAAE,EACT,EAAE;IACjB,MAAM,MAAM,GAAG,UAAU,CAAC,UAAU,CAAC,CAAC;IACtC,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;IAE5B,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,cAAc,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACtD,MAAM,IAAI,KAAK,CACb,SAAS,IAAI,mDAAmD,cAAc,GAAG,CAClF,CAAC;IACJ,CAAC;IAED,MAAM,SAAS,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC;IAEpC,IAAI,CAAC;QACH,MAAM,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACnC,MAAM,QAAQ,GAAG,cAAc,CAAC,SAAS,CAAC,CAAC;QAC3C,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;YACnB,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,YAAY,QAAQ,MAAM,CAAC,CAAC;QAC/D,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,QAAQ,GAAG,cAAc,CAAC,SAAS,CAAC,CAAC;QAC3C,OAAO,CAAC,KAAK,CAAC,iBAAiB,IAAI,YAAY,QAAQ,MAAM,CAAC,CAAC;QAC/D,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC,CAAC"}
|
package/dist/runner.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
+
import type { RunOptions } from "./types.js";
|
|
1
2
|
/**
|
|
2
3
|
* Run commands sequentially (continues on failure).
|
|
3
4
|
* All commands run even if one fails; errors are collected and thrown at the end.
|
|
4
5
|
*/
|
|
5
|
-
export declare const runSequential: (commands: readonly string[]) => Promise<void>;
|
|
6
|
+
export declare const runSequential: (commands: readonly string[], options?: RunOptions) => Promise<void>;
|
|
6
7
|
/**
|
|
7
8
|
* Run commands in parallel (continues on failure).
|
|
8
9
|
* All commands run even if one fails; the error is thrown after all complete.
|
|
9
10
|
*/
|
|
10
|
-
export declare const runParallel: (commands: readonly string[]) => Promise<void>;
|
|
11
|
+
export declare const runParallel: (commands: readonly string[], options?: RunOptions) => Promise<void>;
|
|
11
12
|
//# sourceMappingURL=runner.d.ts.map
|
package/dist/runner.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../src/runner.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../src/runner.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AA+B7C;;;GAGG;AACH,eAAO,MAAM,aAAa,aACd,SAAS,MAAM,EAAE,YAClB,UAAU,KAClB,OAAO,CAAC,IAAI,CAsBd,CAAC;AAwBF;;;GAGG;AACH,eAAO,MAAM,WAAW,aACZ,SAAS,MAAM,EAAE,YAClB,UAAU,KAClB,OAAO,CAAC,IAAI,CAmBd,CAAC"}
|
package/dist/runner.js
CHANGED
|
@@ -2,7 +2,11 @@ import { exec } from "node:child_process";
|
|
|
2
2
|
import { promisify } from "node:util";
|
|
3
3
|
import concurrently from "concurrently";
|
|
4
4
|
const execPromise = promisify(exec);
|
|
5
|
-
|
|
5
|
+
// Quiet mode buffers everything a command prints, and analyzers can emit
|
|
6
|
+
// hundreds of kilobytes on a healthy project. Keep the ceiling well above
|
|
7
|
+
// Node's 1 MB default; overflowing it would report a passing command as failed.
|
|
8
|
+
const MAX_BUFFER = 32 * 1024 * 1024;
|
|
9
|
+
const printCommandOutput = ({ stdout, stderr }) => {
|
|
6
10
|
if (stdout) {
|
|
7
11
|
console.log(stdout);
|
|
8
12
|
}
|
|
@@ -10,27 +14,29 @@ const printCommandOutput = (stdout, stderr) => {
|
|
|
10
14
|
console.error(stderr);
|
|
11
15
|
}
|
|
12
16
|
};
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
printCommandOutput(
|
|
17
|
+
const reportFailure = (command, output) => {
|
|
18
|
+
console.error(`❌ Command failed: ${command}`);
|
|
19
|
+
printCommandOutput(output);
|
|
16
20
|
};
|
|
21
|
+
const runCommand = (command) => execPromise(command, { maxBuffer: MAX_BUFFER });
|
|
17
22
|
/**
|
|
18
23
|
* Run commands sequentially (continues on failure).
|
|
19
24
|
* All commands run even if one fails; errors are collected and thrown at the end.
|
|
20
25
|
*/
|
|
21
|
-
export const runSequential = async (commands) => {
|
|
26
|
+
export const runSequential = async (commands, options = {}) => {
|
|
22
27
|
const errors = [];
|
|
23
28
|
for (const command of commands) {
|
|
24
29
|
try {
|
|
25
30
|
// Commands run one-by-one by design (sequential stage); parallelizing would defeat the purpose.
|
|
26
31
|
// oxlint-disable-next-line no-await-in-loop
|
|
27
|
-
await
|
|
32
|
+
const output = await runCommand(command);
|
|
33
|
+
if (!options.quiet) {
|
|
34
|
+
printCommandOutput(output);
|
|
35
|
+
}
|
|
28
36
|
}
|
|
29
37
|
catch (error) {
|
|
30
|
-
const { stdout, stderr } = error;
|
|
31
38
|
const message = error instanceof Error ? error.message : String(error);
|
|
32
|
-
|
|
33
|
-
printCommandOutput(stdout, stderr);
|
|
39
|
+
reportFailure(command, error);
|
|
34
40
|
errors.push({ command, message });
|
|
35
41
|
}
|
|
36
42
|
}
|
|
@@ -39,11 +45,30 @@ export const runSequential = async (commands) => {
|
|
|
39
45
|
throw new Error(`Sequential execution failed:\n${errorMessages}`);
|
|
40
46
|
}
|
|
41
47
|
};
|
|
48
|
+
/**
|
|
49
|
+
* Run commands in parallel with their output buffered, printing only the ones
|
|
50
|
+
* that failed. Every command still runs to completion, so a single run surfaces
|
|
51
|
+
* every error at once.
|
|
52
|
+
*/
|
|
53
|
+
const runParallelQuiet = async (commands) => {
|
|
54
|
+
const results = await Promise.allSettled(commands.map((command) => runCommand(command)));
|
|
55
|
+
const failures = results.flatMap((result, index) => result.status === "rejected" ? [{ command: commands[index] ?? "", error: result.reason }] : []);
|
|
56
|
+
for (const { command, error } of failures) {
|
|
57
|
+
reportFailure(command, error);
|
|
58
|
+
}
|
|
59
|
+
if (failures.length > 0) {
|
|
60
|
+
const failed = failures.map((failure) => failure.command).join("\n");
|
|
61
|
+
throw new Error(`Parallel execution failed:\n${failed}`);
|
|
62
|
+
}
|
|
63
|
+
};
|
|
42
64
|
/**
|
|
43
65
|
* Run commands in parallel (continues on failure).
|
|
44
66
|
* All commands run even if one fails; the error is thrown after all complete.
|
|
45
67
|
*/
|
|
46
|
-
export const runParallel = async (commands) => {
|
|
68
|
+
export const runParallel = async (commands, options = {}) => {
|
|
69
|
+
if (options.quiet) {
|
|
70
|
+
return runParallelQuiet(commands);
|
|
71
|
+
}
|
|
47
72
|
const commandObjects = commands.map((command) => ({ command }));
|
|
48
73
|
const { result } = concurrently(commandObjects, {
|
|
49
74
|
group: true,
|
package/dist/runner.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runner.js","sourceRoot":"","sources":["../src/runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,OAAO,YAAY,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"runner.js","sourceRoot":"","sources":["../src/runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,OAAO,YAAY,MAAM,cAAc,CAAC;AAIxC,MAAM,WAAW,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;AAEpC,yEAAyE;AACzE,0EAA0E;AAC1E,gFAAgF;AAChF,MAAM,UAA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AAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACrE,MAAM,IAAI,KAAK,CAAC,+BAA+B,MAAM,EAAE,CAAC,CAAC;IAC3D,CAAC;AACH,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,KAAK,EAC9B,QAA2B,EAC3B,OAAO,GAAe,EAAE,EACT,EAAE;IACjB,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;QAClB,OAAO,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IACpC,CAAC;IAED,MAAM,cAAc,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;IAEhE,MAAM,EAAE,MAAM,EAAE,GAAG,YAAY,CAAC,cAAc,EAAE;QAC9C,KAAK,EAAE,IAAI;QACX,YAAY,EAAE,EAAE;QAChB,MAAM,EAAE,MAAM;KACf,CAAC,CAAC;IAEH,IAAI,CAAC;QACH,MAAM,MAAM,CAAC;IACf,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC;QACzE,MAAM,IAAI,KAAK,CAAC,8BAA8B,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;IAC7E,CAAC;AACH,CAAC,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -12,4 +12,13 @@ export type Stage = ParallelStage | SequentialStage;
|
|
|
12
12
|
export type Mode = string;
|
|
13
13
|
/** Pipeline configuration (key = mode name, value = stages) */
|
|
14
14
|
export type CodesweepConfig = Record<string, Stage[]>;
|
|
15
|
+
/** Options controlling how a pipeline is run */
|
|
16
|
+
export interface RunOptions {
|
|
17
|
+
/**
|
|
18
|
+
* Buffer command output and print only what failed.
|
|
19
|
+
* A run where everything passes produces no output at all, which keeps CI
|
|
20
|
+
* logs to just the problems.
|
|
21
|
+
*/
|
|
22
|
+
quiet?: boolean;
|
|
23
|
+
}
|
|
15
24
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,iCAAiC;AACjC,MAAM,WAAW,eAAe;IAC9B,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB;AAED,+CAA+C;AAC/C,MAAM,MAAM,KAAK,GAAG,aAAa,GAAG,eAAe,CAAC;AAEpD,4CAA4C;AAC5C,MAAM,MAAM,IAAI,GAAG,MAAM,CAAC;AAE1B,+DAA+D;AAC/D,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,iCAAiC;AACjC,MAAM,WAAW,eAAe;IAC9B,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB;AAED,+CAA+C;AAC/C,MAAM,MAAM,KAAK,GAAG,aAAa,GAAG,eAAe,CAAC;AAEpD,4CAA4C;AAC5C,MAAM,MAAM,IAAI,GAAG,MAAM,CAAC;AAE1B,+DAA+D;AAC/D,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;AAEtD,gDAAgD;AAChD,MAAM,WAAW,UAAU;IACzB;;;;OAIG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB"}
|