Skip to content

Commit 751bd14

Browse files
committed
Release 3.0.5
1 parent caecb01 commit 751bd14

File tree

10 files changed

+101
-34
lines changed

10 files changed

+101
-34
lines changed

.devcontainer/devcontainer.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ Dev containers have networking limitations depending on the host OS and Docker s
5252
// Use a shared bridge network to allow to access other containers with their names (dns resolution). With the default bridge, dns resolution does not work (only ip:port).
5353
"--network=matterbridge"
5454
],
55+
// Publish the Matterbridge UI port on the Docker host (so http://localhost:8283 works even without VS Code port forwarding)
56+
"appPort": [8283],
5557
"customizations": {
5658
"vscode": {
5759
// Extensions to install in the dev container
@@ -67,6 +69,7 @@ Dev containers have networking limitations depending on the host OS and Docker s
6769
// Settings for the VS Code environment
6870
"settings": {
6971
"terminal.integrated.shell.linux": "/bin/bash",
72+
"terminal.integrated.scrollback": 10000,
7073
"editor.tabSize": 2,
7174
"editor.formatOnSave": true,
7275
"editor.codeActionsOnSave": {

.github/workflows/build.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ jobs:
2929
node-version: ${{ matrix.node-version }}
3030
cache: npm
3131

32+
- name: Verify Node.js version
33+
run: node -v
34+
35+
- name: Verify Npm version
36+
run: npm -v
37+
3238
- name: Clone matterbridge repo
3339
run: git clone --depth 1 --single-branch --no-tags https://github.com/Luligu/matterbridge.git ../matterbridge
3440

.github/workflows/codecov.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ jobs:
2525
node-version: '24.x'
2626
cache: npm
2727

28+
- name: Verify Node.js version
29+
run: node -v
30+
31+
- name: Verify Npm version
32+
run: npm -v
33+
2834
- name: Clone matterbridge repo
2935
run: git clone --depth 1 --single-branch --no-tags https://github.com/Luligu/matterbridge.git ../matterbridge
3036

@@ -41,10 +47,10 @@ jobs:
4147
run: npm link --no-fund --no-audit
4248

4349
- name: Install dependencies
44-
run: npm ci
50+
run: npm ci --no-fund --no-audit
4551

4652
- name: Link matterbridge in the project
47-
run: npm link matterbridge
53+
run: npm link matterbridge --no-fund --no-audit
4854

4955
- name: Run tests
5056
run: npm run test:coverage -- --forceExit

.github/workflows/publish.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,10 @@ jobs:
5656
run: npm link --no-fund --no-audit
5757

5858
- name: Install plugin dependencies
59-
run: npm ci
59+
run: npm ci --no-fund --no-audit
6060

6161
- name: Link matterbridge in the project
62-
run: npm link matterbridge
62+
run: npm link matterbridge --no-fund --no-audit
6363

6464
- name: Build the plugin
6565
run: npm run build
@@ -149,10 +149,10 @@ jobs:
149149
run: npm link --no-fund --no-audit
150150

151151
- name: Install plugin dependencies
152-
run: npm ci
152+
run: npm ci --no-fund --no-audit
153153

154154
- name: Link matterbridge in the plugin
155-
run: npm link matterbridge
155+
run: npm link matterbridge --no-fund --no-audit
156156

157157
- name: Build the plugin
158158
run: npm run build

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
[![linted with eslint](https://img.shields.io/badge/linted_with-ES_Lint-4B32C3.svg?logo=eslint)](https://github.com/eslint/eslint)
1212
[![TypeScript](https://img.shields.io/badge/TypeScript-3178C6?logo=typescript&logoColor=white)](https://www.typescriptlang.org/)
1313
[![ESM](https://img.shields.io/badge/ESM-Node.js-339933?logo=node.js&logoColor=white)](https://nodejs.org/api/esm.html)
14+
[![matterbridge.io](https://img.shields.io/badge/matterbridge.io-online-brightgreen)](https://matterbridge.io)
1415

1516
[![powered by](https://img.shields.io/badge/powered%20by-matterbridge-blue)](https://www.npmjs.com/package/matterbridge)
1617
[![powered by](https://img.shields.io/badge/powered%20by-matter--history-blue)](https://www.npmjs.com/package/matter-history)

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
[![linted with eslint](https://img.shields.io/badge/linted_with-ES_Lint-4B32C3.svg?logo=eslint)](https://github.com/eslint/eslint)
1212
[![TypeScript](https://img.shields.io/badge/TypeScript-3178C6?logo=typescript&logoColor=white)](https://www.typescriptlang.org/)
1313
[![ESM](https://img.shields.io/badge/ESM-Node.js-339933?logo=node.js&logoColor=white)](https://nodejs.org/api/esm.html)
14+
[![matterbridge.io](https://img.shields.io/badge/matterbridge.io-online-brightgreen)](https://matterbridge.io)
1415

1516
[![powered by](https://img.shields.io/badge/powered%20by-matterbridge-blue)](https://www.npmjs.com/package/matterbridge)
1617
[![powered by](https://img.shields.io/badge/powered%20by-matter--history-blue)](https://www.npmjs.com/package/matter-history)

package-lock.json

Lines changed: 22 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@
117117
},
118118
"dependencies": {
119119
"moment": "2.30.1",
120-
"mqtt": "5.14.1",
120+
"mqtt": "5.15.0",
121121
"node-ansi-logger": "3.1.1",
122122
"node-persist-manager": "2.0.0"
123123
},
@@ -132,7 +132,7 @@
132132
"eslint": "9.39.2",
133133
"eslint-config-prettier": "10.1.8",
134134
"eslint-plugin-import": "2.32.0",
135-
"eslint-plugin-jest": "29.12.1",
135+
"eslint-plugin-jest": "29.12.2",
136136
"eslint-plugin-jsdoc": "62.5.0",
137137
"eslint-plugin-n": "17.23.2",
138138
"eslint-plugin-prettier": "5.5.5",

scripts/version.mjs

Lines changed: 53 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,21 @@
1+
/* eslint-disable no-console */
2+
/* eslint-disable jsdoc/require-jsdoc */
3+
import { execFileSync } from 'node:child_process';
14
import fs from 'node:fs/promises';
25
import path from 'node:path';
36
import { fileURLToPath } from 'node:url';
47

58
function usage() {
6-
return ['Usage: node scripts/version.mjs <dev|edge>', '', 'Updates package.json version to:', ' <baseVersion>-<dev|edge>-<yyyymmdd>-<7digitRandom>'].join('\n');
9+
return [
10+
'Usage: node scripts/version.mjs <dev|edge> [--dry-run]',
11+
' or: node scripts/version.mjs --dry-run <dev|edge>',
12+
'',
13+
'Updates package.json version to:',
14+
' <baseVersion>-<dev|edge>-<yyyymmdd>-<7charSha>',
15+
'',
16+
'Options:',
17+
' --dry-run, -n Print the next version but do not write package.json',
18+
].join('\n');
719
}
820

921
function formatYyyymmdd(date) {
@@ -13,8 +25,25 @@ function formatYyyymmdd(date) {
1325
return `${year}${month}${day}`;
1426
}
1527

16-
function random7Digits() {
17-
return String(Math.floor(1_000_000 + Math.random() * 9_000_000));
28+
function shortSha7FromGit(repoRoot) {
29+
const out = execFileSync('git', ['rev-parse', '--short=7', 'HEAD'], {
30+
cwd: repoRoot,
31+
encoding: 'utf8',
32+
stdio: ['ignore', 'pipe', 'ignore'],
33+
});
34+
const sha = String(out).trim();
35+
if (!/^[0-9a-f]{7}$/i.test(sha)) {
36+
throw new Error(`Unexpected git short SHA output: ${JSON.stringify(sha)}`);
37+
}
38+
return sha.toLowerCase();
39+
}
40+
41+
function getShortSha7(repoRoot) {
42+
try {
43+
return shortSha7FromGit(repoRoot);
44+
} catch (err) {
45+
throw new Error(`Unable to determine git short SHA. (${err instanceof Error ? err.message : String(err)})`);
46+
}
1847
}
1948

2049
function requirePlainSemver(version) {
@@ -25,7 +54,19 @@ function requirePlainSemver(version) {
2554
return trimmed;
2655
}
2756

28-
const tag = process.argv[2]?.toLowerCase();
57+
const args = process.argv.slice(2);
58+
const knownFlags = new Set(['--dry-run', '-n']);
59+
const unknownFlags = args.filter((a) => a.startsWith('-') && !knownFlags.has(a));
60+
if (unknownFlags.length > 0) {
61+
console.error(`Unknown option(s): ${unknownFlags.join(', ')}`);
62+
console.error(usage());
63+
process.exitCode = 1;
64+
throw new Error('Unknown option(s).');
65+
}
66+
67+
const dryRun = args.includes('--dry-run') || args.includes('-n');
68+
const positional = args.filter((a) => !a.startsWith('-'));
69+
const tag = positional[0]?.toLowerCase();
2970
if (tag !== 'dev' && tag !== 'edge') {
3071
console.error(usage());
3172
process.exitCode = 1;
@@ -43,10 +84,14 @@ const pkg = JSON.parse(raw);
4384
const currentVersion = pkg.version;
4485
const baseVersion = requirePlainSemver(currentVersion);
4586
const yyyymmdd = formatYyyymmdd(new Date());
46-
const rand = random7Digits();
87+
const sha7 = getShortSha7(repoRoot);
4788

48-
const nextVersion = `${baseVersion}-${tag}-${yyyymmdd}-${rand}`;
89+
const nextVersion = `${baseVersion}-${tag}-${yyyymmdd}-${sha7}`;
4990
pkg.version = nextVersion;
5091

51-
await fs.writeFile(packageJsonPath, `${JSON.stringify(pkg, null, 2)}\n`, 'utf8');
52-
console.log(`package.json version: ${currentVersion} -> ${nextVersion}`);
92+
if (dryRun) {
93+
console.log(`[dry-run] package.json version: ${currentVersion} -> ${nextVersion}`);
94+
} else {
95+
await fs.writeFile(packageJsonPath, `${JSON.stringify(pkg, null, 2)}\n`, 'utf8');
96+
console.log(`package.json version: ${currentVersion} -> ${nextVersion}`);
97+
}

tsconfig.production.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"rootDir": "src",
66
"incremental": false,
77
"composite": false,
8-
"declaration": true,
8+
"declaration": false,
99
"declarationMap": false,
1010
"sourceMap": false,
1111
"removeComments": true

0 commit comments

Comments
 (0)