bun-workspaces 1.1.2 → 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 +8 -1
- package/package.json +1 -1
- package/src/cli/commands/commandsConfig.d.ts +2 -2
- package/src/cli/commands/runScript/handleRunScript.mjs +8 -5
- package/src/cli/commands/runScript/output/outputStyle.d.ts +1 -0
- package/src/cli/commands/runScript/output/outputStyle.mjs +1 -1
- package/src/workspaces/findWorkspaces.mjs +3 -2
package/README.md
CHANGED
|
@@ -6,7 +6,14 @@
|
|
|
6
6
|
|
|
7
7
|
### [**See Full Documentation Here**: _https://bunworkspaces.com_](https://bunworkspaces.com)
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
**Big Recent Updates!**
|
|
10
|
+
|
|
11
|
+
- Version 1 is here after the initial alpha! 🍔🍔👁️🍔🍔
|
|
12
|
+
- You can demo the CLI [directly in the browser](https://bunworkspaces.com/web-cli)
|
|
13
|
+
- There's now [an official blog](https://bunworkspaces.com/blog/bun-workspaces-v1) to cover noteworthy releases and more!
|
|
14
|
+
<hr/>
|
|
15
|
+
|
|
16
|
+
This is a CLI and TypeScript API to enhance your monorepo development with Bun's [native workspaces](https://bun.sh/docs/install/workspaces) feature for nested JavaScript/TypeScript packages.
|
|
10
17
|
|
|
11
18
|
- Works right away, with no boilerplate required 🍔🍴
|
|
12
19
|
- Get metadata about your monorepo 🤖
|
package/package.json
CHANGED
|
@@ -148,7 +148,7 @@ export declare const CLI_COMMANDS_CONFIG: {
|
|
|
148
148
|
readonly outputStyle: {
|
|
149
149
|
readonly flags: ["-o", "--output-style <style>"];
|
|
150
150
|
readonly description: "The output style to use";
|
|
151
|
-
readonly values: ["grouped", "prefixed", "plain"];
|
|
151
|
+
readonly values: ["grouped", "prefixed", "plain", "none"];
|
|
152
152
|
};
|
|
153
153
|
readonly groupedLines: {
|
|
154
154
|
readonly flags: ["-L", "--grouped-lines <count>"];
|
|
@@ -309,7 +309,7 @@ export declare const getCliCommandConfig: (commandName: CliCommandName) =>
|
|
|
309
309
|
readonly outputStyle: {
|
|
310
310
|
readonly flags: ["-o", "--output-style <style>"];
|
|
311
311
|
readonly description: "The output style to use";
|
|
312
|
-
readonly values: ["grouped", "prefixed", "plain"];
|
|
312
|
+
readonly values: ["grouped", "prefixed", "plain", "none"];
|
|
313
313
|
};
|
|
314
314
|
readonly groupedLines: {
|
|
315
315
|
readonly flags: ["-L", "--grouped-lines <count>"];
|
|
@@ -73,6 +73,10 @@ const runScript = handleProjectCommand(
|
|
|
73
73
|
`Command: Run ${options.inline ? "inline " : ""}script ${JSON.stringify(script)} for ${workspacePatterns.length ? "workspaces " + workspacePatterns.join(", ") : "all workspaces"}`,
|
|
74
74
|
);
|
|
75
75
|
logger.debug(`Options: ${JSON.stringify(options)}`);
|
|
76
|
+
const outputStyle = options.outputStyle
|
|
77
|
+
? validateOutputStyle(options.outputStyle)
|
|
78
|
+
: getDefaultOutputStyle();
|
|
79
|
+
logger.debug(`Effective output style: ${outputStyle}`);
|
|
76
80
|
const scriptEventTarget = createScriptEventTarget();
|
|
77
81
|
const { output, summary, workspaces } = project.runScriptAcrossWorkspaces({
|
|
78
82
|
workspacePatterns: workspacePatterns.length
|
|
@@ -90,7 +94,7 @@ const runScript = handleProjectCommand(
|
|
|
90
94
|
args: scriptArgs,
|
|
91
95
|
dependencyOrder: options.depOrder,
|
|
92
96
|
ignoreDependencyFailure: options.ignoreDepFailure,
|
|
93
|
-
ignoreOutput:
|
|
97
|
+
ignoreOutput: outputStyle === "none",
|
|
94
98
|
onScriptEvent: (event, { workspace, exitResult }) => {
|
|
95
99
|
setTimeout(() =>
|
|
96
100
|
// place at end of call stack so listeners in render func receive event
|
|
@@ -168,11 +172,10 @@ const runScript = handleProjectCommand(
|
|
|
168
172
|
prefix: false,
|
|
169
173
|
stripDisruptiveControls,
|
|
170
174
|
}),
|
|
175
|
+
none: async () => {
|
|
176
|
+
// no-op
|
|
177
|
+
},
|
|
171
178
|
};
|
|
172
|
-
const outputStyle = options.outputStyle
|
|
173
|
-
? validateOutputStyle(options.outputStyle)
|
|
174
|
-
: getDefaultOutputStyle();
|
|
175
|
-
logger.debug(`Effective output style: ${outputStyle}`);
|
|
176
179
|
await outputStyleHandlers[outputStyle]();
|
|
177
180
|
const exitResults = await summary;
|
|
178
181
|
exitResults.scriptResults.forEach(
|
|
@@ -3,7 +3,7 @@ import { IS_TTY } from "../../../../internal/core/runtime/terminal.mjs"; // CONC
|
|
|
3
3
|
// CONCATENATED MODULE: external "../../../../internal/core/runtime/terminal.mjs"
|
|
4
4
|
// CONCATENATED MODULE: ./src/cli/commands/runScript/output/outputStyle.ts
|
|
5
5
|
|
|
6
|
-
const OUTPUT_STYLE_VALUES = ["grouped", "prefixed", "plain"];
|
|
6
|
+
const OUTPUT_STYLE_VALUES = ["grouped", "prefixed", "plain", "none"];
|
|
7
7
|
const getDefaultOutputStyle = () => (IS_TTY ? "grouped" : "prefixed");
|
|
8
8
|
const validateOutputStyle = (style) => {
|
|
9
9
|
if (!OUTPUT_STYLE_VALUES.includes(style)) {
|
|
@@ -125,8 +125,9 @@ const findWorkspaces = ({
|
|
|
125
125
|
path.dirname(packageJsonPath),
|
|
126
126
|
);
|
|
127
127
|
const matchPattern =
|
|
128
|
-
workspaceGlobs.find((glob) =>
|
|
129
|
-
|
|
128
|
+
workspaceGlobs.find((glob) =>
|
|
129
|
+
new bun.Glob(glob.replace(/\/+$/, "")).match(relativePath),
|
|
130
|
+
) ?? "";
|
|
130
131
|
const isRootWorkspace = workspacePath === rootDirectory;
|
|
131
132
|
if (!matchPattern && !isRootWorkspace) {
|
|
132
133
|
logger.debug(`No match pattern found for ${relativePath}`);
|