@switchbot/homebridge-switchbot 4.3.0 → 4.3.1-beta.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/.github/npm-version-script.cjs +81 -0
- package/config.schema.json +60 -24
- package/docs/functions/default.html +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
#!/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* This scripts queries the npm registry to pull out the latest version for a given tag.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const fs = require("fs");
|
|
8
|
+
const semver = require("semver");
|
|
9
|
+
const child_process = require("child_process");
|
|
10
|
+
const assert = require("assert");
|
|
11
|
+
|
|
12
|
+
const BRANCH_VERSION_PATTERN = /^([A-Za-z]*)-(\d+.\d+.\d+)$/
|
|
13
|
+
|
|
14
|
+
// Load the contents of the package.json file
|
|
15
|
+
const packageJSON = JSON.parse(fs.readFileSync("package.json", "utf8"));
|
|
16
|
+
|
|
17
|
+
let refArgument = process.argv[2];
|
|
18
|
+
let tagArgument = process.argv[3] || "latest";
|
|
19
|
+
|
|
20
|
+
if (refArgument == null) {
|
|
21
|
+
console.error("ref argument is missing");
|
|
22
|
+
console.error("Usage: npm-version-script.cjs <ref> [tag]");
|
|
23
|
+
process.exit(1);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Queries the NPM registry for the latest version for the provided tag.
|
|
28
|
+
* @param tag The tag to query for.
|
|
29
|
+
* @returns {string} Returns the version.
|
|
30
|
+
*/
|
|
31
|
+
function getTagVersionFromNpm(tag) {
|
|
32
|
+
try {
|
|
33
|
+
return child_process.execSync(`npm info ${packageJSON.name} version --tag="${tag}"`).toString("utf8").trim();
|
|
34
|
+
} catch (e) {
|
|
35
|
+
throw e;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function desiredTargetVersion(ref) {
|
|
40
|
+
// ref is a GitHub action ref string
|
|
41
|
+
if (ref.startsWith("refs/pull/")) {
|
|
42
|
+
throw Error("The version script was executed inside a PR!");
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
assert(ref.startsWith("refs/heads/"))
|
|
46
|
+
let branchName = ref.slice("refs/heads/".length);
|
|
47
|
+
|
|
48
|
+
let results = branchName.match(BRANCH_VERSION_PATTERN);
|
|
49
|
+
if (results != null) {
|
|
50
|
+
if (results[1] !== tagArgument) {
|
|
51
|
+
console.warn(`The base branch name (${results[1]}) differs from the tag name ${tagArgument}`);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return results[2];
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// legacy mode were we use the `betaVersion` property in the package.json
|
|
58
|
+
if (branchName === "beta" && packageJSON.betaVersion) {
|
|
59
|
+
return packageJSON.betaVersion
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
throw new Error("Malformed branch name for ref: " + ref + ". Can't derive the base version. Use a branch name like: beta-x.x.x!");
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// derive the base version from the branch ref
|
|
66
|
+
const baseVersion = desiredTargetVersion(refArgument);
|
|
67
|
+
|
|
68
|
+
// query the npm registry for the latest version of the provided tag name
|
|
69
|
+
const latestReleasedVersion = getTagVersionFromNpm(tagArgument); // e.g. 0.7.0-beta.12
|
|
70
|
+
const latestReleaseBase = semver.inc(latestReleasedVersion, "patch"); // will produce 0.7.0 (removing the preid, needed for the equality check below)
|
|
71
|
+
|
|
72
|
+
let publishTag;
|
|
73
|
+
if (semver.eq(baseVersion, latestReleaseBase)) { // check if we are releasing another version for the latest beta
|
|
74
|
+
publishTag = latestReleasedVersion; // set the current latest beta to be incremented
|
|
75
|
+
} else {
|
|
76
|
+
publishTag = baseVersion; // start of with a new beta version
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// save the package.json
|
|
80
|
+
packageJSON.version = publishTag;
|
|
81
|
+
fs.writeFileSync("package.json", JSON.stringify(packageJSON, null, 2));
|
package/config.schema.json
CHANGED
|
@@ -447,19 +447,27 @@
|
|
|
447
447
|
"oneOf": [
|
|
448
448
|
{
|
|
449
449
|
"title": "Default",
|
|
450
|
-
"enum": [
|
|
450
|
+
"enum": [
|
|
451
|
+
""
|
|
452
|
+
]
|
|
451
453
|
},
|
|
452
454
|
{
|
|
453
455
|
"title": "Multi-Press",
|
|
454
|
-
"enum": [
|
|
456
|
+
"enum": [
|
|
457
|
+
"multipress"
|
|
458
|
+
]
|
|
455
459
|
},
|
|
456
460
|
{
|
|
457
461
|
"title": "Press",
|
|
458
|
-
"enum": [
|
|
462
|
+
"enum": [
|
|
463
|
+
"press"
|
|
464
|
+
]
|
|
459
465
|
},
|
|
460
466
|
{
|
|
461
467
|
"title": "Switch",
|
|
462
|
-
"enum": [
|
|
468
|
+
"enum": [
|
|
469
|
+
"switch"
|
|
470
|
+
]
|
|
463
471
|
}
|
|
464
472
|
],
|
|
465
473
|
"condition": {
|
|
@@ -474,27 +482,39 @@
|
|
|
474
482
|
"oneOf": [
|
|
475
483
|
{
|
|
476
484
|
"title": "Default",
|
|
477
|
-
"enum": [
|
|
485
|
+
"enum": [
|
|
486
|
+
""
|
|
487
|
+
]
|
|
478
488
|
},
|
|
479
489
|
{
|
|
480
490
|
"title": "Down and Up",
|
|
481
|
-
"enum": [
|
|
491
|
+
"enum": [
|
|
492
|
+
"down_and_up"
|
|
493
|
+
]
|
|
482
494
|
},
|
|
483
495
|
{
|
|
484
496
|
"title": "Only Down",
|
|
485
|
-
"enum": [
|
|
497
|
+
"enum": [
|
|
498
|
+
"only_down"
|
|
499
|
+
]
|
|
486
500
|
},
|
|
487
501
|
{
|
|
488
502
|
"title": "Only Up",
|
|
489
|
-
"enum": [
|
|
503
|
+
"enum": [
|
|
504
|
+
"only_up"
|
|
505
|
+
]
|
|
490
506
|
},
|
|
491
507
|
{
|
|
492
508
|
"title": "Up and Down",
|
|
493
|
-
"enum": [
|
|
509
|
+
"enum": [
|
|
510
|
+
"up_and_down"
|
|
511
|
+
]
|
|
494
512
|
},
|
|
495
513
|
{
|
|
496
514
|
"title": "Use Tilt for Direction",
|
|
497
|
-
"enum": [
|
|
515
|
+
"enum": [
|
|
516
|
+
"use_tilt_for_direction"
|
|
517
|
+
]
|
|
498
518
|
}
|
|
499
519
|
],
|
|
500
520
|
"condition": {
|
|
@@ -851,8 +871,6 @@
|
|
|
851
871
|
}
|
|
852
872
|
}
|
|
853
873
|
},
|
|
854
|
-
"if": { "properties": "model.options.devices" },
|
|
855
|
-
"then": { "properties": { "model.options.devices[arrayIndices].logging": { "required": true } } },
|
|
856
874
|
"uniqueItems": true
|
|
857
875
|
},
|
|
858
876
|
"deviceConfig": {
|
|
@@ -1323,19 +1341,27 @@
|
|
|
1323
1341
|
"oneOf": [
|
|
1324
1342
|
{
|
|
1325
1343
|
"title": "Default",
|
|
1326
|
-
"enum": [
|
|
1344
|
+
"enum": [
|
|
1345
|
+
""
|
|
1346
|
+
]
|
|
1327
1347
|
},
|
|
1328
1348
|
{
|
|
1329
1349
|
"title": "Multi-Press",
|
|
1330
|
-
"enum": [
|
|
1350
|
+
"enum": [
|
|
1351
|
+
"multipress"
|
|
1352
|
+
]
|
|
1331
1353
|
},
|
|
1332
1354
|
{
|
|
1333
1355
|
"title": "Press",
|
|
1334
|
-
"enum": [
|
|
1356
|
+
"enum": [
|
|
1357
|
+
"press"
|
|
1358
|
+
]
|
|
1335
1359
|
},
|
|
1336
1360
|
{
|
|
1337
1361
|
"title": "Switch",
|
|
1338
|
-
"enum": [
|
|
1362
|
+
"enum": [
|
|
1363
|
+
"switch"
|
|
1364
|
+
]
|
|
1339
1365
|
}
|
|
1340
1366
|
]
|
|
1341
1367
|
},
|
|
@@ -4879,27 +4905,39 @@
|
|
|
4879
4905
|
"oneOf": [
|
|
4880
4906
|
{
|
|
4881
4907
|
"title": "Default",
|
|
4882
|
-
"enum": [
|
|
4908
|
+
"enum": [
|
|
4909
|
+
""
|
|
4910
|
+
]
|
|
4883
4911
|
},
|
|
4884
4912
|
{
|
|
4885
4913
|
"title": "Down and Up",
|
|
4886
|
-
"enum": [
|
|
4914
|
+
"enum": [
|
|
4915
|
+
"down_and_up"
|
|
4916
|
+
]
|
|
4887
4917
|
},
|
|
4888
4918
|
{
|
|
4889
4919
|
"title": "Only Down",
|
|
4890
|
-
"enum": [
|
|
4920
|
+
"enum": [
|
|
4921
|
+
"only_down"
|
|
4922
|
+
]
|
|
4891
4923
|
},
|
|
4892
4924
|
{
|
|
4893
4925
|
"title": "Only Up",
|
|
4894
|
-
"enum": [
|
|
4926
|
+
"enum": [
|
|
4927
|
+
"only_up"
|
|
4928
|
+
]
|
|
4895
4929
|
},
|
|
4896
4930
|
{
|
|
4897
4931
|
"title": "Up and Down",
|
|
4898
|
-
"enum": [
|
|
4932
|
+
"enum": [
|
|
4933
|
+
"up_and_down"
|
|
4934
|
+
]
|
|
4899
4935
|
},
|
|
4900
4936
|
{
|
|
4901
4937
|
"title": "Use Tilt for Direction",
|
|
4902
|
-
"enum": [
|
|
4938
|
+
"enum": [
|
|
4939
|
+
"use_tilt_for_direction"
|
|
4940
|
+
]
|
|
4903
4941
|
}
|
|
4904
4942
|
],
|
|
4905
4943
|
"condition": {
|
|
@@ -9075,8 +9113,6 @@
|
|
|
9075
9113
|
}
|
|
9076
9114
|
}
|
|
9077
9115
|
},
|
|
9078
|
-
"if": { "properties": "model.options.irdevices" },
|
|
9079
|
-
"then": { "properties": { "model.options.irdevices[arrayIndices].logging": { "required": true } } },
|
|
9080
9116
|
"uniqueItems": true
|
|
9081
9117
|
},
|
|
9082
9118
|
"irdeviceConfig": {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
<!DOCTYPE html><html class="default" lang="en" data-base=".."><head><style>body { visibility: hidden; }</style><meta charset="utf-8"><meta http-equiv="x-ua-compatible" content="IE=edge"><title>default | @switchbot/homebridge-switchbot</title><meta name="description" content="Documentation for @switchbot/homebridge-switchbot"><meta name="viewport" content="width=device-width, initial-scale=1"><link rel="stylesheet" href="../assets/style.css"><link rel="stylesheet" href="../assets/highlight.css"><script defer="" src="../assets/main.js"></script><script async="" src="../assets/icons.js" id="tsd-icons-script"></script><link rel="stylesheet" href="../assets/dmt/dmt-components.css"><link rel="stylesheet" href="../assets/dmt/dmt-theme.css"><script src="../assets/dmt/dmt-components.js" type="module"></script><noscript><style>body { visibility: visible; }</style></noscript></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";</script><div class="overlay"></div>
|
|
2
|
-
<main><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search"><div class="field" id="dmt-search-main"></div><div class="field" id="dmt-toolbar"><a href="../index.html" class="title">@switchbot/homebridge-switchbot</a></div></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main" tabindex="-1"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"></ul><div class="dmt-title-header-flex"><h1>Function default</h1></div></div><section class="tsd-panel"><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="default" class="tsd-anchor"></a><span class="tsd-kind-call-signature">default</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">api</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">API</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">void</span><a href="#default" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">api</span>: <span class="tsd-signature-type">API</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/OpenWonderLabs/homebridge-switchbot/blob/
|
|
2
|
+
<main><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search"><div class="field" id="dmt-search-main"></div><div class="field" id="dmt-toolbar"><a href="../index.html" class="title">@switchbot/homebridge-switchbot</a></div></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main" tabindex="-1"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"></ul><div class="dmt-title-header-flex"><h1>Function default</h1></div></div><section class="tsd-panel"><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="default" class="tsd-anchor"></a><span class="tsd-kind-call-signature">default</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">api</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">API</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">void</span><a href="#default" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">api</span>: <span class="tsd-signature-type">API</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/OpenWonderLabs/homebridge-switchbot/blob/e9c171721c6ea04e98771b0caa536f8996eb93e3/src/index.ts#L11">index.ts:11</a></li></ul></aside></li></ul></section></div><div class="col-sidebar" tabindex="-1"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked=""><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu" tabindex="-1"><nav class="tsd-navigation"><a href="../modules.html">@switchbot/homebridge-switchbot</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"></ul></nav></div></div></div></main></body></html>
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@switchbot/homebridge-switchbot",
|
|
3
3
|
"displayName": "SwitchBot",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "4.3.0",
|
|
5
|
+
"version": "4.3.1-beta.0",
|
|
6
6
|
"description": "The SwitchBot plugin allows you to access your SwitchBot device(s) from HomeKit.",
|
|
7
7
|
"author": "SwitchBot <support@wondertechlabs.com> (https://github.com/SwitchBot)",
|
|
8
8
|
"contributors": [
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
"@types/source-map-support": "^0.5.10",
|
|
98
98
|
"@typhonjs-typedoc/typedoc-theme-dmt": "^0.3.1",
|
|
99
99
|
"@vitest/coverage-v8": "^3.0.0",
|
|
100
|
-
"eslint": "^9.
|
|
100
|
+
"eslint": "^9.19.0",
|
|
101
101
|
"eslint-plugin-format": "^1.0.1",
|
|
102
102
|
"homebridge": "^1.8.5",
|
|
103
103
|
"homebridge-config-ui-x": "4.68.0",
|