create-mirta 0.0.6 → 0.0.7

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.
@@ -9,10 +9,10 @@
9
9
  "build:dev": "cross-env NODE_ENV=development rollup -c"
10
10
  },
11
11
  "dependencies": {
12
- "mirta": "0.0.6"
12
+ "mirta": "0.0.7"
13
13
  },
14
14
  "devDependencies": {
15
- "@mirta/rollup": "0.0.6",
15
+ "@mirta/rollup": "0.0.7",
16
16
  "cross-env": "^7.0.3",
17
17
  "rollup": "^4.45.1"
18
18
  }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "dependencies": {
3
- "@mirta/store": "0.0.6"
3
+ "@mirta/store": "0.0.7"
4
4
  }
5
5
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "devDependencies": {
3
- "@mirta/globals": "0.0.6",
4
- "@mirta/tsconfig": "0.0.6",
3
+ "@mirta/globals": "0.0.7",
4
+ "@mirta/tsconfig": "0.0.7",
5
5
  "@types/node": "^24.1.0",
6
6
  "typescript": "^5.8.3"
7
7
  }
@@ -3,6 +3,7 @@
3
3
  "test": "vitest run"
4
4
  },
5
5
  "devDependencies": {
6
+ "@mirta/testing": "0.0.7",
6
7
  "vitest": "^3.2.4",
7
8
  "vitest-mock-extended": "^3.1.0"
8
9
  }
