mb-run 0.0.1-dev-20260504-b6b8a3a
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/CHANGELOG.md +64 -0
- package/LICENSE +202 -0
- package/README.md +138 -0
- package/bin/mb-run +13 -0
- package/dist/ansi.js +102 -0
- package/dist/build.js +60 -0
- package/dist/cache.js +107 -0
- package/dist/clean.js +119 -0
- package/dist/esbuild.js +80 -0
- package/dist/help.js +44 -0
- package/dist/helpers.js +20 -0
- package/dist/info.js +93 -0
- package/dist/logger.js +79 -0
- package/dist/module.js +233 -0
- package/dist/pack.js +84 -0
- package/dist/publish.js +78 -0
- package/dist/sort.js +49 -0
- package/dist/spawn.js +27 -0
- package/dist/update.js +14 -0
- package/dist/version.js +159 -0
- package/npm-shrinkwrap.json +1546 -0
- package/package.json +74 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
<!-- eslint-disable markdown/no-missing-label-refs -->
|
|
2
|
+
|
|
3
|
+
# <img src="https://matterbridge.io/assets/matterbridge.svg" alt="Matterbridge Logo" width="64px" height="64px"> Matterbridge command line executor
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/mb-run)
|
|
6
|
+
[](https://www.npmjs.com/package/mb-run)
|
|
7
|
+

|
|
8
|
+

|
|
9
|
+
[](https://codecov.io/gh/Luligu/mb-run)
|
|
10
|
+
[](https://prettier.io/)
|
|
11
|
+
[](https://eslint.org/)
|
|
12
|
+
[](https://www.typescriptlang.org/)
|
|
13
|
+
[](https://nodejs.org/)
|
|
14
|
+
[](https://matterbridge.io)
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
All notable changes to this project will be documented in this file.
|
|
19
|
+
|
|
20
|
+
If you like this project and find it useful, please consider giving it a star on [GitHub](https://github.com/Luligu/mb-run) and sponsoring it.
|
|
21
|
+
|
|
22
|
+
<a href="https://www.buymeacoffee.com/luligugithub"><img src="https://matterbridge.io/assets/bmc-button.svg" alt="Buy me a coffee" width="120"></a>
|
|
23
|
+
|
|
24
|
+
## [0.0.1] - Dev branch
|
|
25
|
+
|
|
26
|
+
- [package]: Initial release
|
|
27
|
+
|
|
28
|
+
<a href="https://www.buymeacoffee.com/luligugithub"><img src="https://matterbridge.io/assets/bmc-button.svg" alt="Buy me a coffee" width="80"></a>
|
|
29
|
+
|
|
30
|
+
<!-- Commented out section
|
|
31
|
+
## [1.0.0] - 2025-07-01
|
|
32
|
+
|
|
33
|
+
### Added
|
|
34
|
+
|
|
35
|
+
- [Feature 1]: Description of the feature.
|
|
36
|
+
- [Feature 2]: Description of the feature.
|
|
37
|
+
|
|
38
|
+
### Changed
|
|
39
|
+
|
|
40
|
+
- [Feature 3]: Description of the change.
|
|
41
|
+
- [Feature 4]: Description of the change.
|
|
42
|
+
|
|
43
|
+
### Deprecated
|
|
44
|
+
|
|
45
|
+
- [Feature 5]: Description of the deprecation.
|
|
46
|
+
|
|
47
|
+
### Removed
|
|
48
|
+
|
|
49
|
+
- [Feature 6]: Description of the removal.
|
|
50
|
+
|
|
51
|
+
### Fixed
|
|
52
|
+
|
|
53
|
+
- [Bug 1]: Description of the bug fix.
|
|
54
|
+
- [Bug 2]: Description of the bug fix.
|
|
55
|
+
|
|
56
|
+
### Security
|
|
57
|
+
|
|
58
|
+
- [Security 1]: Description of the security improvement.
|
|
59
|
+
|
|
60
|
+
<a href="https://www.buymeacoffee.com/luligugithub">
|
|
61
|
+
<img src="https://matterbridge.io/assets/bmc-button.svg" alt="Buy me a coffee" width="80">
|
|
62
|
+
</a>
|
|
63
|
+
|
|
64
|
+
-->
|
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
# <img src="https://matterbridge.io/assets/matterbridge.svg" alt="Matterbridge Logo" width="64px" height="64px"> mb-run — Matterbridge command line executor
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/mb-run)
|
|
4
|
+
[](https://www.npmjs.com/package/mb-run)
|
|
5
|
+

|
|
6
|
+

|
|
7
|
+
[](https://codecov.io/gh/Luligu/mb-run)
|
|
8
|
+
[](https://prettier.io/)
|
|
9
|
+
[](https://eslint.org/)
|
|
10
|
+
[](https://www.typescriptlang.org/)
|
|
11
|
+
[](https://nodejs.org/)
|
|
12
|
+
[](https://matterbridge.io)
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
`mb-run` is a developer CLI that runs the same operations as the `package.json` scripts in any Matterbridge project, but invokes the local binaries in `node_modules/.bin` directly — without going through `npm run`. This keeps output clean, avoids npm's startup overhead, and works reliably across plain packages, monorepos, plugins, and tools.
|
|
17
|
+
|
|
18
|
+
If you like this project and find it useful, please consider giving it a star on [GitHub](https://github.com/Luligu/mb-run) and sponsoring it.
|
|
19
|
+
|
|
20
|
+
<a href="https://www.buymeacoffee.com/luligugithub"><img src="https://www.buymeacoffee.com/assets/img/custom_images/yellow_img.png" width="80" alt="Buy Me A Coffee"></a>
|
|
21
|
+
|
|
22
|
+
## Features
|
|
23
|
+
|
|
24
|
+
- **No npm overhead** — calls `tsc`, `eslint`, `prettier`, and `jest` directly from `node_modules/.bin`
|
|
25
|
+
- **Monorepo-aware** — automatically picks per-workspace `tsconfig.build.json` / `tsconfig.build.production.json` when present
|
|
26
|
+
- **Plugin-aware** — detects Matterbridge plugin context and runs `npm link matterbridge` automatically after install or reset
|
|
27
|
+
- **Composable flags** — combine multiple flags in a single invocation; operations always run in a deterministic order
|
|
28
|
+
- **Dry-run mode** — `--dry-run` logs every intended action without touching the file system or spawning processes
|
|
29
|
+
- **Verbose mode** — `--verbose` prints every external command before it is executed
|
|
30
|
+
- **Version management** — bumps versions for the root package and all workspace packages simultaneously, with prerelease tag support
|
|
31
|
+
- **Full pack & publish workflows** — backs up, strips, packs/publishes, and restores `package.json` automatically
|
|
32
|
+
|
|
33
|
+
## Requirements
|
|
34
|
+
|
|
35
|
+
- Node.js 20, 22, or 24
|
|
36
|
+
- npm
|
|
37
|
+
|
|
38
|
+
## Installation
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
npm install -g mb-run
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Or use it as a local dev dependency in your project:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
npm install --save-dev mb-run
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Usage
|
|
51
|
+
|
|
52
|
+
```text
|
|
53
|
+
mb-run [flags] [--version [tag]]
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Multiple flags can be combined. They are always executed in this fixed order regardless of how they appear on the command line:
|
|
57
|
+
|
|
58
|
+
> `install → update → deep-clean → reset → clean → version → build → test → format → lint → sort → pack → publish → esbuild → watch`
|
|
59
|
+
|
|
60
|
+
## Flags
|
|
61
|
+
|
|
62
|
+
| Flag | Description |
|
|
63
|
+
| ---------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
64
|
+
| `--install` | Runs `npm install --no-fund --no-audit`. In a Matterbridge plugin project, also runs `npm link matterbridge`. |
|
|
65
|
+
| `--reset` | Empties `.cache/` and `node_modules/` (preserving directory structure for devcontainer named volumes), then runs `npm install` and rebuilds. Implies `--install` and `--build`. |
|
|
66
|
+
| `--reset --production` | Same as `--reset` but rebuilds using the production tsconfig. |
|
|
67
|
+
| `--deep-clean` | Same filesystem cleanup as `--reset` but skips the install and build steps. |
|
|
68
|
+
| `--clean` | Removes `dist/` and all `.tsbuildinfo` files. |
|
|
69
|
+
| `--build` | Compiles TypeScript using `tsc`. Prefers `tsconfig.build.json` per workspace when present, falls back to `tsconfig.json`. |
|
|
70
|
+
| `--build --production` | Compiles for production. Prefers `tsconfig.build.production.json`, falls back to `tsconfig.build.json`, then `tsconfig.json`. |
|
|
71
|
+
| `--watch` | Runs `tsc` in watch mode using the build tsconfig. |
|
|
72
|
+
| `--test` | Runs `jest --maxWorkers=100%` with `NODE_OPTIONS="--experimental-vm-modules --no-warnings"` set automatically. |
|
|
73
|
+
| `--lint` | Runs `eslint --cache --max-warnings=0`. |
|
|
74
|
+
| `--lint-fix` | Runs `eslint --cache --fix --max-warnings=0`. |
|
|
75
|
+
| `--format` | Runs `prettier --cache --write`. |
|
|
76
|
+
| `--format-check` | Runs `prettier --cache --check`. |
|
|
77
|
+
| `--sort` | Sorts top-level keys in all `package.json` files (root and all workspaces) using the canonical Matterbridge key order, then formats with Prettier. |
|
|
78
|
+
| `--update` | Upgrades all dependencies using `npm-check-updates` (root + all workspaces), then runs `npm install`. |
|
|
79
|
+
| `--pack` | Full pack workflow: back up `package.json`, clean, production build, strip `devDependencies`/`scripts`, empty `node_modules`, `npm install --omit=dev`, `npm shrinkwrap`, `npm pack`, then restore everything. |
|
|
80
|
+
| `--publish` | Full publish workflow: back up all `package.json` files, strip `devDependencies`/`scripts` from root and workspaces, `npm publish` root and every workspace, then restore all files. |
|
|
81
|
+
| `--esbuild` | Bundles the project with esbuild. |
|
|
82
|
+
| `--version [tag]` | Updates the version in `package.json` (root and all workspaces) and regenerates `package-lock.json`. Without a tag, strips any prerelease suffix back to base semver. With a tag, produces `<baseVersion>-<tag>-<yyyymmdd>-<7charSha>`. |
|
|
83
|
+
| `--info` | Prints system information: platform, hostname, memory, network interfaces, Node.js and npm versions. |
|
|
84
|
+
| `--dry-run` | Logs every intended action without modifying files or executing commands. |
|
|
85
|
+
| `--verbose` | Prints each external command before it is executed. |
|
|
86
|
+
| `--help`, `-h` | Prints usage text. |
|
|
87
|
+
|
|
88
|
+
## Version tags
|
|
89
|
+
|
|
90
|
+
The `--version` flag accepts the following prerelease tags:
|
|
91
|
+
|
|
92
|
+
`dev` · `edge` · `git` · `local` · `next` · `alpha` · `beta`
|
|
93
|
+
|
|
94
|
+
Examples:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
# Tag a dev prerelease
|
|
98
|
+
mb-run --version dev
|
|
99
|
+
# → 1.2.3-dev-20260504-abc1234
|
|
100
|
+
|
|
101
|
+
# Strip back to base semver
|
|
102
|
+
mb-run --version
|
|
103
|
+
# → 1.2.3
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Examples
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
# Clean, build, lint, and format in one pass
|
|
110
|
+
mb-run --clean --build --lint --format
|
|
111
|
+
|
|
112
|
+
# Production build with dry-run preview
|
|
113
|
+
mb-run --build --production --dry-run
|
|
114
|
+
|
|
115
|
+
# Full reset and rebuild for a plugin
|
|
116
|
+
mb-run --reset
|
|
117
|
+
|
|
118
|
+
# Tag a dev prerelease, build, and pack
|
|
119
|
+
mb-run --version dev --build --production --pack
|
|
120
|
+
|
|
121
|
+
# Watch mode during development
|
|
122
|
+
mb-run --build --watch
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## How it works
|
|
126
|
+
|
|
127
|
+
`mb-run` runs against the `package.json` in the **current working directory**. It does not assume it is being run from its own package root, so it is safe to install globally and use inside any Matterbridge project.
|
|
128
|
+
|
|
129
|
+
For each operation, `mb-run` resolves the tool binary from `node_modules/.bin` in the current project:
|
|
130
|
+
|
|
131
|
+
- **Known entrypoints** (`tsc`, `jest`, `eslint`, `prettier`) are invoked as `node <entrypoint>` for reliability on all platforms.
|
|
132
|
+
- **Other binaries** are invoked via their shim in `node_modules/.bin` (using the `.cmd` variant on Windows).
|
|
133
|
+
|
|
134
|
+
## If you find this project useful
|
|
135
|
+
|
|
136
|
+
If you find this project useful, please consider giving it a star on GitHub and sponsoring it. Your support helps maintain and improve the project.
|
|
137
|
+
|
|
138
|
+
[](https://www.buymeacoffee.com/luligugithub)
|
package/bin/mb-run
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { main } from '../dist/module.js';
|
|
3
|
+
import { ExitError } from '../dist/spawn.js';
|
|
4
|
+
|
|
5
|
+
try {
|
|
6
|
+
await main();
|
|
7
|
+
} catch (error) {
|
|
8
|
+
const exitCode = error instanceof ExitError ? error.code : 1;
|
|
9
|
+
|
|
10
|
+
// eslint-disable-next-line no-console
|
|
11
|
+
console.error(error instanceof Error ? error.message : error);
|
|
12
|
+
process.exitCode = exitCode;
|
|
13
|
+
}
|
package/dist/ansi.js
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
export function shouldUseAnsi() {
|
|
2
|
+
if (process.env.NO_COLOR)
|
|
3
|
+
return false;
|
|
4
|
+
if (process.env.TERM === 'dumb')
|
|
5
|
+
return false;
|
|
6
|
+
if (process.env.FORCE_COLOR)
|
|
7
|
+
return true;
|
|
8
|
+
return Boolean(process.stdout?.isTTY);
|
|
9
|
+
}
|
|
10
|
+
function wrapAnsi(open, close, text) {
|
|
11
|
+
return shouldUseAnsi() ? `${open}${text}${close}` : text;
|
|
12
|
+
}
|
|
13
|
+
export function reverse(text) {
|
|
14
|
+
return wrapAnsi('\u001B[7m', '\u001B[27m', text);
|
|
15
|
+
}
|
|
16
|
+
export function black(text) {
|
|
17
|
+
return wrapAnsi('\u001B[30m', '\u001B[39m', text);
|
|
18
|
+
}
|
|
19
|
+
export function red(text) {
|
|
20
|
+
return wrapAnsi('\u001B[31m', '\u001B[39m', text);
|
|
21
|
+
}
|
|
22
|
+
export function green(text) {
|
|
23
|
+
return wrapAnsi('\u001B[32m', '\u001B[39m', text);
|
|
24
|
+
}
|
|
25
|
+
export function yellow(text) {
|
|
26
|
+
return wrapAnsi('\u001B[33m', '\u001B[39m', text);
|
|
27
|
+
}
|
|
28
|
+
export function blue(text) {
|
|
29
|
+
return wrapAnsi('\u001B[34m', '\u001B[39m', text);
|
|
30
|
+
}
|
|
31
|
+
export function magenta(text) {
|
|
32
|
+
return wrapAnsi('\u001B[35m', '\u001B[39m', text);
|
|
33
|
+
}
|
|
34
|
+
export function cyan(text) {
|
|
35
|
+
return wrapAnsi('\u001B[36m', '\u001B[39m', text);
|
|
36
|
+
}
|
|
37
|
+
export function white(text) {
|
|
38
|
+
return wrapAnsi('\u001B[37m', '\u001B[39m', text);
|
|
39
|
+
}
|
|
40
|
+
export function brightBlack(text) {
|
|
41
|
+
return wrapAnsi('\u001B[90m', '\u001B[39m', text);
|
|
42
|
+
}
|
|
43
|
+
export function brightRed(text) {
|
|
44
|
+
return wrapAnsi('\u001B[91m', '\u001B[39m', text);
|
|
45
|
+
}
|
|
46
|
+
export function brightGreen(text) {
|
|
47
|
+
return wrapAnsi('\u001B[92m', '\u001B[39m', text);
|
|
48
|
+
}
|
|
49
|
+
export function brightYellow(text) {
|
|
50
|
+
return wrapAnsi('\u001B[93m', '\u001B[39m', text);
|
|
51
|
+
}
|
|
52
|
+
export function brightBlue(text) {
|
|
53
|
+
return wrapAnsi('\u001B[94m', '\u001B[39m', text);
|
|
54
|
+
}
|
|
55
|
+
export function brightMagenta(text) {
|
|
56
|
+
return wrapAnsi('\u001B[95m', '\u001B[39m', text);
|
|
57
|
+
}
|
|
58
|
+
export function brightCyan(text) {
|
|
59
|
+
return wrapAnsi('\u001B[96m', '\u001B[39m', text);
|
|
60
|
+
}
|
|
61
|
+
export function brightWhite(text) {
|
|
62
|
+
return wrapAnsi('\u001B[97m', '\u001B[39m', text);
|
|
63
|
+
}
|
|
64
|
+
let startTime = 0;
|
|
65
|
+
export function savePos() {
|
|
66
|
+
startTime = Date.now();
|
|
67
|
+
return shouldUseAnsi() ? '\u001B[s' : '';
|
|
68
|
+
}
|
|
69
|
+
export function restorePos() {
|
|
70
|
+
return shouldUseAnsi() ? '\u001B[u\u001B[J' : '';
|
|
71
|
+
}
|
|
72
|
+
export function syncPos() {
|
|
73
|
+
return shouldUseAnsi() ? ' \u001B[D' : '';
|
|
74
|
+
}
|
|
75
|
+
export function getElapsed() {
|
|
76
|
+
const ms = Date.now() - startTime;
|
|
77
|
+
return ms < 1000 ? `${ms} ms` : `${(ms / 1000).toFixed(1)} s`;
|
|
78
|
+
}
|
|
79
|
+
export function clearEnd() {
|
|
80
|
+
return shouldUseAnsi() ? '\u001B[J' : '';
|
|
81
|
+
}
|
|
82
|
+
export function clearEol() {
|
|
83
|
+
return shouldUseAnsi() ? '\u001B[K' : '';
|
|
84
|
+
}
|
|
85
|
+
export function reset() {
|
|
86
|
+
return shouldUseAnsi() ? '\u001B[0m' : '';
|
|
87
|
+
}
|
|
88
|
+
export function moveUp(n = 1) {
|
|
89
|
+
return shouldUseAnsi() ? `\u001B[${n}A` : '';
|
|
90
|
+
}
|
|
91
|
+
export function moveDown(n = 1) {
|
|
92
|
+
return shouldUseAnsi() ? `\u001B[${n}B` : '';
|
|
93
|
+
}
|
|
94
|
+
export function moveRight(n = 1) {
|
|
95
|
+
return shouldUseAnsi() ? `\u001B[${n}C` : '';
|
|
96
|
+
}
|
|
97
|
+
export function moveLeft(n = 1) {
|
|
98
|
+
return shouldUseAnsi() ? `\u001B[${n}D` : '';
|
|
99
|
+
}
|
|
100
|
+
export function log(message) {
|
|
101
|
+
console.log(message);
|
|
102
|
+
}
|
package/dist/build.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { access } from 'node:fs/promises';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import process from 'node:process';
|
|
4
|
+
import { fileExists } from './clean.js';
|
|
5
|
+
import { ExitError, runCommand } from './spawn.js';
|
|
6
|
+
const BIN_ENTRYPOINTS = {
|
|
7
|
+
tsc: ['typescript', 'bin/tsc'],
|
|
8
|
+
jest: ['jest', 'bin/jest.js'],
|
|
9
|
+
eslint: ['eslint', 'bin/eslint.js'],
|
|
10
|
+
prettier: ['prettier', 'bin/prettier.cjs'],
|
|
11
|
+
};
|
|
12
|
+
function binPath(binName, opts) {
|
|
13
|
+
const fileName = opts.isWindows ? `${binName}.cmd` : binName;
|
|
14
|
+
return path.resolve(opts.rootDir, 'node_modules', '.bin', fileName);
|
|
15
|
+
}
|
|
16
|
+
function entrypointPath(binName, opts) {
|
|
17
|
+
const spec = BIN_ENTRYPOINTS[binName];
|
|
18
|
+
if (!spec)
|
|
19
|
+
return null;
|
|
20
|
+
const [pkg, rel] = spec;
|
|
21
|
+
return path.resolve(opts.rootDir, 'node_modules', pkg, rel);
|
|
22
|
+
}
|
|
23
|
+
async function assertBinExists(binName, opts) {
|
|
24
|
+
const entry = entrypointPath(binName, opts);
|
|
25
|
+
const p = entry ?? binPath(binName, opts);
|
|
26
|
+
try {
|
|
27
|
+
await access(p);
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
throw new ExitError(1, `Missing binary: ${p}. Did you run "npm install"?`);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
async function pickWorkspaceTsconfig(mode, opts) {
|
|
34
|
+
const candidates = mode === 'production' ? ['tsconfig.build.production.json', 'tsconfig.build.json', 'tsconfig.json'] : ['tsconfig.build.json', 'tsconfig.json'];
|
|
35
|
+
for (const name of candidates) {
|
|
36
|
+
const candidatePath = path.join(opts.rootDir, name);
|
|
37
|
+
if (await fileExists(candidatePath)) {
|
|
38
|
+
return candidatePath;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return path.join(opts.rootDir, 'tsconfig.json');
|
|
42
|
+
}
|
|
43
|
+
export async function runBin(binName, args, opts, runOptions = {}) {
|
|
44
|
+
if (!opts.dryRun)
|
|
45
|
+
await assertBinExists(binName, opts);
|
|
46
|
+
const entry = entrypointPath(binName, opts);
|
|
47
|
+
if (entry) {
|
|
48
|
+
await runCommand(process.execPath, [entry, ...args], { env: runOptions.env, dryRun: opts.dryRun, label: binName, displayArgs: args });
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
await runCommand(binPath(binName, opts), args, { env: runOptions.env, dryRun: opts.dryRun, label: binName });
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
export async function runWorkspaceBuild(options) {
|
|
55
|
+
const configs = await pickWorkspaceTsconfig(options.mode, options);
|
|
56
|
+
const args = ['-b', configs, '--pretty', 'false'];
|
|
57
|
+
if (options.watch)
|
|
58
|
+
args.push('--watch');
|
|
59
|
+
await runBin('tsc', args, options);
|
|
60
|
+
}
|