homey 4.2.1 → 4.2.2

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/lib/App.js CHANGED
@@ -865,11 +865,7 @@ $ sudo systemctl restart docker
865
865
  Log.success('Pre-processing app...');
866
866
 
867
867
  // Build app.json from Homey Compose files
868
- if (App.hasHomeyCompose({ appPath: this.path })) {
869
- const usesModules = App.usesModules({ appPath: this.path });
870
-
871
- await HomeyCompose.build({ appPath: this.path, usesModules });
872
- }
868
+ await HomeyCompose.buildIfUsed(App, this.path);
873
869
 
874
870
  // Clear the .homeybuild/ folder
875
871
  await fse.remove(this._homeyBuildPath).catch(async (err) => {
@@ -1183,9 +1179,7 @@ $ sudo systemctl restart docker
1183
1179
  await writeFileAsync(path.join(manifestFolder, 'app.json'), JSON.stringify(manifest, false, 2));
1184
1180
 
1185
1181
  // Build app.json from Homey Compose files
1186
- if (App.hasHomeyCompose({ appPath: this.path })) {
1187
- await HomeyCompose.build({ appPath: this.path });
1188
- }
1182
+ await HomeyCompose.buildIfUsed(App, this.path);
1189
1183
 
1190
1184
  Log.success(`Updated app.json version to \`${manifest.version}\``);
1191
1185
 
@@ -1197,9 +1191,7 @@ $ sudo systemctl restart docker
1197
1191
  );
1198
1192
 
1199
1193
  // Build app.json from Homey Compose files
1200
- if (App.hasHomeyCompose({ appPath: this.path })) {
1201
- await HomeyCompose.build({ appPath: this.path });
1202
- }
1194
+ await HomeyCompose.buildIfUsed(App, this.path);
1203
1195
  };
1204
1196
 
1205
1197
  return undo;
package/lib/AppPython.js CHANGED
@@ -46,15 +46,15 @@ class AppPython extends App {
46
46
  }
47
47
 
48
48
  static usesTypeScript({ appPath }) {
49
- throw new Error('Method should not be called for Python: "App.usesTypeScript"');
49
+ return false;
50
50
  }
51
51
 
52
52
  static usesModules({ appPath }) {
53
- throw new Error('Method should not be called for Python: "App.usesModules"');
53
+ return false;
54
54
  }
55
55
 
56
56
  static async transpileToTypescript({ appPath }) {
57
- throw new Error('Method should not be called for Python: "App.transpileToTypescript".');
57
+ return;
58
58
  }
59
59
 
60
60
  async build({ findLinks, dockerSocketPath } = {}) {
@@ -117,7 +117,8 @@ class AppPython extends App {
117
117
  HOMEY_APP_RUNNER_DEVMODE: process.env.HOMEY_APP_RUNNER_DEVMODE === '1',
118
118
  HOMEY_APP_RUNNER_PATH: process.env.HOMEY_APP_RUNNER_PATH_PYTHON, // e.g. /Users/username/Git/homey-app-runner/src
119
119
  HOMEY_APP_RUNNER_CMD: ['bash', 'entrypoint.sh'],
120
- HOMEY_APP_RUNNER_ID: process.env.HOMEY_APP_RUNNER_ID_PYTHON || 'ghcr.io/athombv/python-homey-app-runner:latest',
120
+ HOMEY_APP_RUNNER_ID:
121
+ process.env.HOMEY_APP_RUNNER_ID_PYTHON || 'ghcr.io/athombv/python-homey-app-runner:latest',
121
122
  HOMEY_APP_RUNNER_SDK_PATH: process.env.HOMEY_APP_RUNNER_SDK_PATH_PYTHON, // e.g. /Users/username/Git/python-homey-sdk-v3/dist
122
123
  };
123
124
  }
@@ -261,9 +262,7 @@ class AppPython extends App {
261
262
  } = {}) {
262
263
  Log.success('Pre-processing app...');
263
264
  // Build app.json from Homey Compose files
264
- if (App.hasHomeyCompose({ appPath: this.path })) {
265
- await HomeyCompose.build({ appPath: this.path, usesModules: false });
266
- }
265
+ await HomeyCompose.buildIfUsed(AppPython, this.path);
267
266
 
268
267
  const manifest = App.getManifest({ appPath: this.path });
269
268
 
@@ -49,8 +49,12 @@ const FLOW_TYPES = ['triggers', 'conditions', 'actions'];
49
49
 
50
50
  class HomeyCompose {
51
51
  // Temporary simpler api
52
- static async build({ appPath, usesModules }) {
53
- const compose = new HomeyCompose(appPath, usesModules);
52
+ static async buildIfUsed(app, appPath) {
53
+ if (!app.hasHomeyCompose({ appPath })) {
54
+ return;
55
+ }
56
+
57
+ const compose = new HomeyCompose(appPath, app.usesModules({ appPath }));
54
58
  await compose.run();
55
59
  }
56
60
 
@@ -706,6 +710,14 @@ class HomeyCompose {
706
710
  this._appJson.capabilities[capabilityId].title[appLocaleId] = capability.title;
707
711
  }
708
712
 
713
+ // Capability.titleShort
714
+ if (capability.titleShort) {
715
+ this._appJson.capabilities[capabilityId].titleShort =
716
+ this._appJson.capabilities[capabilityId].titleShort ?? {};
717
+ this._appJson.capabilities[capabilityId].titleShort[appLocaleId] =
718
+ capability.titleShort;
719
+ }
720
+
709
721
  // Capability.units
710
722
  if (capability.units) {
711
723
  this._appJson.capabilities[capabilityId].units =
@@ -746,6 +758,16 @@ class HomeyCompose {
746
758
  capabilityOptions.title;
747
759
  }
748
760
 
761
+ // Driver.capabilitiesOptions[<capabilityId>].titleShort
762
+ if (capabilityOptions.titleShort) {
763
+ appJsonDriver.capabilitiesOptions[capabilityId] =
764
+ appJsonDriver.capabilitiesOptions[capabilityId] ?? {};
765
+ appJsonDriver.capabilitiesOptions[capabilityId].titleShort =
766
+ appJsonDriver.capabilitiesOptions[capabilityId].titleShort ?? {};
767
+ appJsonDriver.capabilitiesOptions[capabilityId].titleShort[appLocaleId] =
768
+ capabilityOptions.titleShort;
769
+ }
770
+
749
771
  // Driver.capabilitiesOptions[<capabilityId>].units
750
772
  if (capabilityOptions.units) {
751
773
  appJsonDriver.capabilitiesOptions[capabilityId] =
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "homey",
3
- "version": "4.2.1",
3
+ "version": "4.2.2",
4
4
  "description": "Command-line interface and type declarations for Homey Apps",
5
5
  "main": "bin/homey.js",
6
6
  "files": [
@@ -42,7 +42,7 @@
42
42
  "fs-extra": "^10.1.0",
43
43
  "get-port": "^5.1.1",
44
44
  "homey-api": "^3.17.7",
45
- "homey-lib": "^2.48.1",
45
+ "homey-lib": "^2.50.1",
46
46
  "ignore-walk": "^3.0.3",
47
47
  "inquirer": "8.1.2",
48
48
  "object-path": "^0.11.4",