bun-workspaces 1.0.0-alpha.37 → 1.0.0-alpha.39
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 +33 -0
- package/package.json +1 -1
- package/src/cli/commands/commandHandlerUtils.mjs +2 -2
- package/src/cli/commands/commandsConfig.d.ts +40 -2
- package/src/cli/commands/commandsConfig.mjs +26 -2
- package/src/cli/commands/runScript/handleRunScript.mjs +93 -15
- package/src/cli/commands/runScript/index.d.ts +1 -1
- package/src/cli/commands/runScript/index.mjs +1 -1
- package/src/cli/commands/runScript/output/index.d.ts +1 -0
- package/src/cli/commands/runScript/output/index.mjs +1 -0
- package/src/cli/commands/runScript/output/outputStyle.d.ts +8 -0
- package/src/cli/commands/runScript/output/outputStyle.mjs +17 -0
- package/src/cli/commands/runScript/output/renderGroupedOutput.d.ts +71 -0
- package/src/cli/commands/runScript/output/renderGroupedOutput.mjs +289 -0
- package/src/cli/commands/runScript/output/renderPlainOutput.d.ts +22 -0
- package/src/cli/commands/runScript/output/renderPlainOutput.mjs +43 -0
- package/src/cli/commands/runScript/output/sanitizeChunk.d.ts +4 -0
- package/src/cli/commands/runScript/output/sanitizeChunk.mjs +101 -0
- package/src/index.d.ts +3 -0
- package/src/internal/core/language/events/typedEventTarget.d.ts +50 -0
- package/src/internal/core/language/events/typedEventTarget.mjs +14 -0
- package/src/internal/core/language/string/utf/eastAsianWidth.d.ts +16 -0
- package/src/internal/core/language/string/utf/eastAsianWidth.mjs +326 -0
- package/src/internal/core/language/string/utf/visibleLength.d.ts +5 -0
- package/src/internal/core/language/string/utf/visibleLength.mjs +29 -0
- package/src/internal/core/runtime/env.d.ts +1 -0
- package/src/internal/core/runtime/env.mjs +8 -1
- package/src/internal/core/runtime/index.d.ts +1 -0
- package/src/internal/core/runtime/index.mjs +2 -1
- package/src/internal/core/runtime/onExit.d.ts +4 -6
- package/src/internal/core/runtime/onExit.mjs +44 -14
- package/src/internal/core/runtime/terminal.d.ts +1 -0
- package/src/internal/core/runtime/terminal.mjs +4 -0
- package/src/project/implementations/fileSystemProject.d.ts +19 -0
- package/src/project/implementations/fileSystemProject.mjs +27 -1
- package/src/runScript/runScript.d.ts +5 -0
- package/src/runScript/runScript.mjs +44 -14
- package/src/runScript/runScripts.d.ts +21 -0
- package/src/runScript/runScripts.mjs +147 -29
- package/src/runScript/subprocesses.d.ts +11 -0
- package/src/runScript/subprocesses.mjs +34 -0
- package/src/workspaces/dependencyGraph/cycles.mjs +17 -11
- package/src/cli/commands/runScript/formatRunScriptOutput.d.ts +0 -18
- package/src/cli/commands/runScript/formatRunScriptOutput.mjs +0 -120
package/README.md
CHANGED
|
@@ -67,6 +67,13 @@ bw run lint my-alias-a my-alias-b # Run by alias (set by optional config)
|
|
|
67
67
|
bw run lint "my-workspace-*" # Run for matching workspace names
|
|
68
68
|
bw run lint "alias:my-alias-pattern-*" "path:my-glob/**/*" # Use matching specifiers
|
|
69
69
|
|
|
70
|
+
# A workspace's script will wait until any workspaces it depends on have completed
|
|
71
|
+
# Similar to Bun's --filter behavior
|
|
72
|
+
bw run lint --dep-order
|
|
73
|
+
|
|
74
|
+
# Continue running scripts even if a dependency fails
|
|
75
|
+
bw run lint --dep-order --ignore-dep-failure
|
|
76
|
+
|
|
70
77
|
bw run lint --args="--my-appended-args" # Add args to each script call
|
|
71
78
|
bw run lint --args="--my-arg=<workspaceName>" # Use the workspace name in args
|
|
72
79
|
|
|
@@ -75,6 +82,19 @@ bw run "bun build" --inline # Run an inline command via the Bun shell
|
|
|
75
82
|
bw run lint --parallel # Run in parallel (default: "auto", the available CPU count)
|
|
76
83
|
bw run lint --parallel=2 # Run in parallel with a max of 2 concurrent scripts
|
|
77
84
|
|
|
85
|
+
# Use the grouped output style (default when on a TTY)
|
|
86
|
+
bw run my-script --output-style=grouped
|
|
87
|
+
|
|
88
|
+
# Set the max preview lines for script output in grouped output style
|
|
89
|
+
bw run my-script --output-style=grouped --grouped-lines=all
|
|
90
|
+
bw run my-script --output-style=grouped --grouped-lines=10
|
|
91
|
+
|
|
92
|
+
# Use simple script output with workspace prefixes (default when not on a TTY)
|
|
93
|
+
bw run my-script --output-style=prefixed
|
|
94
|
+
|
|
95
|
+
# Use the plain output style (no workspace prefixes)
|
|
96
|
+
bw run my-script --output-style=plain
|
|
97
|
+
|
|
78
98
|
# Show usage (you can pass --help to any command)
|
|
79
99
|
bw help
|
|
80
100
|
bw --help
|
|
@@ -154,6 +174,19 @@ const runManyScripts = async () => {
|
|
|
154
174
|
|
|
155
175
|
// Optional. Whether to run the scripts in parallel
|
|
156
176
|
parallel: true,
|
|
177
|
+
|
|
178
|
+
// Optional. When true, a workspace's script will wait
|
|
179
|
+
// until any workspaces it depends on have completed
|
|
180
|
+
dependencyOrder: false,
|
|
181
|
+
|
|
182
|
+
// Optional. When true and dependencyOrder is true,
|
|
183
|
+
// continue running scripts even if a dependency fails
|
|
184
|
+
ignoreDependencyFailure: false,
|
|
185
|
+
|
|
186
|
+
// Optional, callback when script starts, skips, or exits
|
|
187
|
+
onScriptEvent: (event, { workspace, exitResult }) => {
|
|
188
|
+
// event: "start", "skip", "exit"
|
|
189
|
+
},
|
|
157
190
|
});
|
|
158
191
|
|
|
159
192
|
// Get a stream of script output
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Option } from "commander";
|
|
2
|
-
import { BunWorkspacesError } from "../../internal/core/index.mjs";
|
|
2
|
+
import { BunWorkspacesError } from "../../internal/core/error/index.mjs";
|
|
3
3
|
import { createLogger, logger } from "../../internal/logger/index.mjs";
|
|
4
4
|
import { getCliCommandConfig } from "./commandsConfig.mjs"; // CONCATENATED MODULE: external "commander"
|
|
5
|
-
// CONCATENATED MODULE: external "../../internal/core/index.mjs"
|
|
5
|
+
// CONCATENATED MODULE: external "../../internal/core/error/index.mjs"
|
|
6
6
|
// CONCATENATED MODULE: external "../../internal/logger/index.mjs"
|
|
7
7
|
// CONCATENATED MODULE: external "./commandsConfig.mjs"
|
|
8
8
|
// CONCATENATED MODULE: ./src/cli/commands/commandHandlerUtils.ts
|
|
@@ -9,6 +9,7 @@ export interface CliCommandConfig {
|
|
|
9
9
|
flags: string[] | readonly string[];
|
|
10
10
|
description: string;
|
|
11
11
|
values?: string[];
|
|
12
|
+
deprecated?: boolean;
|
|
12
13
|
}
|
|
13
14
|
>;
|
|
14
15
|
}
|
|
@@ -25,6 +26,7 @@ export type CliProjectCommandName = Exclude<
|
|
|
25
26
|
CliGlobalCommandName
|
|
26
27
|
>;
|
|
27
28
|
export declare const JSON_FLAGS: readonly ["-j", "--json"];
|
|
29
|
+
export declare const DEFAULT_GROUPED_LINES = 20;
|
|
28
30
|
export declare const CLI_COMMANDS_CONFIG: {
|
|
29
31
|
readonly doctor: {
|
|
30
32
|
readonly command: "doctor";
|
|
@@ -144,9 +146,19 @@ export declare const CLI_COMMANDS_CONFIG: {
|
|
|
144
146
|
readonly flags: ["-a", "--args <args>"];
|
|
145
147
|
readonly description: "Args to append to the script command";
|
|
146
148
|
};
|
|
149
|
+
readonly outputStyle: {
|
|
150
|
+
readonly flags: ["-o", "--output-style <style>"];
|
|
151
|
+
readonly description: "The output style to use";
|
|
152
|
+
readonly values: ["grouped", "prefixed", "plain"];
|
|
153
|
+
};
|
|
154
|
+
readonly groupedLines: {
|
|
155
|
+
readonly flags: ["-L", "--grouped-lines <count>"];
|
|
156
|
+
readonly description: 'With "grouped" output, the max preview lines (number or "all", default 20)';
|
|
157
|
+
};
|
|
147
158
|
readonly noPrefix: {
|
|
148
159
|
readonly flags: ["-N", "--no-prefix"];
|
|
149
|
-
readonly description: "
|
|
160
|
+
readonly description: "(DEPRECATED) Use --output-style=plain instead";
|
|
161
|
+
readonly deprecated: true;
|
|
150
162
|
};
|
|
151
163
|
readonly inline: {
|
|
152
164
|
readonly flags: ["-i", "--inline"];
|
|
@@ -161,6 +173,14 @@ export declare const CLI_COMMANDS_CONFIG: {
|
|
|
161
173
|
readonly values: ["bun", "system", "default"];
|
|
162
174
|
readonly description: "When using --inline, the shell to use to run the script";
|
|
163
175
|
};
|
|
176
|
+
readonly depOrder: {
|
|
177
|
+
readonly flags: ["-d", "--dep-order"];
|
|
178
|
+
readonly description: "Scripts for dependent workspaces run only after their dependencies";
|
|
179
|
+
};
|
|
180
|
+
readonly ignoreDepFailure: {
|
|
181
|
+
readonly flags: ["-f", "--ignore-dep-failure"];
|
|
182
|
+
readonly description: "In dependency order, continue running scripts even if a dependency fails";
|
|
183
|
+
};
|
|
164
184
|
readonly jsonOutfile: {
|
|
165
185
|
readonly flags: ["-j", "--json-outfile <file>"];
|
|
166
186
|
readonly description: "Output results in a JSON file";
|
|
@@ -287,9 +307,19 @@ export declare const getCliCommandConfig: (commandName: CliCommandName) =>
|
|
|
287
307
|
readonly flags: ["-a", "--args <args>"];
|
|
288
308
|
readonly description: "Args to append to the script command";
|
|
289
309
|
};
|
|
310
|
+
readonly outputStyle: {
|
|
311
|
+
readonly flags: ["-o", "--output-style <style>"];
|
|
312
|
+
readonly description: "The output style to use";
|
|
313
|
+
readonly values: ["grouped", "prefixed", "plain"];
|
|
314
|
+
};
|
|
315
|
+
readonly groupedLines: {
|
|
316
|
+
readonly flags: ["-L", "--grouped-lines <count>"];
|
|
317
|
+
readonly description: 'With "grouped" output, the max preview lines (number or "all", default 20)';
|
|
318
|
+
};
|
|
290
319
|
readonly noPrefix: {
|
|
291
320
|
readonly flags: ["-N", "--no-prefix"];
|
|
292
|
-
readonly description: "
|
|
321
|
+
readonly description: "(DEPRECATED) Use --output-style=plain instead";
|
|
322
|
+
readonly deprecated: true;
|
|
293
323
|
};
|
|
294
324
|
readonly inline: {
|
|
295
325
|
readonly flags: ["-i", "--inline"];
|
|
@@ -304,6 +334,14 @@ export declare const getCliCommandConfig: (commandName: CliCommandName) =>
|
|
|
304
334
|
readonly values: ["bun", "system", "default"];
|
|
305
335
|
readonly description: "When using --inline, the shell to use to run the script";
|
|
306
336
|
};
|
|
337
|
+
readonly depOrder: {
|
|
338
|
+
readonly flags: ["-d", "--dep-order"];
|
|
339
|
+
readonly description: "Scripts for dependent workspaces run only after their dependencies";
|
|
340
|
+
};
|
|
341
|
+
readonly ignoreDepFailure: {
|
|
342
|
+
readonly flags: ["-f", "--ignore-dep-failure"];
|
|
343
|
+
readonly description: "In dependency order, continue running scripts even if a dependency fails";
|
|
344
|
+
};
|
|
307
345
|
readonly jsonOutfile: {
|
|
308
346
|
readonly flags: ["-j", "--json-outfile <file>"];
|
|
309
347
|
readonly description: "Output results in a JSON file";
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import { SCRIPT_SHELL_OPTIONS } from "../../runScript/scriptShellOption.mjs";
|
|
1
|
+
import { SCRIPT_SHELL_OPTIONS } from "../../runScript/scriptShellOption.mjs";
|
|
2
|
+
import { OUTPUT_STYLE_VALUES } from "./runScript/output/outputStyle.mjs"; // CONCATENATED MODULE: external "../../runScript/scriptShellOption.mjs"
|
|
3
|
+
// CONCATENATED MODULE: external "./runScript/output/outputStyle.mjs"
|
|
2
4
|
// CONCATENATED MODULE: ./src/cli/commands/commandsConfig.ts
|
|
3
5
|
|
|
4
6
|
const JSON_FLAGS = ["-j", "--json"];
|
|
7
|
+
const DEFAULT_GROUPED_LINES = 20;
|
|
5
8
|
const CLI_COMMANDS_CONFIG = {
|
|
6
9
|
doctor: {
|
|
7
10
|
command: "doctor",
|
|
@@ -123,9 +126,19 @@ const CLI_COMMANDS_CONFIG = {
|
|
|
123
126
|
flags: ["-a", "--args <args>"],
|
|
124
127
|
description: "Args to append to the script command",
|
|
125
128
|
},
|
|
129
|
+
outputStyle: {
|
|
130
|
+
flags: ["-o", "--output-style <style>"],
|
|
131
|
+
description: "The output style to use",
|
|
132
|
+
values: [...OUTPUT_STYLE_VALUES],
|
|
133
|
+
},
|
|
134
|
+
groupedLines: {
|
|
135
|
+
flags: ["-L", "--grouped-lines <count>"],
|
|
136
|
+
description: `With "grouped" output, the max preview lines (number or "all", default ${DEFAULT_GROUPED_LINES})`,
|
|
137
|
+
},
|
|
126
138
|
noPrefix: {
|
|
127
139
|
flags: ["-N", "--no-prefix"],
|
|
128
|
-
description: "
|
|
140
|
+
description: "(DEPRECATED) Use --output-style=plain instead",
|
|
141
|
+
deprecated: true,
|
|
129
142
|
},
|
|
130
143
|
inline: {
|
|
131
144
|
flags: ["-i", "--inline"],
|
|
@@ -141,6 +154,16 @@ const CLI_COMMANDS_CONFIG = {
|
|
|
141
154
|
values: [...SCRIPT_SHELL_OPTIONS, "default"],
|
|
142
155
|
description: `When using --inline, the shell to use to run the script`,
|
|
143
156
|
},
|
|
157
|
+
depOrder: {
|
|
158
|
+
flags: ["-d", "--dep-order"],
|
|
159
|
+
description:
|
|
160
|
+
"Scripts for dependent workspaces run only after their dependencies",
|
|
161
|
+
},
|
|
162
|
+
ignoreDepFailure: {
|
|
163
|
+
flags: ["-f", "--ignore-dep-failure"],
|
|
164
|
+
description:
|
|
165
|
+
"In dependency order, continue running scripts even if a dependency fails",
|
|
166
|
+
},
|
|
144
167
|
jsonOutfile: {
|
|
145
168
|
flags: ["-j", "--json-outfile <file>"],
|
|
146
169
|
description: "Output results in a JSON file",
|
|
@@ -153,6 +176,7 @@ const getCliCommandNames = () => Object.keys(CLI_COMMANDS_CONFIG);
|
|
|
153
176
|
|
|
154
177
|
export {
|
|
155
178
|
CLI_COMMANDS_CONFIG,
|
|
179
|
+
DEFAULT_GROUPED_LINES,
|
|
156
180
|
JSON_FLAGS,
|
|
157
181
|
getCliCommandConfig,
|
|
158
182
|
getCliCommandNames,
|
|
@@ -5,11 +5,24 @@ import {
|
|
|
5
5
|
handleProjectCommand,
|
|
6
6
|
splitWorkspacePatterns,
|
|
7
7
|
} from "../commandHandlerUtils.mjs";
|
|
8
|
-
import {
|
|
8
|
+
import { DEFAULT_GROUPED_LINES } from "../commandsConfig.mjs";
|
|
9
|
+
import {
|
|
10
|
+
getDefaultOutputStyle,
|
|
11
|
+
validateOutputStyle,
|
|
12
|
+
} from "./output/outputStyle.mjs";
|
|
13
|
+
import {
|
|
14
|
+
createScriptEvent,
|
|
15
|
+
createScriptEventTarget,
|
|
16
|
+
renderGroupedOutput,
|
|
17
|
+
} from "./output/renderGroupedOutput.mjs";
|
|
18
|
+
import { renderPlainOutput } from "./output/renderPlainOutput.mjs"; // CONCATENATED MODULE: external "fs"
|
|
9
19
|
// CONCATENATED MODULE: external "path"
|
|
10
20
|
// CONCATENATED MODULE: external "../../../internal/logger/index.mjs"
|
|
11
21
|
// CONCATENATED MODULE: external "../commandHandlerUtils.mjs"
|
|
12
|
-
// CONCATENATED MODULE: external "
|
|
22
|
+
// CONCATENATED MODULE: external "../commandsConfig.mjs"
|
|
23
|
+
// CONCATENATED MODULE: external "./output/outputStyle.mjs"
|
|
24
|
+
// CONCATENATED MODULE: external "./output/renderGroupedOutput.mjs"
|
|
25
|
+
// CONCATENATED MODULE: external "./output/renderPlainOutput.mjs"
|
|
13
26
|
// CONCATENATED MODULE: ./src/cli/commands/runScript/handleRunScript.ts
|
|
14
27
|
|
|
15
28
|
const runScript = handleProjectCommand(
|
|
@@ -53,6 +66,12 @@ const runScript = handleProjectCommand(
|
|
|
53
66
|
logger.debug(
|
|
54
67
|
`Command: Run script ${JSON.stringify(script)} for ${workspacePatterns.length ? "workspaces " + workspacePatterns.join(", ") : "all workspaces"} (parallel: ${!!options.parallel}, args: ${JSON.stringify(scriptArgs)})`,
|
|
55
68
|
);
|
|
69
|
+
const workspaces = workspacePatterns.length
|
|
70
|
+
? project.findWorkspacesByPattern(...workspacePatterns)
|
|
71
|
+
: options.inline
|
|
72
|
+
? project.workspaces
|
|
73
|
+
: project.listWorkspacesWithScript(script);
|
|
74
|
+
const scriptEventTarget = createScriptEventTarget();
|
|
56
75
|
const { output, summary } = project.runScriptAcrossWorkspaces({
|
|
57
76
|
workspacePatterns: workspacePatterns.length
|
|
58
77
|
? workspacePatterns
|
|
@@ -67,6 +86,17 @@ const runScript = handleProjectCommand(
|
|
|
67
86
|
: true
|
|
68
87
|
: undefined,
|
|
69
88
|
args: scriptArgs,
|
|
89
|
+
dependencyOrder: options.depOrder,
|
|
90
|
+
ignoreDependencyFailure: options.ignoreDepFailure,
|
|
91
|
+
ignoreOutput: logger.printLevel === "silent",
|
|
92
|
+
onScriptEvent: (event, { workspace, exitResult }) => {
|
|
93
|
+
scriptEventTarget.dispatchEvent(
|
|
94
|
+
createScriptEvent[event]({
|
|
95
|
+
workspace,
|
|
96
|
+
exitResult,
|
|
97
|
+
}),
|
|
98
|
+
);
|
|
99
|
+
},
|
|
70
100
|
parallel:
|
|
71
101
|
typeof options.parallel === "boolean" ||
|
|
72
102
|
typeof options.parallel === "undefined"
|
|
@@ -82,31 +112,77 @@ const runScript = handleProjectCommand(
|
|
|
82
112
|
const scriptName = options.inline
|
|
83
113
|
? options.inlineName || "(inline)"
|
|
84
114
|
: script;
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}
|
|
91
|
-
|
|
115
|
+
const stripDisruptiveControls = workspaces.length > 1 || !!options.parallel;
|
|
116
|
+
let groupedLines = DEFAULT_GROUPED_LINES;
|
|
117
|
+
if (options.groupedLines) {
|
|
118
|
+
if (options.groupedLines === "all") {
|
|
119
|
+
groupedLines = "all";
|
|
120
|
+
} else {
|
|
121
|
+
const parsedGroupedLines = parseInt(options.groupedLines);
|
|
122
|
+
if (parsedGroupedLines <= 0 || isNaN(parsedGroupedLines)) {
|
|
123
|
+
logger.error(
|
|
124
|
+
`Invalid max grouped lines value: ${options.groupedLines}. Must be a positive number or "all".`,
|
|
125
|
+
);
|
|
126
|
+
process.exit(1);
|
|
127
|
+
}
|
|
128
|
+
groupedLines = parsedGroupedLines;
|
|
92
129
|
}
|
|
130
|
+
}
|
|
131
|
+
if (!options.prefix) {
|
|
132
|
+
logger.warn(
|
|
133
|
+
"--no-prefix is deprecated and will be removed in a future version. Use --output-style=plain instead.",
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
const outputStyleHandlers = {
|
|
137
|
+
grouped: () =>
|
|
138
|
+
renderGroupedOutput(
|
|
139
|
+
workspaces,
|
|
140
|
+
output,
|
|
141
|
+
summary,
|
|
142
|
+
scriptEventTarget,
|
|
143
|
+
groupedLines,
|
|
144
|
+
),
|
|
145
|
+
prefixed: () =>
|
|
146
|
+
renderPlainOutput(output, {
|
|
147
|
+
prefix: true,
|
|
148
|
+
stripDisruptiveControls,
|
|
149
|
+
}),
|
|
150
|
+
plain: () =>
|
|
151
|
+
renderPlainOutput(output, {
|
|
152
|
+
prefix: false,
|
|
153
|
+
stripDisruptiveControls,
|
|
154
|
+
}),
|
|
93
155
|
};
|
|
94
|
-
|
|
156
|
+
const outputStyle = options.outputStyle
|
|
157
|
+
? validateOutputStyle(options.outputStyle)
|
|
158
|
+
: getDefaultOutputStyle();
|
|
159
|
+
await outputStyleHandlers[outputStyle]();
|
|
95
160
|
const exitResults = await summary;
|
|
96
161
|
exitResults.scriptResults.forEach(
|
|
97
162
|
({ success, metadata: { workspace }, exitCode }) => {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
163
|
+
const isSkipped = exitCode === -1;
|
|
164
|
+
if (isSkipped) {
|
|
165
|
+
logger.info(
|
|
166
|
+
`➖ ${workspace.name}: ${scriptName} (skipped due to dependency failure)`,
|
|
167
|
+
);
|
|
168
|
+
} else {
|
|
169
|
+
logger.info(
|
|
170
|
+
`${success ? "✅" : "❌"} ${workspace.name}: ${scriptName}${exitCode ? ` (exited with code ${exitCode})` : ""}`,
|
|
171
|
+
);
|
|
172
|
+
}
|
|
101
173
|
},
|
|
102
174
|
);
|
|
103
175
|
const s = exitResults.scriptResults.length === 1 ? "" : "s";
|
|
176
|
+
const skippedCount = exitResults.scriptResults.filter(
|
|
177
|
+
({ exitCode }) => exitCode === -1,
|
|
178
|
+
).length;
|
|
179
|
+
const skippedMessage = skippedCount ? ` (${skippedCount} skipped)` : "";
|
|
104
180
|
if (exitResults.failureCount) {
|
|
105
|
-
const message = `${exitResults.failureCount} of ${exitResults.scriptResults.length} script${s} failed`;
|
|
181
|
+
const message = `${exitResults.failureCount} of ${exitResults.scriptResults.length} script${s} failed${skippedMessage}`;
|
|
106
182
|
logger.info(message);
|
|
107
183
|
} else {
|
|
108
184
|
logger.info(
|
|
109
|
-
`${exitResults.scriptResults.length} script${s} ran successfully`,
|
|
185
|
+
`${exitResults.scriptResults.length} script${s} ran successfully${skippedMessage}`,
|
|
110
186
|
);
|
|
111
187
|
}
|
|
112
188
|
if (options.jsonOutfile) {
|
|
@@ -155,6 +231,8 @@ const runScript = handleProjectCommand(
|
|
|
155
231
|
}
|
|
156
232
|
if (exitResults.failureCount) {
|
|
157
233
|
process.exit(1);
|
|
234
|
+
} else {
|
|
235
|
+
process.exit(0);
|
|
158
236
|
}
|
|
159
237
|
},
|
|
160
238
|
);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from "./handleRunScript";
|
|
2
|
-
export * from "./
|
|
2
|
+
export * from "./output/renderPlainOutput";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from "./handleRunScript.mjs";
|
|
2
|
-
export * from "./
|
|
2
|
+
export * from "./output/renderPlainOutput.mjs"; // CONCATENATED MODULE: ./src/cli/commands/runScript/index.ts
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./renderPlainOutput";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./renderPlainOutput.mjs"; // CONCATENATED MODULE: ./src/cli/commands/runScript/output/index.ts
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const OUTPUT_STYLE_VALUES: readonly [
|
|
2
|
+
"grouped",
|
|
3
|
+
"prefixed",
|
|
4
|
+
"plain",
|
|
5
|
+
];
|
|
6
|
+
export type OutputStyleName = (typeof OUTPUT_STYLE_VALUES)[number];
|
|
7
|
+
export declare const getDefaultOutputStyle: () => OutputStyleName;
|
|
8
|
+
export declare const validateOutputStyle: (style: string) => OutputStyleName;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { BunWorkspacesError } from "../../../../internal/core/error/index.mjs";
|
|
2
|
+
import { IS_TTY } from "../../../../internal/core/runtime/terminal.mjs"; // CONCATENATED MODULE: external "../../../../internal/core/error/index.mjs"
|
|
3
|
+
// CONCATENATED MODULE: external "../../../../internal/core/runtime/terminal.mjs"
|
|
4
|
+
// CONCATENATED MODULE: ./src/cli/commands/runScript/output/outputStyle.ts
|
|
5
|
+
|
|
6
|
+
const OUTPUT_STYLE_VALUES = ["grouped", "prefixed", "plain"];
|
|
7
|
+
const getDefaultOutputStyle = () => (IS_TTY ? "grouped" : "prefixed");
|
|
8
|
+
const validateOutputStyle = (style) => {
|
|
9
|
+
if (!OUTPUT_STYLE_VALUES.includes(style)) {
|
|
10
|
+
throw new BunWorkspacesError(
|
|
11
|
+
`Invalid output style: "${style}" (accepted values: ${OUTPUT_STYLE_VALUES.join(", ")})`,
|
|
12
|
+
);
|
|
13
|
+
}
|
|
14
|
+
return style;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export { OUTPUT_STYLE_VALUES, getDefaultOutputStyle, validateOutputStyle };
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type TypedEvent,
|
|
3
|
+
TypedEventTarget,
|
|
4
|
+
} from "../../../../internal/core/language/events/typedEventTarget";
|
|
5
|
+
import type {
|
|
6
|
+
RunScriptAcrossWorkspacesProcessOutput,
|
|
7
|
+
RunWorkspaceScriptMetadata,
|
|
8
|
+
} from "../../../../project";
|
|
9
|
+
import type {
|
|
10
|
+
RunScriptExit,
|
|
11
|
+
RunScriptsSummary,
|
|
12
|
+
ScriptEventName,
|
|
13
|
+
} from "../../../../runScript";
|
|
14
|
+
import type { Workspace } from "../../../../workspaces";
|
|
15
|
+
type ScriptEvent = TypedEvent<
|
|
16
|
+
ScriptEventName,
|
|
17
|
+
{
|
|
18
|
+
workspace: Workspace;
|
|
19
|
+
exitResult: RunScriptExit<RunWorkspaceScriptMetadata> | null;
|
|
20
|
+
}
|
|
21
|
+
>;
|
|
22
|
+
declare class ScriptEventTarget extends TypedEventTarget<{
|
|
23
|
+
[key in ScriptEvent["type"]]: ScriptEvent;
|
|
24
|
+
}> {}
|
|
25
|
+
export declare const createScriptEventTarget: () => ScriptEventTarget;
|
|
26
|
+
export declare const createScriptEvent: {
|
|
27
|
+
start: (
|
|
28
|
+
properties: Omit<
|
|
29
|
+
{
|
|
30
|
+
type: ScriptEventName;
|
|
31
|
+
} & {
|
|
32
|
+
workspace: Workspace;
|
|
33
|
+
exitResult: RunScriptExit<RunWorkspaceScriptMetadata> | null;
|
|
34
|
+
},
|
|
35
|
+
"type"
|
|
36
|
+
>,
|
|
37
|
+
options?: EventInit,
|
|
38
|
+
) => ScriptEvent;
|
|
39
|
+
skip: (
|
|
40
|
+
properties: Omit<
|
|
41
|
+
{
|
|
42
|
+
type: ScriptEventName;
|
|
43
|
+
} & {
|
|
44
|
+
workspace: Workspace;
|
|
45
|
+
exitResult: RunScriptExit<RunWorkspaceScriptMetadata> | null;
|
|
46
|
+
},
|
|
47
|
+
"type"
|
|
48
|
+
>,
|
|
49
|
+
options?: EventInit,
|
|
50
|
+
) => ScriptEvent;
|
|
51
|
+
exit: (
|
|
52
|
+
properties: Omit<
|
|
53
|
+
{
|
|
54
|
+
type: ScriptEventName;
|
|
55
|
+
} & {
|
|
56
|
+
workspace: Workspace;
|
|
57
|
+
exitResult: RunScriptExit<RunWorkspaceScriptMetadata> | null;
|
|
58
|
+
},
|
|
59
|
+
"type"
|
|
60
|
+
>,
|
|
61
|
+
options?: EventInit,
|
|
62
|
+
) => ScriptEvent;
|
|
63
|
+
};
|
|
64
|
+
export declare const renderGroupedOutput: (
|
|
65
|
+
workspaces: Workspace[],
|
|
66
|
+
output: RunScriptAcrossWorkspacesProcessOutput,
|
|
67
|
+
summary: Promise<RunScriptsSummary<RunWorkspaceScriptMetadata>>,
|
|
68
|
+
scriptEventTarget: ScriptEventTarget,
|
|
69
|
+
activeScriptLines: number | "all",
|
|
70
|
+
) => Promise<void>;
|
|
71
|
+
export {};
|