@homebridge-plugins/homebridge-firstalert 0.0.1-beta.6 → 0.0.1-beta.8

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 (151) hide show
  1. package/.github/FUNDING.yml +4 -0
  2. package/.github/ISSUE_TEMPLATE/bug-report.yml +97 -0
  3. package/.github/ISSUE_TEMPLATE/config.yml +8 -0
  4. package/.github/ISSUE_TEMPLATE/feature-request.yml +38 -0
  5. package/.github/ISSUE_TEMPLATE/support-request.yml +85 -0
  6. package/.github/ISSUE_TEMPLATE.md +52 -0
  7. package/.github/PULL_REQUEST_TEMPLATE/pull_request.md +27 -0
  8. package/.github/dependabot.yml +17 -0
  9. package/.github/labeler.yml +38 -0
  10. package/.github/npm-version-script-esm.js +97 -0
  11. package/.github/release-drafter.yml +33 -0
  12. package/.github/workflows/beta-release.yml +55 -0
  13. package/.github/workflows/build.yml +18 -0
  14. package/.github/workflows/changerelease.yml +11 -0
  15. package/.github/workflows/labeler.yml +9 -0
  16. package/.github/workflows/release-drafter.yml +14 -0
  17. package/.github/workflows/release.yml +35 -0
  18. package/.github/workflows/stale.yml +12 -0
  19. package/API/README.md +310 -0
  20. package/API/RESIDEO_API.md +377 -0
  21. package/API/resideo_firstalert/__init__.py +75 -0
  22. package/API/resideo_firstalert/api.py +321 -0
  23. package/API/resideo_firstalert/application_credentials.py +122 -0
  24. package/API/resideo_firstalert/auth.py +336 -0
  25. package/API/resideo_firstalert/binary_sensor.py +245 -0
  26. package/API/resideo_firstalert/config_flow.py +429 -0
  27. package/API/resideo_firstalert/const.py +48 -0
  28. package/API/resideo_firstalert/coordinator.py +53 -0
  29. package/API/resideo_firstalert/icon.png +0 -0
  30. package/API/resideo_firstalert/manifest.json +13 -0
  31. package/API/resideo_firstalert/sensor.py +284 -0
  32. package/API/resideo_firstalert/strings.json +265 -0
  33. package/API/resideo_firstalert/translations/en.json +265 -0
  34. package/CHANGELOG.md +10 -0
  35. package/RESIDEO_API_REFERENCE.md +227 -0
  36. package/SECURITY.md +19 -0
  37. package/config.schema.json +63 -0
  38. package/dist/api/resideoClient.d.ts.map +1 -0
  39. package/dist/api/resideoClient.js.map +1 -0
  40. package/dist/{src/devices → devices}/device.d.ts +1 -1
  41. package/dist/devices/device.d.ts.map +1 -0
  42. package/dist/devices/device.js.map +1 -0
  43. package/dist/{src/devices → devices}/leaksensors.d.ts +2 -2
  44. package/dist/devices/leaksensors.d.ts.map +1 -0
  45. package/dist/devices/leaksensors.js.map +1 -0
  46. package/dist/{src/devices → devices}/smoke.d.ts +2 -2
  47. package/dist/devices/smoke.d.ts.map +1 -0
  48. package/dist/devices/smoke.js.map +1 -0
  49. package/dist/{src/devices → devices}/thermostats.d.ts +1 -1
  50. package/dist/devices/thermostats.d.ts.map +1 -0
  51. package/dist/devices/thermostats.js.map +1 -0
  52. package/dist/{src/devices → devices}/valve.d.ts +2 -2
  53. package/dist/devices/valve.d.ts.map +1 -0
  54. package/dist/devices/valve.js.map +1 -0
  55. package/dist/homebridge-ui/public/css/style.css +67 -0
  56. package/dist/homebridge-ui/public/index.html +10 -145
  57. package/dist/homebridge-ui/public/js/ui.d.ts +2 -0
  58. package/dist/homebridge-ui/public/js/ui.d.ts.map +1 -0
  59. package/dist/homebridge-ui/public/js/ui.js +131 -0
  60. package/dist/homebridge-ui/public/js/ui.js.map +7 -0
  61. package/dist/homebridge-ui/public/js/ui.ts +144 -0
  62. package/dist/{src/homebridge-ui → homebridge-ui}/server.d.ts.map +1 -1
  63. package/dist/homebridge-ui/server.js +1 -1
  64. package/dist/homebridge-ui/server.js.map +1 -1
  65. package/dist/index.d.ts.map +1 -0
  66. package/dist/index.js.map +1 -0
  67. package/dist/platform.d.ts.map +1 -0
  68. package/dist/{src/platform.js → platform.js} +2 -2
  69. package/dist/platform.js.map +1 -0
  70. package/dist/settings.d.ts.map +1 -0
  71. package/dist/settings.js.map +1 -0
  72. package/dist/utils.d.ts.map +1 -0
  73. package/dist/{src/utils.js → utils.js} +2 -1
  74. package/dist/utils.js.map +1 -0
  75. package/docs/.nojekyll +1 -0
  76. package/docs/assets/hierarchy.js +1 -0
  77. package/docs/assets/highlight.css +22 -0
  78. package/docs/assets/icons.js +18 -0
  79. package/docs/assets/icons.svg +1 -0
  80. package/docs/assets/main.js +60 -0
  81. package/docs/assets/navigation.js +1 -0
  82. package/docs/assets/search.js +1 -0
  83. package/docs/assets/style.css +1633 -0
  84. package/docs/hierarchy.html +1 -0
  85. package/docs/index.html +77 -0
  86. package/docs/modules.html +1 -0
  87. package/docs/variables/default.html +1 -0
  88. package/eslint.config.js +48 -0
  89. package/homebridge-plugins-homebridge-firstalert-1.0.0.tgz +0 -0
  90. package/package.json +16 -12
  91. package/scripts/build-ui.js +37 -0
  92. package/scripts/free-dev-ports.mjs +105 -0
  93. package/test/index.test.ts +19 -0
  94. package/test/platform.test.ts +66 -0
  95. package/test/settings.test.ts +56 -0
  96. package/test/utils.test.ts +20 -0
  97. package/tsconfig.ui.json +13 -0
  98. package/typedoc.json +22 -0
  99. package/vitest.config.ts +7 -0
  100. package/dist/src/api/resideoClient.d.ts.map +0 -1
  101. package/dist/src/api/resideoClient.js.map +0 -1
  102. package/dist/src/devices/device.d.ts.map +0 -1
  103. package/dist/src/devices/device.js.map +0 -1
  104. package/dist/src/devices/leaksensors.d.ts.map +0 -1
  105. package/dist/src/devices/leaksensors.js.map +0 -1
  106. package/dist/src/devices/smoke.d.ts.map +0 -1
  107. package/dist/src/devices/smoke.js.map +0 -1
  108. package/dist/src/devices/thermostats.d.ts.map +0 -1
  109. package/dist/src/devices/thermostats.js.map +0 -1
  110. package/dist/src/devices/valve.d.ts.map +0 -1
  111. package/dist/src/devices/valve.js.map +0 -1
  112. package/dist/src/homebridge-ui/server.js +0 -181
  113. package/dist/src/homebridge-ui/server.js.map +0 -1
  114. package/dist/src/index.d.ts.map +0 -1
  115. package/dist/src/index.js.map +0 -1
  116. package/dist/src/platform.d.ts.map +0 -1
  117. package/dist/src/platform.js.map +0 -1
  118. package/dist/src/settings.d.ts.map +0 -1
  119. package/dist/src/settings.js.map +0 -1
  120. package/dist/src/utils.d.ts.map +0 -1
  121. package/dist/src/utils.js.map +0 -1
  122. package/dist/test/index.test.d.ts +0 -2
  123. package/dist/test/index.test.d.ts.map +0 -1
  124. package/dist/test/index.test.js +0 -14
  125. package/dist/test/index.test.js.map +0 -1
  126. package/dist/test/platform.test.d.ts +0 -2
  127. package/dist/test/platform.test.d.ts.map +0 -1
  128. package/dist/test/platform.test.js +0 -56
  129. package/dist/test/platform.test.js.map +0 -1
  130. package/dist/test/settings.test.d.ts +0 -2
  131. package/dist/test/settings.test.d.ts.map +0 -1
  132. package/dist/test/settings.test.js +0 -48
  133. package/dist/test/settings.test.js.map +0 -1
  134. package/dist/test/utils.test.d.ts +0 -2
  135. package/dist/test/utils.test.d.ts.map +0 -1
  136. package/dist/test/utils.test.js +0 -17
  137. package/dist/test/utils.test.js.map +0 -1
  138. /package/dist/{src/api → api}/resideoClient.d.ts +0 -0
  139. /package/dist/{src/api → api}/resideoClient.js +0 -0
  140. /package/dist/{src/devices → devices}/device.js +0 -0
  141. /package/dist/{src/devices → devices}/leaksensors.js +0 -0
  142. /package/dist/{src/devices → devices}/smoke.js +0 -0
  143. /package/dist/{src/devices → devices}/thermostats.js +0 -0
  144. /package/dist/{src/devices → devices}/valve.js +0 -0
  145. /package/dist/{src/homebridge-ui → homebridge-ui}/server.d.ts +0 -0
  146. /package/dist/{src/index.d.ts → index.d.ts} +0 -0
  147. /package/dist/{src/index.js → index.js} +0 -0
  148. /package/dist/{src/platform.d.ts → platform.d.ts} +0 -0
  149. /package/dist/{src/settings.d.ts → settings.d.ts} +0 -0
  150. /package/dist/{src/settings.js → settings.js} +0 -0
  151. /package/dist/{src/utils.d.ts → utils.d.ts} +0 -0
