homey-lib 2.45.1 → 2.45.3

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.
@@ -1,57 +0,0 @@
1
- name: Apply Locales
2
-
3
- # About this workflow:
4
- # It is triggered on created pull_requests with changes in the "generated_locales" folder. It will apply the locale files from the "generated_locales" folder and commit the changes to the repository.
5
-
6
- # GitHub repo configuration:
7
- # 1. Go to Manage access and add 'Github Actions' team with role: admin.
8
- # 2. If you have protected branches, go to Branches > edit protected branch > enable 'Restrict who can push to
9
- # matching branches' and add the 'athombv/github-actions' team.
10
-
11
- # Note: make sure to commit package-lock.json, this is needed for `npm ci`.
12
-
13
- on:
14
- pull_request:
15
- paths:
16
- - "generated_locales/**"
17
-
18
- jobs:
19
- apply_locales:
20
- name: Apply Locales
21
-
22
- # Only run this job if initiator is not the Homey Github Actions Bot to prevent loops
23
- if: github.actor != 'homey-bot'
24
-
25
- runs-on: ubuntu-latest
26
- steps:
27
- # Checks out the current repository.
28
- - name: Checkout git repository
29
- uses: actions/checkout@v3
30
- with:
31
- # The token below is only necessary if you want to push the version bump to a protected branch
32
- token: ${{ secrets.HOMEY_GITHUB_ACTIONS_BOT_PERSONAL_ACCESS_TOKEN }}
33
- ref: ${{ github.event.pull_request.head.ref }}
34
-
35
- # Set git config to reflect Homey Github Actions Bot user
36
- - name: Set up HomeyGithubActionsBot git user
37
- run: |
38
- git config --local user.email "sysadmin+githubactions@athom.com"
39
- git config --local user.name "Homey Github Actions Bot"
40
-
41
- # Configures a Node.js environment.
42
- - name: Set up node 12 environment
43
- uses: actions/setup-node@v1
44
- with:
45
- node-version: "12"
46
-
47
- - name: Install dependencies
48
- run: npm ci
49
-
50
- - name: Apply Locales
51
- run: node ./scripts/apply-locale-files.js
52
-
53
- - name: Commit and push applied locales
54
- run: |
55
- git add . || echo "No changes due to applying locales."
56
- git commit -m "ci: applied locales" || echo "No changes to commit."
57
- git push origin HEAD:${{ github.event.pull_request.head.ref }}
@@ -1,181 +0,0 @@
1
- name: Deploy
2
-
3
- # About this workflow:
4
- # It is triggered on push events to branches production and testing. Then it performs a checkout of the current repo
5
- # and sets up a node environment (v12). Following, it will run `npm ci` to build the package. Next, it will look at your
6
- # commit message, if it includes '#patch', '#minor', or '#major' it will bump the package version accordingly.
7
- # Finally, the `npm publish` command will be run, when on branch testing it will run `npm publish --tag beta` to publish
8
- # it under the beta flag on npm. Note: if no '#patch', '#minor', or '#major' flag is present in the latest commit
9
- # AND the package version is not bumped manually the publish step will fail because we can not publish to an existing
10
- # version.
11
-
12
- # GitHub repo configuration:
13
- # 1. Go to Manage access and add 'Github Actions' team with role: admin.
14
- # 2. If you have protected branches, go to Branches > edit protected branch > enable 'Restrict who can push to
15
- # matching branches' and add the 'athombv/github-actions' team.
16
-
17
- # Note: make sure to commit package-lock.json, this is needed for `npm ci`.
18
-
19
- # Defines the trigger for this action, in general you want it to run when pushing to production | testing. For more
20
- # information see: https://help.github.com/en/actions/automating-your-workflow-with-github-actions/events-that-trigger-workflows#about-workflow-events)
21
- on:
22
- workflow_dispatch:
23
- push:
24
- branches:
25
- - production
26
-
27
- permissions:
28
- id-token: write
29
- contents: read
30
-
31
- jobs:
32
- deploy_to_npm:
33
- name: Deploy to NPM
34
-
35
- # Only run this job if initiator is not the Homey Github Actions Bot to prevent loops
36
- if: github.actor != 'homey-bot'
37
-
38
- runs-on: ubuntu-latest
39
- steps:
40
-
41
- # Checks out the current repository.
42
- - name: Checkout git repository
43
- uses: actions/checkout@v2
44
- with:
45
- # The token below is only necessary if you want to push the version bump to a protected branch
46
- token: ${{ secrets.HOMEY_GITHUB_ACTIONS_BOT_PERSONAL_ACCESS_TOKEN }}
47
-
48
- # Set git config to reflect Homey Github Actions Bot user
49
- - name: Set up HomeyGithubActionsBot git user
50
- run: |
51
- git config --local user.email "sysadmin+githubactions@athom.com"
52
- git config --local user.name "Homey Github Actions Bot"
53
-
54
- # Configures a Node.js environment.
55
- - uses: actions/setup-node@v4
56
- with:
57
- node-version: '24'
58
- registry-url: 'https://registry.npmjs.org'
59
-
60
- # Run `npm ci && npm run build` to re-create your local environment (make sure to commit your - package-lock.json!).
61
- - name: Build
62
- run: |
63
- npm ci
64
- npm run build --if-present
65
-
66
- - name: Commit and push webpack build artefact
67
- run: |
68
- git add webpack/index.js || echo "Webpack build artefact did not change"
69
- git commit -m "build: update webpack artefact" || echo "No changes to commit"
70
- git push
71
-
72
- - name: Version bump patch
73
- if: "contains(github.event.head_commit.message, '#patch') && !contains(github.event.head_commit.message, '#minor') && !contains(github.event.head_commit.message, '#major')"
74
- run: |
75
- npm version patch
76
- git config pull.rebase false
77
- git pull
78
- git push --follow-tags
79
-
80
- - name: Version bump minor
81
- if: "contains(github.event.head_commit.message, '#minor') && !contains(github.event.head_commit.message, '#major')"
82
- run: |
83
- npm version minor
84
- git config pull.rebase false
85
- git pull
86
- git push --follow-tags
87
-
88
- - name: Version bump major
89
- if: "contains(github.event.head_commit.message, '#major')"
90
- run: |
91
- npm version major
92
- git config pull.rebase false
93
- git pull
94
- git push --follow-tags
95
-
96
- # Publish when this action is running on branch production
97
- - name: Publish
98
- run: |
99
- npm publish
100
- VERSION="$(node -p "require('./package.json').version")"
101
- echo package_version=${VERSION} >> $GITHUB_ENV
102
-
103
- trigger-repository-dispatch-event:
104
- needs: deploy_to_npm
105
- name: Update dependent repositories
106
- runs-on: ubuntu-latest
107
- steps:
108
-
109
- # Note: insert '<org>/<repo>' below (e.g. athombv/create-nodejs), and specify "event_type"
110
- - name: Trigger repository dispatch event athombv/node-homey
111
- run: |
112
- curl -X POST \
113
- https://api.github.com/repos/athombv/node-homey/dispatches \
114
- -H 'Accept: application/vnd.github.everest-preview+json' \
115
- -H 'Authorization: token ${{ secrets.HOMEY_GITHUB_ACTIONS_BOT_PERSONAL_ACCESS_TOKEN }}' \
116
- -d '{"event_type": "update-homey-lib"}'
117
-
118
- - name: Trigger repository dispatch event athombv/homey-mobile-app
119
- run: |
120
- curl -X POST \
121
- https://api.github.com/repos/athombv/homey-mobile-app/dispatches \
122
- -H 'Accept: application/vnd.github.everest-preview+json' \
123
- -H 'Authorization: token ${{ secrets.HOMEY_GITHUB_ACTIONS_BOT_PERSONAL_ACCESS_TOKEN }}' \
124
- -d '{"event_type": "update-homey-lib"}'
125
-
126
- - name: Trigger repository dispatch event athombv/athom-cloud-apps-api
127
- run: |
128
- curl -X POST \
129
- https://api.github.com/repos/athombv/athom-cloud-apps-api/dispatches \
130
- -H 'Accept: application/vnd.github.everest-preview+json' \
131
- -H 'Authorization: token ${{ secrets.HOMEY_GITHUB_ACTIONS_BOT_PERSONAL_ACCESS_TOKEN }}' \
132
- -d '{"event_type": "update-homey-lib"}'
133
-
134
- - name: Trigger repository dispatch event athombv/lambda-apps-onupload
135
- run: |
136
- curl -X POST \
137
- https://api.github.com/repos/athombv/lambda-apps-onupload/dispatches \
138
- -H 'Accept: application/vnd.github.everest-preview+json' \
139
- -H 'Authorization: token ${{ secrets.HOMEY_GITHUB_ACTIONS_BOT_PERSONAL_ACCESS_TOKEN }}' \
140
- -d '{"event_type": "update-homey-lib"}'
141
-
142
-
143
- - name: Trigger repository dispatch event athombv/athom-cloud-driver-reference
144
- run: |
145
- curl -X POST \
146
- https://api.github.com/repos/athombv/athom-cloud-driver-reference/dispatches \
147
- -H 'Accept: application/vnd.github.everest-preview+json' \
148
- -H 'Authorization: token ${{ secrets.HOMEY_GITHUB_ACTIONS_BOT_PERSONAL_ACCESS_TOKEN }}' \
149
- -d '{"event_type": "update-homey-lib"}'
150
-
151
- - name: Trigger repository dispatch event athombv/node-homey-os
152
- run: |
153
- curl -X POST \
154
- https://api.github.com/repos/athombv/node-homey-os/dispatches \
155
- -H 'Accept: application/vnd.github.everest-preview+json' \
156
- -H 'Authorization: token ${{ secrets.HOMEY_GITHUB_ACTIONS_BOT_PERSONAL_ACCESS_TOKEN }}' \
157
- -d '{"event_type": "update-homey-lib"}'
158
-
159
- - name: Trigger repository dispatch event athombv/homey-client
160
- run: |
161
- curl -X POST \
162
- https://api.github.com/repos/athombv/homey-client/dispatches \
163
- -H 'Accept: application/vnd.github.everest-preview+json' \
164
- -H 'Authorization: token ${{ secrets.HOMEY_GITHUB_ACTIONS_BOT_PERSONAL_ACCESS_TOKEN }}' \
165
- -d '{"event_type": "update-homey-lib"}'
166
-
167
- - name: Trigger repository dispatch event athombv/homey-web-app
168
- run: |
169
- curl -X POST \
170
- https://api.github.com/repos/athombv/homey-web-app/dispatches \
171
- -H 'Accept: application/vnd.github.everest-preview+json' \
172
- -H 'Authorization: token ${{ secrets.HOMEY_GITHUB_ACTIONS_BOT_PERSONAL_ACCESS_TOKEN }}' \
173
- -d '{"event_type": "update-homey-lib"}'
174
-
175
- - name: Trigger repository dispatch event athombv/athom-cloud-website
176
- run: |
177
- curl -X POST \
178
- https://api.github.com/repos/athombv/athom-cloud-website/dispatches \
179
- -H 'Accept: application/vnd.github.everest-preview+json' \
180
- -H 'Authorization: token ${{ secrets.HOMEY_GITHUB_ACTIONS_BOT_PERSONAL_ACCESS_TOKEN }}' \
181
- -d '{"event_type": "update-homey-lib"}'
@@ -1,60 +0,0 @@
1
- name: Generate Locales
2
-
3
- # About this workflow:
4
- # It is triggered on push events to master and develop with changes in the "assets" folder. It will generate locale files from the assets and commit the changes to the repository.
5
-
6
- # GitHub repo configuration:
7
- # 1. Go to Manage access and add 'Github Actions' team with role: admin.
8
- # 2. If you have protected branches, go to Branches > edit protected branch > enable 'Restrict who can push to
9
- # matching branches' and add the 'athombv/github-actions' team.
10
-
11
- # Note: make sure to commit package-lock.json, this is needed for `npm ci`.
12
-
13
- on:
14
- workflow_dispatch:
15
- push:
16
- branches:
17
- - "master"
18
- - "develop"
19
- paths:
20
- - "assets/**"
21
-
22
- jobs:
23
- generate_locales:
24
- name: Generate Locales
25
-
26
- # Only run this job if initiator is not the Homey Github Actions Bot to prevent loops
27
- if: github.actor != 'homey-bot'
28
-
29
- runs-on: ubuntu-latest
30
- steps:
31
- # Checks out the current repository.
32
- - name: Checkout git repository
33
- uses: actions/checkout@v3
34
- with:
35
- # The token below is only necessary if you want to push the version bump to a protected branch
36
- token: ${{ secrets.HOMEY_GITHUB_ACTIONS_BOT_PERSONAL_ACCESS_TOKEN }}
37
-
38
- # Set git config to reflect Homey Github Actions Bot user
39
- - name: Set up HomeyGithubActionsBot git user
40
- run: |
41
- git config --local user.email "sysadmin+githubactions@athom.com"
42
- git config --local user.name "Homey Github Actions Bot"
43
-
44
- # Configures a Node.js environment.
45
- - name: Set up node 12 environment
46
- uses: actions/setup-node@v1
47
- with:
48
- node-version: "12"
49
-
50
- - name: Install dependencies
51
- run: npm ci
52
-
53
- - name: Generate Locales
54
- run: node ./scripts/generate-locale-files.js
55
-
56
- - name: Commit and push generated locales
57
- run: |
58
- git add . || echo "No changes due to generated locales."
59
- git commit -m "ci: generated locales" || echo "No changes to commit."
60
- git push
@@ -1,43 +0,0 @@
1
- # Simple workflow for deploying static content to GitHub Pages
2
- name: Deploy static content to Pages
3
-
4
- on:
5
- # Runs on pushes targeting the default branch
6
- push:
7
- branches: ["production"]
8
-
9
- # Allows you to run this workflow manually from the Actions tab
10
- workflow_dispatch:
11
-
12
- # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
13
- permissions:
14
- contents: read
15
- pages: write
16
- id-token: write
17
-
18
- # Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
19
- # However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
20
- concurrency:
21
- group: "pages"
22
- cancel-in-progress: false
23
-
24
- jobs:
25
- # Single deploy job since we're just deploying
26
- deploy:
27
- environment:
28
- name: github-pages
29
- url: ${{ steps.deployment.outputs.page_url }}
30
- runs-on: ubuntu-latest
31
- steps:
32
- - name: Checkout
33
- uses: actions/checkout@v4
34
- - name: Setup Pages
35
- uses: actions/configure-pages@v5
36
- - name: Upload artifact
37
- uses: actions/upload-pages-artifact@v3
38
- with:
39
- # Upload entire repository
40
- path: '.'
41
- - name: Deploy to GitHub Pages
42
- id: deployment
43
- uses: actions/deploy-pages@v4
@@ -1,51 +0,0 @@
1
- name: Test
2
-
3
- # Optional secrets:
4
- # - SSH_KEY: if `npm ci` needs to install private npm packages, make sure to enable webfactory/ssh-agent@v0.2.0 step
5
-
6
- # GitHub repo configuration:
7
- # 1. If you have protected branches, go to Branches > edit protected branch > enable 'Require status checks to pass before
8
- # merging' and select the 'Test' status check.
9
-
10
- # Note: make sure to commit package-lock.json, this is needed for `npm ci`.
11
-
12
- # Defines the trigger for this action (by default on push to master/production and on all pull requests)
13
- # For more information see: https://help.github.com/en/actions/automating-your-workflow-with-github-actions/events-that-trigger-workflows#about-workflow-events)
14
- on:
15
- push:
16
- branches:
17
- - master
18
- - production
19
- pull_request:
20
-
21
- jobs:
22
- test:
23
- name: Run
24
- runs-on: ubuntu-latest
25
-
26
- # Define a strategy for running these tests on various operating systems and Node.js versions in parallel.
27
- strategy:
28
- matrix:
29
- node: [12, 16]
30
-
31
- steps:
32
- # Checks out the current repository.
33
- - uses: actions/checkout@v2
34
-
35
- # Configures a Node.js environment.
36
- - uses: actions/setup-node@v1
37
- with:
38
- node-version: ${{ matrix.node }} # Important: use the matrix.node property when using a matrix strategy
39
-
40
- # Set SSH key
41
- - uses: webfactory/ssh-agent@v0.4.1
42
- env:
43
- SSH_KEY: ${{ secrets.SSH_KEY }}
44
- if: env.SSH_KEY != null
45
- with:
46
- ssh-private-key: ${{ env.SSH_KEY }}
47
-
48
- # Run `npm ci` to re-create your local environment (make sure to commit your package-lock.json!).
49
- # Finally run `npm test` (make sure you have defined a proper test command in package.json).
50
- - run: npm ci
51
- - run: npm test
package/.idea/misc.xml DELETED
@@ -1,6 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="JavaScriptSettings">
4
- <option name="languageLevel" value="ES6" />
5
- </component>
6
- </project>
package/.idea/modules.xml DELETED
@@ -1,8 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="ProjectModuleManager">
4
- <modules>
5
- <module fileurl="file://$PROJECT_DIR$/.idea/node-homey-lib.iml" filepath="$PROJECT_DIR$/.idea/node-homey-lib.iml" />
6
- </modules>
7
- </component>
8
- </project>
@@ -1,12 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <module type="WEB_MODULE" version="4">
3
- <component name="NewModuleRootManager">
4
- <content url="file://$MODULE_DIR$">
5
- <excludeFolder url="file://$MODULE_DIR$/.tmp" />
6
- <excludeFolder url="file://$MODULE_DIR$/temp" />
7
- <excludeFolder url="file://$MODULE_DIR$/tmp" />
8
- </content>
9
- <orderEntry type="inheritedJdk" />
10
- <orderEntry type="sourceFolder" forTests="false" />
11
- </component>
12
- </module>
package/.idea/vcs.xml DELETED
@@ -1,6 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="VcsDirectoryMappings">
4
- <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
- </component>
6
- </project>
@@ -1,137 +0,0 @@
1
- /* eslint-disable node/no-unpublished-require */
2
-
3
- 'use strict';
4
-
5
- const path = require('path');
6
- const assert = require('assert');
7
-
8
- const mockFs = require('mock-fs');
9
- const set = require('set-value');
10
-
11
- const HomeyLib = require('../..');
12
-
13
- const PNG_HEADER = Buffer.from([
14
- 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a,
15
- 0x00, 0x00, 0x00, 0x00, 0x49, 0x48, 0x44, 0x52,
16
- ]);
17
-
18
- // TODO: do we want to test other image types?
19
- // for now we assume that if png works, the other formats will too...
20
- function createFakePng({ width, height }) {
21
- const size = Buffer.alloc(8);
22
- size.writeUInt32BE(width, 0);
23
- size.writeUInt32BE(height, 4);
24
-
25
- return Buffer.concat([PNG_HEADER, size]);
26
- }
27
-
28
- // This manifest is the minimum which is valid at all levels
29
- const baseAppManifest = {
30
- id: 'test.app',
31
- name: { en: 'Test' },
32
- description: { en: 'Test app' },
33
- brandColor: '#000000',
34
- version: '1.0.0',
35
- sdk: 3,
36
- compatibility: '>=5.0.0',
37
- platforms: ['local', 'cloud'],
38
- category: ['tools'],
39
- images: {
40
- small: '/assets/images/small.png',
41
- large: '/assets/images/large.png',
42
- xlarge: '/assets/images/xlarge.png',
43
- },
44
- author: { name: 'Athom B.V.' },
45
- support: 'mailto:support@homey.app',
46
- };
47
-
48
- // This manifest is the minimum which is valid at all levels
49
- const baseDriverManifest = {
50
- id: 'test',
51
- name: { en: 'Test' },
52
- class: 'light',
53
- capabilities: ['onoff'],
54
- platforms: ['local', 'cloud'],
55
- connectivity: ['cloud'],
56
- images: {
57
- small: '/drivers/test/assets/images/small.png',
58
- large: '/drivers/test/assets/images/large.png',
59
- xlarge: '/drivers/test/assets/images/xlarge.png',
60
- },
61
- };
62
-
63
- function mockApp(manifest, { files = {}, env = {} } = {}) {
64
- const appFs = {
65
- assets: {
66
- 'icon.svg': '<svg></svg>',
67
- images: {
68
- 'small.png': createFakePng({ width: 250, height: 175 }),
69
- 'large.png': createFakePng({ width: 500, height: 350 }),
70
- 'xlarge.png': createFakePng({ width: 1000, height: 700 }),
71
- },
72
- },
73
- drivers: {
74
- test: {
75
- assets: {
76
- images: {
77
- 'small.png': createFakePng({ width: 75, height: 75 }),
78
- 'large.png': createFakePng({ width: 500, height: 500 }),
79
- 'xlarge.png': createFakePng({ width: 1000, height: 1000 }),
80
- },
81
- },
82
- },
83
- },
84
- 'app.js': 'code',
85
- 'app.json': JSON.stringify(manifest),
86
- 'env.json': JSON.stringify(env),
87
- // node_modules ?
88
- };
89
-
90
- // Apply filesystem overrides
91
- for (const [key, value] of Object.entries(files)) {
92
- set(appFs, key, value);
93
- }
94
-
95
- mockFs({
96
- // create the fake app filesystem
97
- test_app: appFs,
98
- // ensure homey-lib can load its assets and dependencies
99
- assets: mockFs.load(path.resolve(__dirname, '../../assets')),
100
- node_modules: mockFs.load(path.resolve(__dirname, '../../node_modules')),
101
- });
102
-
103
- return new HomeyLib.App('test_app');
104
- }
105
-
106
- function clearMockApp() {
107
- mockFs.restore();
108
- }
109
-
110
- async function assertValidates(app, { debug, publish, verified }) {
111
- if (verified === true) {
112
- await assert.doesNotReject(() => app.validate({ level: 'verified' }), '`verified` validation');
113
- } else {
114
- await assert.rejects(() => app.validate({ level: 'verified' }), verified, '`verified` validation');
115
- }
116
-
117
- if (publish === true) {
118
- await assert.doesNotReject(() => app.validate({ level: 'publish' }), '`publish` validation');
119
- } else {
120
- await assert.rejects(() => app.validate({ level: 'publish' }), publish, '`publish` validation');
121
- }
122
-
123
- if (debug === true) {
124
- await assert.doesNotReject(() => app.validate({ level: 'debug' }), '`debug` validation');
125
- } else {
126
- await assert.rejects(() => app.validate({ level: 'debug' }), debug, '`debug` validation');
127
- }
128
- }
129
-
130
- module.exports = {
131
- mockApp,
132
- clearMockApp,
133
- assertValidates,
134
- createFakePng,
135
- baseAppManifest,
136
- baseDriverManifest,
137
- };