@@ -25,6 +25,8 @@ export default defineConfig([
25
25
  rules: {
26
26
  // Правило несовместимо с wb-rules 2.0
27
27
  '@typescript-eslint/prefer-includes': 'off',
28
+ // Позволяет работать с dev['deviceId']['controlId']
29
+ '@typescript-eslint/dot-notation': 'off',
28
30
  // Разрешает интерполяцию базовых типов
29
31
  '@typescript-eslint/restrict-template-expressions': ['error', {
30
32
  allowAny: false,
@@ -33,6 +35,19 @@ export default defineConfig([
33
35
  allowNumber: true,
34
36
  allowRegExp: true,
35
37
  }],
38
+ // Разрешает неиспользуемые переменные с символом подчёркивания
39
+ '@typescript-eslint/no-unused-vars': [
40
+ 'error',
41
+ {
42
+ 'args': 'all',
43
+ 'argsIgnorePattern': '^_',
44
+ 'caughtErrors': 'all',
45
+ 'caughtErrorsIgnorePattern': '^_',
46
+ 'destructuredArrayIgnorePattern': '^_',
47
+ 'varsIgnorePattern': '^_',
48
+ 'ignoreRestSiblings': true,
49
+ },
50
+ ],
36
51
  },
37
52
  languageOptions: {
38
53
  parserOptions: {
@@ -36,7 +36,7 @@ defineRule('count_impulses', {
36
36
  if (lastInputState == 0 && newValue == 1) { // Проверка фронта импульса с 0 на 1
37
37
 
38
38
  impulseCount += 1 // Счетчик импульсов
39
- dev.pulse_counter.impulses = impulseCount // Отображение импульсов в виртуальном устройстве
39
+ dev['pulse_counter']['impulses'] = impulseCount // Отображение импульсов в виртуальном устройстве
40
40
 
41
41
  }
42
42
 
@@ -51,7 +51,7 @@ defineRule('reset_counter', {
51
51
  then: function () {
52
52
 
53
53
  impulseCount = 0 // Сброс счетчика
54
- dev.pulse_counter.impulses = impulseCount
54
+ dev['pulse_counter']['impulses'] = impulseCount
55
55
 
56
56
  },
57
57
  })
@@ -21,25 +21,25 @@ defineRule('msw3_co2', {
21
21
 
22
22
  if (co2_good) {
23
23
 
24
- dev[devName]['/Green LED'] = true
25
- dev[devName]['/Red LED'] = false
26
- dev[devName]['/LED Period (s)'] = 10
24
+ dev[devName]['Green LED'] = true
25
+ dev[devName]['Red LED'] = false
26
+ dev[devName]['LED Period (s)'] = 10
27
27
 
28
28
  }
29
29
 
30
30
  if (co2_middle) {
31
31
 
32
- dev[devName]['/Green LED'] = true
33
- dev[devName]['/Red LED'] = true
34
- dev[devName]['/LED Period (s)'] = 5
32
+ dev[devName]['Green LED'] = true
33
+ dev[devName]['Red LED'] = true
34
+ dev[devName]['LED Period (s)'] = 5
35
35
 
36
36
  }
37
37
 
38
38
  if (co2_bad) {
39
39
 
40
- dev[devName]['/Green LED'] = false
41
- dev[devName]['/Red LED'] = true
42
- dev[devName]['/LED Period (s)'] = 1
40
+ dev[devName]['Green LED'] = false
41
+ dev[devName]['Red LED'] = true
42
+ dev[devName]['LED Period (s)'] = 1
43
43
 
44
44
  }
45
45
 
@@ -18,26 +18,26 @@ function ruleCO2(devCO2: string, minCO2: number, maxCO2: number) {
18
18
  log.info('ruleCO2 ' + devCO2 + ' enter with', newValue)
19
19
  if (newValue < minCO2) {
20
20
 
21
- dev[devCO2]['/LED Glow Duration (ms)'] = 50
22
- dev[devCO2]['/Green LED'] = true
23
- dev[devCO2]['/Red LED'] = false
24
- dev[devCO2]['/LED Period (s)'] = 3
21
+ dev[devCO2]['LED Glow Duration (ms)'] = 50
22
+ dev[devCO2]['Green LED'] = true
23
+ dev[devCO2]['Red LED'] = false
24
+ dev[devCO2]['LED Period (s)'] = 3
25
25
 
26
26
  }
27
27
  if ((newValue > minCO2) && (newValue < maxCO2)) {
28
28
 
29
- dev[devCO2]['/LED Glow Duration (ms)'] = 50
30
- dev[devCO2]['/Green LED'] = true
31
- dev[devCO2]['/Red LED'] = true
32
- dev[devCO2]['/LED Period (s)'] = 2
29
+ dev[devCO2]['LED Glow Duration (ms)'] = 50
30
+ dev[devCO2]['Green LED'] = true
31
+ dev[devCO2]['Red LED'] = true
32
+ dev[devCO2]['LED Period (s)'] = 2
33
33
 
34
34
  }
35
35
  if (newValue > maxCO2) {
36
36
 
37
- dev[devCO2]['/LED Glow Duration (ms)'] = 50
38
- dev[devCO2]['/Green LED'] = false
39
- dev[devCO2]['/Red LED'] = true
40
- dev[devCO2]['/LED Period (s)'] = 1
37
+ dev[devCO2]['LED Glow Duration (ms)'] = 50
38
+ dev[devCO2]['Green LED'] = false
39
+ dev[devCO2]['Red LED'] = true
40
+ dev[devCO2]['LED Period (s)'] = 1
41
41
 
42
42
  }
43
43
 
@@ -29,8 +29,8 @@ runShellCommand('echo 2 > /sys/class/pwm/pwmchip0/export')
29
29
 
30
30
  function _buzzer_set_params() {
31
31
 
32
- const period = 1.0 / (dev.buzzer.frequency as number) * 1E9
33
- const duty_cycle = (dev.buzzer.volume as number) * 1.0 / 100 * period * 0.5
32
+ const period = 1.0 / (dev['buzzer']['frequency'] as number) * 1E9
33
+ const duty_cycle = (dev['buzzer']['volume'] as number) * 1.0 / 100 * period * 0.5
34
34
 
35
35
  runShellCommand(`echo ${period} > /sys/class/pwm/pwmchip0/pwm2/period`)
36
36
  runShellCommand(`echo ${duty_cycle} > /sys/class/pwm/pwmchip0/pwm2/duty_cycle`)
@@ -45,7 +45,7 @@ defineRule('_system_buzzer_params', {
45
45
 
46
46
  then: function () {
47
47
 
48
- if (dev.buzzer.enabled) {
48
+ if (dev['buzzer']['enabled']) {
49
49
 
50
50
  _buzzer_set_params()
51
51
 
@@ -58,7 +58,7 @@ defineRule('_system_buzzer_onof', {
58
58
  whenChanged: 'buzzer/enabled',
59
59
  then: function () {
60
60
 
61
- if (dev.buzzer.enabled) {
61
+ if (dev['buzzer']['enabled']) {
62
62
 
63
63
  _buzzer_set_params()
64
64
  runShellCommand('echo 1 > /sys/class/pwm/pwmchip0/pwm2/enable')
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "create-mirta",
3
3
  "description": "🛠️ The recommended way to start a Mirta project.",
4
- "version": "0.0.6",
4
+ "version": "0.0.7",
5
5
  "license": "Unlicense",
6
6
  "keywords": [
7
7
  "mirta",