@@ -0,0 +1,4 @@
1
+ # These are supported funding model platforms
2
+
3
+ github: donavanbecker
4
+ custom: paypal.me/DonavanBecker
@@ -0,0 +1,97 @@
1
+ name: Bug-Report
2
+ description: Report a Bug to help us improve
3
+ title: "Bug:"
4
+ labels: [bug]
5
+ assignees: 'donavanbecker'
6
+ body:
7
+ - type: markdown
8
+ attributes:
9
+ value: |
10
+ You must use the issue template below when submitting a bug.
11
+ - type: input
12
+ attributes:
13
+ label: Describe The Bug
14
+ placeholder: A clear and concise description of what the bug is.
15
+ validations:
16
+ required: true
17
+ - type: input
18
+ attributes:
19
+ label: To Reproduce
20
+ placeholder: Steps to reproduce the behavior.
21
+ validations:
22
+ required: true
23
+ - type: input
24
+ attributes:
25
+ label: Expected behavior
26
+ placeholder: A clear and concise description of what you expected to happen.
27
+ validations:
28
+ required: true
29
+ - type: textarea
30
+ id: Logs
31
+ attributes:
32
+ label: Relevant log output
33
+ placeholder: Bug reports that do not contain logs may be closed without warning. Show the Homebridge logs here. If using Homebridge Config-UI-X, you can easly download your log by visiting the log page on the UI and Clicking the Download Icon in the top right. Remove any sensitive information, such as your homebridge-firstalert refreshToken. Please Turn on Debug Mode before submitting your Issue so more logs can be shared to fix the issue being submitted.
34
+ render: shell
35
+ validations:
36
+ required: true
37
+ - type: textarea
38
+ id: Config
39
+ attributes:
40
+ label: Config for homebridge-firstalert
41
+ placeholder: Paste your homebridge config.json here. Remove any sensitive information, such as your homebridge-firstalert consumerKey/ consumerSecret / refreshToken.
42
+ render: shell
43
+ validations:
44
+ required: true
45
+ - type: textarea
46
+ attributes:
47
+ label: Screenshots
48
+ description: If applicable add screenshots to help explain your problem.
49
+ placeholder: You can attach images or log files by clicking this area to highlight it and then dragging files in.
50
+ validations:
51
+ required: false
52
+ - type: input
53
+ attributes:
54
+ label: Device & Model
55
+ placeholder: If applicable, add screenshots to help explain your problem.
56
+ validations:
57
+ required: true
58
+ - type: markdown
59
+ attributes:
60
+ value: |
61
+ Environment
62
+ - type: input
63
+ attributes:
64
+ label: Node.js Version
65
+ placeholder: v14.17.6
66
+ validations:
67
+ required: true
68
+ - type: input
69
+ attributes:
70
+ label: NPM Version
71
+ placeholder: v7.22.0
72
+ validations:
73
+ required: true
74
+ - type: input
75
+ attributes:
76
+ label: Homebridge Version
77
+ placeholder: If applicable, add screenshots to help explain your problem.
78
+ validations:
79
+ required: true
80
+ - type: input
81
+ attributes:
82
+ label: Homebridge FirstAlert Plugin Version
83
+ placeholder: v10.0.1
84
+ validations:
85
+ required: true
86
+ - type: input
87
+ attributes:
88
+ label: Homebridge Config UI X Plugin Version
89
+ placeholder: v4.41.2
90
+ validations:
91
+ required: false
92
+ - type: input
93
+ attributes:
94
+ label: Operating System
95
+ placeholder: Raspbian / Ubuntu / Debian / Windows / macOS / Docker
96
+ validations:
97
+ required: true
@@ -0,0 +1,8 @@
1
+ blank_issues_enabled: false
2
+ contact_links:
3
+ - name: Homebridge Discord Channel for FirstAlert
4
+ url: https://discord.gg/8fpZA4S
5
+ about: Please ask and answer questions here.
6
+ - name: Homebridge-FirstAlert - Pull Requests
7
+ url: https://github.com/homebridge-plugins/homebridge-firstalert/pulls
8
+ about: Please report security vulnerabilities here.
@@ -0,0 +1,38 @@
1
+ name: Feature Request
2
+ description: Suggest an idea for this project
3
+ title: "Feature Request: "
4
+ labels: [enhancement]
5
+ assignees: 'donavanbecker'
6
+ body:
7
+ - type: markdown
8
+ attributes:
9
+ value: |
10
+ You must use the issue template below when submitting a feature request.
11
+ - type: markdown
12
+ attributes:
13
+ value: |
14
+ Is your feature request related to a problem? Please describe.
15
+ - type: input
16
+ attributes:
17
+ label: Problem
18
+ placeholder: A clear and concise description of what the problem is. Ex. I am always frustrated when [...]
19
+ validations:
20
+ required: false
21
+ - type: input
22
+ attributes:
23
+ label: Solution
24
+ placeholder: A clear and concise description of what you want to happen.
25
+ validations:
26
+ required: true
27
+ - type: input
28
+ attributes:
29
+ label: Alternatives
30
+ placeholder: A clear and concise description of any alternative solutions or features you have considered.
31
+ validations:
32
+ required: false
33
+ - type: input
34
+ attributes:
35
+ label: Additional context
36
+ placeholder: Add any other context or screenshots about the feature request here. Post device logs here.
37
+ validations:
38
+ required: false
@@ -0,0 +1,85 @@
1
+ name: Support Request
2
+ description: Need help?
3
+ title: "Support Request:"
4
+ labels: [question]
5
+ assignees: 'donavanbecker'
6
+ body:
7
+ - type: markdown
8
+ attributes:
9
+ value: |
10
+ You must use the issue template below when submitting a support request.
11
+ - type: input
12
+ attributes:
13
+ label: Describe Your Problem
14
+ placeholder: A clear and concise description of what problem you are trying to solve.
15
+ validations:
16
+ required: true
17
+ - type: textarea
18
+ id: Logs
19
+ attributes:
20
+ label: Relevant log output
21
+ placeholder: Bug reports that do not contain logs may be closed without warning. Show the Homebridge logs here. If using Homebridge Config-UI-X, you can easly download your log by visiting the log page on the UI and Clicking the Download Icon in the top right. Remove any sensitive information, such as your homebridge-firstalert refreshToken. Please Turn on Debug Mode before submitting your Issue so more logs can be shared to fix the issue being submitted.
22
+ render: shell
23
+ validations:
24
+ required: false
25
+ - type: textarea
26
+ id: Config
27
+ attributes:
28
+ label: Config for homebridge-firstalert
29
+ placeholder: Paste your homebridge config.json here. Remove any sensitive information, such as your homebridge-firstalert consumerKey/ consumerSecret refreshToken.
30
+ render: shell
31
+ validations:
32
+ required: false
33
+ - type: textarea
34
+ attributes:
35
+ label: Screenshots
36
+ description: If applicable add screenshots to help explain your problem.
37
+ placeholder: You can attach images or log files by clicking this area to highlight it and then dragging files in.
38
+ validations:
39
+ required: false
40
+ - type: input
41
+ attributes:
42
+ label: Device & Model
43
+ placeholder: If applicable, add screenshots to help explain your problem.
44
+ validations:
45
+ required: true
46
+ - type: markdown
47
+ attributes:
48
+ value: |
49
+ Environment
50
+ - type: input
51
+ attributes:
52
+ label: Node.js Version
53
+ placeholder: v14.17.5
54
+ validations:
55
+ required: true
56
+ - type: input
57
+ attributes:
58
+ label: NPM Version
59
+ placeholder: v7.20.5
60
+ validations:
61
+ required: true
62
+ - type: input
63
+ attributes:
64
+ label: Homebridge Version
65
+ placeholder: If applicable, add screenshots to help explain your problem.
66
+ validations:
67
+ required: true
68
+ - type: input
69
+ attributes:
70
+ label: Homebridge FirstAlert Plugin Version
71
+ placeholder: v10.0.1
72
+ validations:
73
+ required: true
74
+ - type: input
75
+ attributes:
76
+ label: Homebridge Config UI X Plugin Version
77
+ placeholder: v4.41.2
78
+ validations:
79
+ required: false
80
+ - type: input
81
+ attributes:
82
+ label: Operating System
83
+ placeholder: Raspbian / Ubuntu / Debian / Windows / macOS / Docker
84
+ validations:
85
+ required: true
@@ -0,0 +1,52 @@
1
+ ---
2
+ name: Bug Report
3
+ about: Create a report to help us improve
4
+ title: ''
5
+ labels: bug
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ <!-- You must use the issue template below when submitting a bug -->
11
+
12
+ **Describe The Bug:**
13
+
14
+ <!-- A clear and concise description of what the bug is. -->
15
+
16
+ **To Reproduce:**
17
+
18
+ <!-- Steps to reproduce the behavior. -->
19
+
20
+ **Expected behavior:**
21
+
22
+ <!-- A clear and concise description of what you expected to happen. -->
23
+
24
+ **Logs:**
25
+
26
+ <!-- Bug reports that do not contain logs may be closed without warning. -->
27
+
28
+ ```
29
+ Show the Homebridge / Homebridge Config UI X logs here.
30
+ ```
31
+
32
+ **Homebridge Config:**
33
+
34
+ \```json
35
+ Show your homebridge config.json here
36
+ \```
37
+
38
+ **Screenshots:**
39
+
40
+ <!-- If applicable, add screenshots to help explain your problem. -->
41
+
42
+ **Environment:**
43
+
44
+ - **Node.js Version**: <!-- node -v -->
45
+ - **NPM Version**: <!-- npm -v -->
46
+ - **Homebridge Version**: <!-- homebridge -V -->
47
+ - **Homebridge FirstAlert Plugin Version**:
48
+ - **Homebridge Config UI X Version**:
49
+ - **Operating System**: Raspbian / Ubuntu / Debian / Windows / macOS / Docker
50
+ - **Process Supervisor**: Docker / Systemd / init.d / pm2 / launchctl / hb-service / other / none
51
+
52
+ <!-- Click the "Preview" tab before you submit to ensure the formatting is correct. -->
@@ -0,0 +1,27 @@
1
+ ---
2
+ name: Enhancement
3
+ about: Contribute to Plugin through Pull Request
4
+ title: ''
5
+ labels: 'enhancement'
6
+ assignees: 'donavanbecker'
7
+ ---
8
+
9
+ **Is your enhancement related to a problem? Please describe.**
10
+
11
+ <!-- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -->
12
+
13
+ **Describe the solution you are addding**
14
+
15
+ <!-- A clear and concise description of what you want to happen. -->
16
+
17
+ **Changes Proposed in this Pull Request**
18
+
19
+ <!-- A clear and concise description of what is being changed. -->
20
+
21
+ **Describe alternatives you've considered**
22
+
23
+ <!-- A clear and concise description of any alternative solutions or features you've considered. -->
24
+
25
+ **Additional context**
26
+
27
+ <!-- Add any other context or screenshots about the feature request here. -->
@@ -0,0 +1,17 @@
1
+ # To get started with Dependabot version updates, you'll need to specify which
2
+ # package ecosystems to update and where the package manifests are located.
3
+ # Please see the documentation for all configuration options:
4
+ # https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5
+
6
+ version: 2
7
+ updates:
8
+ - package-ecosystem: 'npm' # See documentation for possible values
9
+ directory: '/' # Location of package manifests
10
+ target-branch: 'beta-*.*.*'
11
+ schedule:
12
+ interval: 'daily'
13
+ - package-ecosystem: 'github-actions' # See documentation for possible values
14
+ directory: '/' # Location of package manifests
15
+ target-branch: 'beta-*.*.*'
16
+ schedule:
17
+ interval: 'daily'
@@ -0,0 +1,38 @@
1
+ # Add 'branding' label to any changes within 'docs' folder or any subfolders
2
+ branding:
3
+ - changed-files:
4
+ - any-glob-to-any-file: branding/**
5
+
6
+ # Add 'docs' label to any change to .md files within the entire repository
7
+ docs:
8
+ - changed-files:
9
+ - any-glob-to-any-file: '**/*.md'
10
+
11
+ # Add 'enhancement' label to any change to src files within the source dir EXCEPT for the docs sub-folder
12
+ enhancement:
13
+ - changed-files:
14
+ - any-glob-to-any-file: 'src/**/*'
15
+ - any-glob-to-any-file: 'config.schema.json'
16
+
17
+ # Add 'dependencies' label to any change to src files within the source dir EXCEPT for the docs sub-folder
18
+ dependencies:
19
+ - changed-files:
20
+ - any-glob-to-any-file: 'package.json'
21
+ - any-glob-to-any-file: 'package-lock.json'
22
+
23
+ # Add 'beta' label to any PR that is opened against the `beta` branch
24
+ beta:
25
+ - base-branch: 'beta*'
26
+
27
+ # Add 'alpha' label to any PR that is opened against the `alpha` branch
28
+ alpha:
29
+ - base-branch: 'alpha*'
30
+
31
+ # Add 'latest' label to any PR that is opened against the `latest` branch
32
+ latest:
33
+ - base-branch: 'latest'
34
+
35
+ # Add 'workflow' to any changes within 'workflow' folder or any subfolders
36
+ workflow:
37
+ - changed-files:
38
+ - any-glob-to-any-file: .github/**
@@ -0,0 +1,97 @@
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
+ import assert from 'node:assert'
8
+ import child_process from 'node:child_process'
9
+ import fs from 'node:fs'
10
+ import process from 'node:process'
11
+
12
+ const BRANCH_VERSION_PATTERN = /^([A-Z]+)-(\d+\.\d+\.\d+)$/i
13
+
14
+ // Load the contents of the package.json file
15
+ const packageJSON = JSON.parse(fs.readFileSync('package.json', 'utf8'))
16
+
17
+ const refArgument = process.argv[2]
18
+ const tagArgument = process.argv[3] || 'latest'
19
+
20
+ if (!refArgument) {
21
+ console.error('ref argument is missing')
22
+ console.error('Usage: npm-version-script-esm.js <ref> [tag]')
23
+ process.exit(1)
24
+ }
25
+
26
+ /**
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
33
+ */
34
+ function getTagVersionFromNpm(baseVersion, tag) {
35
+ try {
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
39
+ } catch (e) {
40
+ console.error(`Failed to query the npm registry for the latest version for tag: ${tag}`, e)
41
+ // throw e;
42
+ return ''
43
+ }
44
+ }
45
+
46
+ function desiredTargetVersion(ref) {
47
+ // ref is a GitHub action ref string
48
+ if (ref.startsWith('refs/pull/')) {
49
+ throw new Error('The version script was executed inside a PR!')
50
+ }
51
+
52
+ assert(ref.startsWith('refs/heads/'))
53
+ const branchName = ref.slice('refs/heads/'.length)
54
+
55
+ const results = branchName.match(BRANCH_VERSION_PATTERN)
56
+ if (results !== null) {
57
+ if (results[1] !== tagArgument) {
58
+ console.warn(`The base branch name (${results[1]}) differs from the tag name ${tagArgument}`)
59
+ }
60
+
61
+ return results[2]
62
+ }
63
+
64
+ throw new Error(`Malformed branch name for ref: ${ref}. Can't derive the base version. Use a branch name like: beta-x.x.x or alpha-x.x.x`)
65
+ }
66
+
67
+ // derive the base version from the branch ref
68
+ const baseVersion = desiredTargetVersion(refArgument)
69
+
70
+ // query the npm registry for the latest version of the provided tag name
71
+ const latestReleasedVersion = getTagVersionFromNpm(baseVersion, tagArgument) // e.g. 0.7.0-beta.12
72
+
73
+ let publishTag
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
78
+ } else {
79
+ console.warn(`No published versions for ${baseVersion} with tag ${tagArgument}`)
80
+ publishTag = baseVersion // start off with a new beta or alpha version
81
+ }
82
+
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))
90
+
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
+ }
@@ -0,0 +1,33 @@
1
+ name-template: 'v$RESOLVED_VERSION'
2
+ tag-template: 'v$RESOLVED_VERSION'
3
+
4
+ categories:
5
+ - title: 'Workflow Changes'
6
+ labels:
7
+ - 'workflow'
8
+ - title: 'Enhancements'
9
+ labels:
10
+ - 'enhancement'
11
+ - title: 'Updated Dependencies'
12
+ labels:
13
+ - 'dependencies'
14
+ - title: 'Documentation'
15
+ labels:
16
+ - 'docs'
17
+
18
+ change-template: '- $TITLE @$AUTHOR [#$NUMBER]'
19
+ version-resolver:
20
+ major:
21
+ labels:
22
+ - 'major'
23
+ minor:
24
+ labels:
25
+ - 'minor'
26
+ patch:
27
+ labels:
28
+ - 'patch'
29
+ default: patch
30
+ template: |
31
+ ## Changes
32
+
33
+ $CHANGES
@@ -0,0 +1,55 @@
1
+ name: Beta Release
2
+
3
+ on:
4
+ push:
5
+ branches: [beta-*.*.*, beta]
6
+ workflow_dispatch:
7
+
8
+ jobs:
9
+ build_and_test:
10
+ uses: homebridge/.github/.github/workflows/nodejs-build-and-test.yml@latest
11
+ with:
12
+ enable_coverage: false
13
+ secrets:
14
+ token: ${{ secrets.GITHUB_TOKEN }}
15
+ lint:
16
+ needs: build_and_test
17
+ uses: homebridge/.github/.github/workflows/eslint.yml@latest
18
+
19
+ publish:
20
+ needs: lint
21
+ if: ${{ github.repository == 'homebridge-plugins/homebridge-firstalert' }}
22
+ permissions:
23
+ id-token: write
24
+ uses: homebridge/.github/.github/workflows/npm-publish-esm.yml@latest
25
+ with:
26
+ tag: 'beta'
27
+ dynamically_adjust_version: true
28
+ npm_version_command: 'pre'
29
+ pre_id: 'beta'
30
+ secrets:
31
+ npm_auth_token: ${{ secrets.npm_token }}
32
+
33
+ pre-release:
34
+ needs: publish
35
+ if: ${{ github.repository == 'homebridge-plugins/homebridge-firstalert' }}
36
+ uses: homebridge/.github/.github/workflows/pre-release.yml@latest
37
+ with:
38
+ npm_version: ${{ needs.publish.outputs.NPM_VERSION }}
39
+ body: |
40
+ **Beta Release**
41
+ **Version**: v${{ needs.publish.outputs.NPM_VERSION }}
42
+ [How To Test Beta Releases](https://github.com/homebridge-plugins/homebridge-firstalert/wiki/Beta-Version)
43
+
44
+ github-releases-to-discord:
45
+ name: Discord Webhooks
46
+ needs: [build_and_test,publish]
47
+ if: ${{ github.repository == 'homebridge-plugins/homebridge-firstalert' }}
48
+ uses: homebridge/.github/.github/workflows/discord-webhooks.yml@latest
49
+ with:
50
+ title: "FirstAlert Beta Release"
51
+ description: |
52
+ Version `v${{ needs.publish.outputs.NPM_VERSION }}`
53
+ url: "https://github.com/homebridge-plugins/homebridge-firstalert/releases/tag/v${{ needs.publish.outputs.NPM_VERSION }}"
54
+ secrets:
55
+ DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK_URL_BETA || secrets.DISCORD_WEBHOOK_URL_LATEST }}
@@ -0,0 +1,18 @@
1
+ name: Node Build
2
+
3
+ on:
4
+ push:
5
+ branches: [latest]
6
+ pull_request:
7
+ workflow_dispatch:
8
+
9
+ jobs:
10
+ build_and_test:
11
+ uses: homebridge/.github/.github/workflows/nodejs-build-and-test.yml@latest
12
+ with:
13
+ enable_coverage: false
14
+ secrets:
15
+ token: ${{ secrets.GITHUB_TOKEN }}
16
+ lint:
17
+ needs: build_and_test
18
+ uses: homebridge/.github/.github/workflows/eslint.yml@latest
@@ -0,0 +1,11 @@
1
+ name: Changelog to Release
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ jobs:
8
+ changerelease:
9
+ uses: homebridge/.github/.github/workflows/change-release.yml@latest
10
+ secrets:
11
+ token: ${{ secrets.GITHUB_TOKEN }}
@@ -0,0 +1,9 @@
1
+ name: Labeler
2
+
3
+ on: [pull_request]
4
+
5
+ jobs:
6
+ labeler:
7
+ uses: homebridge/.github/.github/workflows/labeler.yml@latest
8
+ secrets:
9
+ token: ${{ secrets.GITHUB_TOKEN }}
@@ -0,0 +1,14 @@
1
+ name: Release Drafter
2
+
3
+ on:
4
+ push:
5
+ branches: [latest]
6
+ pull_request: # required for autolabeler
7
+ types: [opened, reopened, synchronize]
8
+ workflow_dispatch:
9
+
10
+ jobs:
11
+ release-drafter:
12
+ uses: homebridge/.github/.github/workflows/release-drafter.yml@latest
13
+ secrets:
14
+ token: ${{ secrets.GITHUB_TOKEN }}
@@ -0,0 +1,35 @@
1
+ name: Release
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ jobs:
8
+ build_and_test:
9
+ uses: homebridge/.github/.github/workflows/nodejs-build-and-test.yml@latest
10
+ with:
11
+ enable_coverage: false
12
+ secrets:
13
+ token: ${{ secrets.GITHUB_TOKEN }}
14
+
15
+ publish:
16
+ needs: build_and_test
17
+ if: ${{ github.repository == 'homebridge-plugins/homebridge-firstalert' }}
18
+ permissions:
19
+ id-token: write
20
+ uses: homebridge/.github/.github/workflows/npm-publish-esm.yml@latest
21
+ secrets:
22
+ npm_auth_token: ${{ secrets.npm_token }}
23
+
24
+ github-releases-to-discord:
25
+ name: Discord Webhooks
26
+ needs: [build_and_test,publish]
27
+ if: ${{ github.repository == 'homebridge-plugins/homebridge-firstalert' }}
28
+ uses: homebridge/.github/.github/workflows/discord-webhooks.yml@latest
29
+ with:
30
+ title: "FirstAlert Release"
31
+ description: |
32
+ Version `v${{ needs.publish.outputs.NPM_VERSION }}`
33
+ url: "https://github.com/homebridge-plugins/homebridge-firstalert/releases/tag/v${{ needs.publish.outputs.NPM_VERSION }}"
34
+ secrets:
35
+ DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK_URL_LATEST }}
@@ -0,0 +1,12 @@
1
+ name: Stale workflow
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ schedule:
6
+ - cron: '45 11 * * *'
7
+
8
+ jobs:
9
+ stale:
10
+ uses: homebridge/.github/.github/workflows/stale.yml@latest
11
+ secrets:
12
+ token: ${{ secrets.GITHUB_TOKEN }}