bun-workspaces 0.3.0 → 1.0.1-alpha

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.
Files changed (41) hide show
  1. package/README.md +32 -4
  2. package/bun.lock +576 -0
  3. package/package.json +13 -15
  4. package/src/cli/cli.ts +3 -8
  5. package/src/cli/globalOptions.ts +61 -23
  6. package/src/cli/projectCommands.ts +42 -41
  7. package/src/config/bunWorkspacesConfig.ts +62 -0
  8. package/src/config/configFile.ts +33 -0
  9. package/src/config/index.ts +7 -0
  10. package/src/internal/env.ts +25 -1
  11. package/src/internal/logger.ts +143 -19
  12. package/src/project/project.ts +24 -1
  13. package/src/workspaces/errors.ts +2 -0
  14. package/src/workspaces/findWorkspaces.ts +36 -8
  15. package/src/workspaces/index.ts +0 -1
  16. package/src/workspaces/packageJson.ts +1 -1
  17. package/src/workspaces/workspace.ts +2 -0
  18. package/.vscode/extensions.json +0 -12
  19. package/.vscode/settings.json +0 -23
  20. package/bun-workspaces-0.1.0-alpha-test-publish-2.tgz +0 -0
  21. package/eslint.config.mjs +0 -45
  22. package/ignore-me-CHANGELOG_TEMPLATE.md +0 -264
  23. package/ignore-me-test-projects/no-fail/applications/applicationA/package.json +0 -8
  24. package/ignore-me-test-projects/no-fail/applications/applicationB/package.json +0 -8
  25. package/ignore-me-test-projects/no-fail/libraries/libraryA/package.json +0 -8
  26. package/ignore-me-test-projects/no-fail/libraries/libraryB/package.json +0 -8
  27. package/ignore-me-test-projects/no-fail/libraries/nested/libraryC/package.json +0 -8
  28. package/ignore-me-test-projects/no-fail/package.json +0 -7
  29. package/ignore-me-test-projects/one-fail/applications/applicationA/package.json +0 -8
  30. package/ignore-me-test-projects/one-fail/applications/applicationB/package.json +0 -8
  31. package/ignore-me-test-projects/one-fail/libraries/libraryA/package.json +0 -8
  32. package/ignore-me-test-projects/one-fail/libraries/libraryB/package.json +0 -8
  33. package/ignore-me-test-projects/one-fail/libraries/nested/libraryC/package.json +0 -8
  34. package/ignore-me-test-projects/one-fail/package.json +0 -7
  35. package/ignore-me-test-projects/two-fail/applications/applicationA/package.json +0 -8
  36. package/ignore-me-test-projects/two-fail/applications/applicationB/package.json +0 -8
  37. package/ignore-me-test-projects/two-fail/libraries/libraryA/package.json +0 -8
  38. package/ignore-me-test-projects/two-fail/libraries/libraryB/package.json +0 -8
  39. package/ignore-me-test-projects/two-fail/libraries/nested/libraryC/package.json +0 -8
  40. package/ignore-me-test-projects/two-fail/package.json +0 -7
  41. package/src/cli/output.ts +0 -6
package/README.md CHANGED
@@ -2,8 +2,6 @@
2
2
 
3
3
  This is a CLI meant to help manage [Bun workspaces](https://bun.sh/docs/install/workspaces).
4
4
 
5
- This was created primarily due to issues and limitations with Bun's `--filter` option for running commands from workspaces.
6
-
7
5
  ## Installation
8
6
 
9
7
  You can install the CLI in your project or simply use `bunx bun-workspaces`.
@@ -13,6 +11,30 @@ $ bun add --dev bun-workspaces
13
11
  $ bunx bun-workspaces --help
14
12
  ```
15
13
 
14
+ ### Config file
15
+
16
+ You can create a config file at `bw.json` in your project root, or you can pass a config file to the CLI with the `--configFile` (or `-c`) option.
17
+
18
+ #### Example config
19
+
20
+ In this config, "app-a" is an alias for package "@my-org/application-a" and "app-b" is an alias for package "@my-org/application-b".
21
+
22
+ CLI log levels are `debug`, `info`, `warn`, and `error` or `silent`. The default log level is `info`. Commands that are intended to print specific output will still print at `silent`, such as `list-workspaces`, `list-scripts`, `workspace-info`, `script-info`, etc., but other logs will be suppressed.
23
+
24
+ ```json
25
+ {
26
+ "workspaceAliases": {
27
+ "app-a": "@my-org/application-a",
28
+ "app-b": "@my-org/application-b"
29
+ },
30
+ "cli": {
31
+ "logLevel": "warn"
32
+ }
33
+ }
34
+ ```
35
+
36
+ You can also pass a config file to the CLI with the `-c` or `--configFile` option.
37
+
16
38
  ### Examples
17
39
 
18
40
  You might consider making a shorter alias in your `.bashrc`, `.zshrc`, or similar shell configuration file, such as `alias bw="bunx bun-workspaces"`, for convenience.
@@ -57,13 +79,13 @@ bw script-info my-script --json
57
79
  # in their `scripts` field
58
80
  bw run my-script
59
81
 
60
- # Run a script for a specific workspace
82
+ # Run a script for a specific workspace by its package.json name or alias from the config
61
83
  bw run my-script my-workspace
62
84
 
63
85
  # Run a script for multiple workspaces
64
86
  bw run my-script workspace-a workspace-b
65
87
 
66
- # Run a script for workspaces using wildcard
88
+ # Run a script for workspaces using wildcard (does not take into account workspace aliases)
67
89
  bw run my-script "my-workspace-*"
68
90
 
69
91
  # Run script in parallel for all workspaces
@@ -82,4 +104,10 @@ bw --help
82
104
  # Pass --cwd to any command
83
105
  bw --cwd /path/to/your/project ls
84
106
  bw --cwd /path/to/your/project run-script my-script
107
+
108
+ # Pass --configFile to any command
109
+ bw --configFile /path/to/your/config.json ls
110
+
111
+ # Pass --logLevel to any command (debug, info, warn, error, or silent)
112
+ bw --logLevel silent run my-script
85
113
  ```