homebridge-tasmota 0.2.2-beta.0 → 0.2.3-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-esm.js +34 -22
- package/DEVICES.md +1 -39
- package/package.json +1 -1
|
@@ -9,8 +9,6 @@ import child_process from 'node:child_process'
|
|
|
9
9
|
import fs from 'node:fs'
|
|
10
10
|
import process from 'node:process'
|
|
11
11
|
|
|
12
|
-
import semver from 'semver'
|
|
13
|
-
|
|
14
12
|
const BRANCH_VERSION_PATTERN = /^([A-Z]+)-(\d+\.\d+\.\d+)$/i
|
|
15
13
|
|
|
16
14
|
// Load the contents of the package.json file
|
|
@@ -19,24 +17,29 @@ const packageJSON = JSON.parse(fs.readFileSync('package.json', 'utf8'))
|
|
|
19
17
|
const refArgument = process.argv[2]
|
|
20
18
|
const tagArgument = process.argv[3] || 'latest'
|
|
21
19
|
|
|
22
|
-
if (refArgument
|
|
20
|
+
if (!refArgument) {
|
|
23
21
|
console.error('ref argument is missing')
|
|
24
22
|
console.error('Usage: npm-version-script-esm.js <ref> [tag]')
|
|
25
23
|
process.exit(1)
|
|
26
24
|
}
|
|
27
25
|
|
|
28
26
|
/**
|
|
29
|
-
* Queries the NPM registry for the latest version for the provided tag.
|
|
30
|
-
*
|
|
31
|
-
*
|
|
27
|
+
* Queries the NPM registry for the latest version for the provided base version and tag.
|
|
28
|
+
* If the tag is latest, then the base version is returned if it exists. For other tags, the latest
|
|
29
|
+
* version found for that base version and tag is returned.
|
|
30
|
+
* @param baseVersion The base version to query for, e.g. 2.0.0
|
|
31
|
+
* @param tag The tag to query for, e.g. beta or latest
|
|
32
|
+
* @returns {string} Returns the version, or '' if not found
|
|
32
33
|
*/
|
|
33
|
-
function getTagVersionFromNpm(tag) {
|
|
34
|
+
function getTagVersionFromNpm(baseVersion, tag) {
|
|
34
35
|
try {
|
|
35
|
-
return child_process.execSync(`npm info ${packageJSON.name}
|
|
36
|
+
return JSON.parse(child_process.execSync(`npm info ${packageJSON.name} versions --json`).toString('utf8').trim())
|
|
37
|
+
.filter(v => tag === 'latest' ? v === baseVersion : v.startsWith(`${baseVersion}-${tag}.`)) // find all published versions for this base version and tag
|
|
38
|
+
.reduce((_, current) => current, '') // choose the last as they're sorted in ascending order, or '' if there are none
|
|
36
39
|
} catch (e) {
|
|
37
|
-
console.error(`Failed to query the npm registry for the latest version for tag: ${tag}
|
|
40
|
+
console.error(`Failed to query the npm registry for the latest version for tag: ${tag}`, e)
|
|
38
41
|
// throw e;
|
|
39
|
-
return '
|
|
42
|
+
return ''
|
|
40
43
|
}
|
|
41
44
|
}
|
|
42
45
|
|
|
@@ -65,21 +68,30 @@ function desiredTargetVersion(ref) {
|
|
|
65
68
|
const baseVersion = desiredTargetVersion(refArgument)
|
|
66
69
|
|
|
67
70
|
// query the npm registry for the latest version of the provided tag name
|
|
68
|
-
const latestReleasedVersion = getTagVersionFromNpm(tagArgument) // e.g. 0.7.0-beta.12
|
|
69
|
-
const latestReleaseBase = semver.inc(latestReleasedVersion, 'patch') // will produce 0.7.0 (removing the preid, needed for the equality check below)
|
|
71
|
+
const latestReleasedVersion = getTagVersionFromNpm(baseVersion, tagArgument) // e.g. 0.7.0-beta.12
|
|
70
72
|
|
|
71
73
|
let publishTag
|
|
72
|
-
|
|
73
|
-
|
|
74
|
+
|
|
75
|
+
if (latestReleasedVersion) {
|
|
76
|
+
console.warn(`Latest published version for ${baseVersion} with tag ${tagArgument} is ${latestReleasedVersion}`)
|
|
77
|
+
publishTag = latestReleasedVersion // set this released beta or alpha to be incremented
|
|
74
78
|
} else {
|
|
75
|
-
|
|
79
|
+
console.warn(`No published versions for ${baseVersion} with tag ${tagArgument}`)
|
|
80
|
+
publishTag = baseVersion // start off with a new beta or alpha version
|
|
76
81
|
}
|
|
77
82
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
83
|
+
if (packageJSON.version !== publishTag) {
|
|
84
|
+
// report the change for CI
|
|
85
|
+
console.warn(`Changing version in package.json from ${packageJSON.version} to ${publishTag}`)
|
|
86
|
+
|
|
87
|
+
// save the package.json
|
|
88
|
+
packageJSON.version = publishTag
|
|
89
|
+
fs.writeFileSync('package.json', JSON.stringify(packageJSON, null, 2))
|
|
81
90
|
|
|
82
|
-
// perform the same change to the package-lock.json
|
|
83
|
-
const packageLockJSON = JSON.parse(fs.readFileSync('package-lock.json', 'utf8'))
|
|
84
|
-
packageLockJSON.version = publishTag
|
|
85
|
-
fs.writeFileSync('package-lock.json', JSON.stringify(packageLockJSON, null, 2))
|
|
91
|
+
// perform the same change to the package-lock.json
|
|
92
|
+
const packageLockJSON = JSON.parse(fs.readFileSync('package-lock.json', 'utf8'))
|
|
93
|
+
packageLockJSON.version = publishTag
|
|
94
|
+
fs.writeFileSync('package-lock.json', JSON.stringify(packageLockJSON, null, 2))
|
|
95
|
+
} else {
|
|
96
|
+
console.warn(`Leaving version in package.json at ${packageJSON.version}`)
|
|
97
|
+
}
|
package/DEVICES.md
CHANGED
|
@@ -1,45 +1,7 @@
|
|
|
1
1
|
<H1>Sample Device Configurations ( My personal collection )</H1>
|
|
2
2
|
|
|
3
3
|
<!--ts-->
|
|
4
|
-
|
|
5
|
-
* [My standard config after setting name and device configuration ](#my-standard-config-after-setting-name-and-device-configuration-)
|
|
6
|
-
* [Tasmota Configuration](#tasmota-configuration)
|
|
7
|
-
* [Sonoff IFAN03](#sonoff-ifan03)
|
|
8
|
-
* [Tasmota Configuration](#tasmota-configuration-1)
|
|
9
|
-
* [configuration override of discovery object to create a FAN ( post version 0.1.0 )](#configuration-override-of-discovery-object-to-create-a-fan--post-version-010-)
|
|
10
|
-
* [configuration override of discovery object to create a FAN ( pre version 0.1.0 )](#configuration-override-of-discovery-object-to-create-a-fan--pre-version-010-)
|
|
11
|
-
* [Slave a FEIT Wifi Dimmer Wall Switch to an iFan as a light switch](#slave-a-feit-wifi-dimmer-wall-switch-to-an-ifan-as-a-light-switch)
|
|
12
|
-
* [BME280 Temperature Sensor - <a href="docs/MCUIOT.md">MCUIOT</a>](docs/MCUIOT.md)
|
|
13
|
-
* [DHT11 Temperature Sensor - <a href="docs/MCUIOT.md">MCUIOT</a>](docs/MCUIOT.md)
|
|
14
|
-
* [Water Leak Sensor with On/Off control](#water-leak-sensor-with-onoff-control)
|
|
15
|
-
* [LEAK Tasmota configuration - <a href="docs/MCUIOT.md#dht-yl">DHT11</a>](docs/MCUIOT.md#dht-yl)
|
|
16
|
-
* [Leak Tasmota configuration - <a href="docs/MCUIOT.md#dht-yl">BME280</a>](docs/MCUIOT.md#dht-yl)
|
|
17
|
-
* [Motion + BME280 Temperature Sensor](#motion--bme280-temperature-sensor)
|
|
18
|
-
* [PIR Motion + BME280 Temperature Sensor + BH1750 Lux Illuminance Sensor](#pir-motion--bme280-temperature-sensor--bh1750-lux-illuminance-sensor)
|
|
19
|
-
* [ZMAi-90 Current Sensor Switch](#zmai-90-current-sensor-switch)
|
|
20
|
-
* [MCULED Device with RGB+W Strip](#mculed-device-with-rgbw-strip)
|
|
21
|
-
* [MCULED Device with RGB+W Strip - Version 2 ( Basement )](#mculed-device-with-rgbw-strip---version-2--basement-)
|
|
22
|
-
* [MCULED Device with RGB+W Strip - Version 2 ( Cottage Sink )](#mculed-device-with-rgbw-strip---version-2--cottage-sink-)
|
|
23
|
-
* [Tuya Dimmer Module as a FAN](#tuya-dimmer-module-as-a-fan)
|
|
24
|
-
* [Trailer Relay Board](#trailer-relay-board)
|
|
25
|
-
* [Gowfeel EN71 Water Valve](#gowfeel-en71-water-valve)
|
|
26
|
-
* [Homebrew Doorbutton Button](#homebrew-doorbutton-button)
|
|
27
|
-
* [Homebrew Garage Door Opener](#homebrew-garage-door-opener)
|
|
28
|
-
* [CE SMART Wifi Dimmer](#ce-smart-wifi-dimmer)
|
|
29
|
-
* [FEIT Wifi Dimmer](#feit-wifi-dimmer)
|
|
30
|
-
* [Using a FEIT Wifi Dimmer as a remote switch to OpenBK RGBCCT Potlights](#using-a-feit-wifi-dimmer-as-a-remote-switch-to-openbk-rgbcct-potlights)
|
|
31
|
-
* [Turn off after 30 minutes](#turn-off-after-30-minutes)
|
|
32
|
-
* [Hampton Bay Fan/Light RF Remote Control ( 303.9 Mhz )](#hampton-bay-fanlight-rf-remote-control--3039-mhz-)
|
|
33
|
-
* [Valor Fireplace Remote ( 315 Mhz )](#valor-fireplace-remote--315-mhz-)
|
|
34
|
-
* [Treatlife DS03 Fan Controller and Light Dimmer](#treatlife-ds03-fan-controller-and-light-dimmer)
|
|
35
|
-
* [OpenMQTTGateway devices](#openmqttgateway-devices)
|
|
36
|
-
* [Hampton Bay Light](#hampton-bay-light)
|
|
37
|
-
* [Hampton Bay FAN](#hampton-bay-fan)
|
|
38
|
-
* [openMQTTGateway / PiLight temperature sensor](#openmqttgateway--pilight-temperature-sensor)
|
|
39
|
-
* [Internet Connection WatchDog](#internet-connection-watchdog)
|
|
40
|
-
* [Version 1 ( Uses node-red to monitor google.com and turn off the plug )](#version-1--uses-node-red-to-monitor-googlecom-and-turn-off-the-plug-)
|
|
41
|
-
* [Version 2](#version-2)
|
|
42
|
-
* [Version 3 - Do three checks before rebooting](#version-3---do-three-checks-before-rebooting)
|
|
4
|
+
|
|
43
5
|
<!--te-->
|
|
44
6
|
|
|
45
7
|
# My standard config after setting name and device configuration <!-- omit in toc -->
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"displayName": "Tasmota",
|
|
3
3
|
"name": "homebridge-tasmota",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.3-beta.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Homebridge plugin for Tasmota devices leveraging home assistant auto discovery.",
|
|
7
7
|
"license": "Apache-2.0",
|