matterbridge 3.7.3-dev-20260405-2f4f273 → 3.7.3-dev-20260406-7deb166

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 (2) hide show
  1. package/package.json +8 -8
  2. package/scripts/mb-run.mjs +22 -14
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "matterbridge",
3
- "version": "3.7.3-dev-20260405-2f4f273",
3
+ "version": "3.7.3-dev-20260406-7deb166",
4
4
  "description": "Matterbridge plugin manager for Matter",
5
5
  "author": "https://github.com/Luligu",
6
6
  "license": "Apache-2.0",
@@ -130,13 +130,13 @@
130
130
  "README-SERVICE.md"
131
131
  ],
132
132
  "dependencies": {
133
- "@matterbridge/core": "3.7.3-dev-20260405-2f4f273",
134
- "@matterbridge/dgram": "3.7.3-dev-20260405-2f4f273",
135
- "@matterbridge/jest-utils": "3.7.3-dev-20260405-2f4f273",
136
- "@matterbridge/thread": "3.7.3-dev-20260405-2f4f273",
137
- "@matterbridge/types": "3.7.3-dev-20260405-2f4f273",
138
- "@matterbridge/utils": "3.7.3-dev-20260405-2f4f273",
139
- "@matterbridge/vitest-utils": "3.7.3-dev-20260405-2f4f273"
133
+ "@matterbridge/core": "3.7.3-dev-20260406-7deb166",
134
+ "@matterbridge/dgram": "3.7.3-dev-20260406-7deb166",
135
+ "@matterbridge/jest-utils": "3.7.3-dev-20260406-7deb166",
136
+ "@matterbridge/thread": "3.7.3-dev-20260406-7deb166",
137
+ "@matterbridge/types": "3.7.3-dev-20260406-7deb166",
138
+ "@matterbridge/utils": "3.7.3-dev-20260406-7deb166",
139
+ "@matterbridge/vitest-utils": "3.7.3-dev-20260406-7deb166"
140
140
  },
141
141
  "overrides": {
142
142
  "eslint": "10.1.0",
@@ -3,10 +3,10 @@ import { execFileSync, spawn } from 'node:child_process';
3
3
  import { access, mkdir, readdir, readFile, rm, writeFile } from 'node:fs/promises';
4
4
  import path from 'node:path';
5
5
  import process from 'node:process';
6
- import { fileURLToPath } from 'node:url';
7
6
 
8
- const scriptDir = path.dirname(fileURLToPath(import.meta.url));
9
- const repoRoot = path.resolve(scriptDir, '..');
7
+ // IMPORTANT: This script operates on the package.json in the current working directory.
8
+ // It may be executed from other repos/packages, so do not assume the script's own path.
9
+ const repoRoot = process.cwd();
10
10
  const isWindows = process.platform === 'win32';
11
11
 
12
12
  const BIN_ENTRYPOINTS = {
@@ -37,7 +37,7 @@ function printUsage() {
37
37
  const msg = `\
38
38
  Usage: mb-run [--reset] [--clean] [--build|--build-production] [--watch] [--test] [--lint|--lint-fix] [--format|--format-check] [--version [dev|edge|git|local|next|alpha|beta]]
39
39
 
40
- Runs the same operations as the root package.json scripts, but executes the local
40
+ Runs the same operations as the package.json scripts in the current working directory, but executes the local
41
41
  binaries in node_modules/.bin directly (does not call npm scripts).
42
42
 
43
43
  Notes:
@@ -48,7 +48,7 @@ Notes:
48
48
  - --format-check runs prettier with --check
49
49
  - --build prefers per-workspace tsconfig.build.json when present
50
50
  - --build-production prefers tsconfig.build.production.json, else tsconfig.build.json, else tsconfig.json
51
- - --version updates versions for root and all configured workspaces
51
+ - --version updates versions for the current package and all configured workspaces
52
52
  `;
53
53
 
54
54
  console.log(msg);
@@ -60,7 +60,7 @@ Notes:
60
60
  function printVersionUsage() {
61
61
  const msg = [
62
62
  'Usage: mb-run --version [dev|edge|git|local|next|alpha|beta]',
63
- 'Updates package.json + package-lock.json (root and workspaces) version to:',
63
+ 'Updates package.json + package-lock.json (current package and workspaces) version to:',
64
64
  ' <baseVersion>-<dev|edge|git|local|next|alpha|beta>-<yyyymmdd>-<7charSha>',
65
65
  'Or with no tag, strips the suffix back to <baseVersion>.',
66
66
  ].join('\n');
@@ -163,15 +163,16 @@ async function updateRootVersion(tag) {
163
163
  const baseVersion = extractBaseSemver(currentVersion);
164
164
  const nextVersion = tag ? `${baseVersion}-${tag}-${formatYyyymmdd(new Date())}-${getShortSha7(repoRoot)}` : baseVersion;
165
165
 
166
- // Use npm so package-lock.json is updated too, and update only the packages declared in the root workspaces.
166
+ /** @type {unknown} */
167
+ const workspacesConfig = pkg?.workspaces;
168
+ const hasWorkspaces = Array.isArray(workspacesConfig) || (workspacesConfig && typeof workspacesConfig === 'object' && Array.isArray(workspacesConfig.packages));
169
+
170
+ // Use npm so package-lock.json is updated too.
167
171
  // Allow same version so re-running can resync package-lock.json or out-of-sync workspace versions.
168
- await runCommand(
169
- 'npm',
170
- ['version', nextVersion, '--workspaces', '--include-workspace-root', '--no-workspaces-update', '--no-git-tag-version', '--ignore-scripts', '--allow-same-version'],
171
- {
172
- cwd: repoRoot,
173
- },
174
- );
172
+ const args = hasWorkspaces
173
+ ? ['version', nextVersion, '--workspaces', '--include-workspace-root', '--no-workspaces-update', '--no-git-tag-version', '--ignore-scripts', '--allow-same-version']
174
+ : ['version', nextVersion, '--no-git-tag-version', '--ignore-scripts', '--allow-same-version'];
175
+ await runCommand('npm', args, { cwd: repoRoot });
175
176
 
176
177
  return nextVersion;
177
178
  }
@@ -671,6 +672,13 @@ async function runCommand(command, args, options = {}) {
671
672
  */
672
673
  async function main() {
673
674
  const rawArgs = process.argv.slice(2);
675
+
676
+ // Validate that the current working directory is a package root.
677
+ if (!(await fileExists(path.join(repoRoot, 'package.json')))) {
678
+ printUsage();
679
+ throw new ExitError(1, `No package.json found in current working directory: ${repoRoot}`);
680
+ }
681
+
674
682
  if (rawArgs.length === 0) {
675
683
  printUsage();
676
684
  throw new ExitError(1, 'No arguments provided');