@homebridge/hap-client 4.0.4-beta.1 → 4.0.4-beta.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/package.json +1 -1
- package/eslint.config.mjs +0 -43
- package/scripts/gen-hap-types.ts +0 -92
- package/scripts/notest.ts +0 -9
- package/vitest.config.ts +0 -10
package/package.json
CHANGED
package/eslint.config.mjs
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import antfu from '@antfu/eslint-config'
|
|
2
|
-
|
|
3
|
-
export default antfu(
|
|
4
|
-
{
|
|
5
|
-
ignores: ['dist', 'info', 'ui/.angular'],
|
|
6
|
-
rules: {
|
|
7
|
-
'curly': ['error', 'all'],
|
|
8
|
-
'no-undef': 'error',
|
|
9
|
-
'perfectionist/sort-exports': 'error',
|
|
10
|
-
'perfectionist/sort-imports': [
|
|
11
|
-
'error',
|
|
12
|
-
{
|
|
13
|
-
groups: [
|
|
14
|
-
['type-builtin', 'type-external', 'type-internal'],
|
|
15
|
-
['type-parent', 'type-sibling', 'type-index'],
|
|
16
|
-
'builtin',
|
|
17
|
-
'external',
|
|
18
|
-
'internal',
|
|
19
|
-
['parent', 'sibling', 'index'],
|
|
20
|
-
'side-effect',
|
|
21
|
-
'unknown',
|
|
22
|
-
],
|
|
23
|
-
internalPattern: ['^@/.*'],
|
|
24
|
-
order: 'asc',
|
|
25
|
-
type: 'natural',
|
|
26
|
-
newlinesBetween: 1,
|
|
27
|
-
},
|
|
28
|
-
],
|
|
29
|
-
'perfectionist/sort-named-exports': 'error',
|
|
30
|
-
'perfectionist/sort-named-imports': 'error',
|
|
31
|
-
'style/brace-style': ['error', '1tbs'],
|
|
32
|
-
'style/quote-props': ['error', 'consistent-as-needed'],
|
|
33
|
-
'test/no-only-tests': 'error',
|
|
34
|
-
'ts/consistent-type-imports': 'off',
|
|
35
|
-
'unicorn/no-useless-spread': 'error',
|
|
36
|
-
'unused-imports/no-unused-vars': ['error', { caughtErrors: 'none' }],
|
|
37
|
-
},
|
|
38
|
-
typescript: true,
|
|
39
|
-
formatters: {
|
|
40
|
-
markdown: true,
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
)
|
package/scripts/gen-hap-types.ts
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { writeFileSync } from 'node:fs';
|
|
2
|
-
import { dirname, resolve } from 'node:path';
|
|
3
|
-
import { fileURLToPath } from 'node:url';
|
|
4
|
-
|
|
5
|
-
import { Characteristic, Service, Categories } from '@homebridge/hap-nodejs';
|
|
6
|
-
|
|
7
|
-
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
8
|
-
|
|
9
|
-
/** Generate Service Types */
|
|
10
|
-
|
|
11
|
-
let Services = [
|
|
12
|
-
'export const Services = {',
|
|
13
|
-
] as any;
|
|
14
|
-
|
|
15
|
-
const uuidMap = new Map();
|
|
16
|
-
|
|
17
|
-
for (const [name, value] of Object.entries(Service)) {
|
|
18
|
-
if (value.UUID) {
|
|
19
|
-
if (!uuidMap.has(value.UUID)) {
|
|
20
|
-
// If the UUID does not exist, add a new entry
|
|
21
|
-
Services.push(` '${value.UUID}': '${name}',`);
|
|
22
|
-
uuidMap.set(value.UUID, Services.length - 1);
|
|
23
|
-
}
|
|
24
|
-
Services.push(` '${name}': '${value.UUID}',`);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
Services.push(`}\n\n`);
|
|
29
|
-
Services = Services.join('\n');
|
|
30
|
-
|
|
31
|
-
/** Generate Characteristic Types */
|
|
32
|
-
|
|
33
|
-
let Characteristics = [
|
|
34
|
-
'export const Characteristics = {',
|
|
35
|
-
] as any;
|
|
36
|
-
|
|
37
|
-
for (const [name, value] of Object.entries(Characteristic)) {
|
|
38
|
-
if (value.UUID) {
|
|
39
|
-
Characteristics.push(` '${value.UUID}': '${name}',`);
|
|
40
|
-
Characteristics.push(` '${name}': '${value.UUID}',`);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
Characteristics.push(`}\n\n`);
|
|
45
|
-
Characteristics = Characteristics.join('\n');
|
|
46
|
-
|
|
47
|
-
/** Generate Category Types */
|
|
48
|
-
|
|
49
|
-
let Category = [
|
|
50
|
-
'export const Categories = {',
|
|
51
|
-
] as any;
|
|
52
|
-
|
|
53
|
-
// @ts-ignore
|
|
54
|
-
for (const [name, value] of Object.entries(Categories)) {
|
|
55
|
-
if (typeof value === 'number') {
|
|
56
|
-
Category.push(` ${name}: ${value},`);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
Category.push(`}\n\n`);
|
|
61
|
-
Category = Category.join('\n');
|
|
62
|
-
|
|
63
|
-
let Enums = [
|
|
64
|
-
'export const Enums = {',
|
|
65
|
-
] as any;
|
|
66
|
-
|
|
67
|
-
for (const [name, value] of Object.entries(Characteristic)) {
|
|
68
|
-
if (typeof value === 'function' && value.prototype) {
|
|
69
|
-
const staticKeys = Object.getOwnPropertyNames(value)
|
|
70
|
-
.filter(
|
|
71
|
-
key =>
|
|
72
|
-
key !== 'length' &&
|
|
73
|
-
key !== 'name' &&
|
|
74
|
-
key !== 'prototype' &&
|
|
75
|
-
key !== 'UUID' &&
|
|
76
|
-
typeof (value as any)[key] !== 'function'
|
|
77
|
-
);
|
|
78
|
-
if (staticKeys.length > 0) {
|
|
79
|
-
Enums.push(` ${name}: {`);
|
|
80
|
-
staticKeys.forEach(k => {
|
|
81
|
-
Enums.push(` ${(value as any)[k]}: '${k}',`);
|
|
82
|
-
});
|
|
83
|
-
Enums.push(' },');
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
Enums.push(`}\n`);
|
|
88
|
-
Enums = Enums.join('\n');
|
|
89
|
-
|
|
90
|
-
const out = `/* This file is automatically generated */\n\n` + Services + Characteristics + Category + Enums
|
|
91
|
-
|
|
92
|
-
writeFileSync(resolve(__dirname, '../src/hap-types.ts'), out, 'utf8');
|
package/scripts/notest.ts
DELETED