create-mirta 0.3.4 → 0.4.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.
Files changed (96) hide show
  1. package/dist/classic.mjs +120 -0
  2. package/dist/index.mjs +800 -690
  3. package/dist/mono.mjs +208 -0
  4. package/dist/resolver.mjs +843 -0
  5. package/locales/en-US.json +109 -0
  6. package/locales/ru-RU.json +109 -0
  7. package/package.json +25 -22
  8. package/templates/classic/starter/content/package.json +11 -0
  9. package/{dist/templates/config/typescript → templates/classic/starter/content}/tsconfig.json +0 -5
  10. package/{dist/templates/eslint/eslint.config.mjs.ejs → templates/classic/starter/features/eslint/eslint.config.mjs.tt} +11 -6
  11. package/{dist/templates/base/_env → templates/classic/starter/features/examples/_.env} +1 -1
  12. package/templates/classic/starter/features/examples/src/wb-rules/01-counter.ts +12 -0
  13. package/templates/classic/starter/features/examples/src/wb-rules-modules/counter.ts +42 -0
  14. package/templates/classic/starter/features/examples-vitest/tests/wb-rules-modules/counter.test.ts +56 -0
  15. package/templates/classic/starter/features/vitest/package.json +10 -0
  16. package/templates/classic/starter/features/vitest-eslint/package.json +5 -0
  17. package/templates/classic/starter/template.json +10 -0
  18. package/{dist/templates/config/store → templates/classic/store/content}/package.json +1 -1
  19. package/templates/classic/store/features/examples/src/wb-rules/01-counter.ts +13 -0
  20. package/templates/classic/store/features/examples/src/wb-rules/02-counter.ts +19 -0
  21. package/templates/classic/store/features/examples/src/wb-rules-modules/counter-store.ts +33 -0
  22. package/templates/classic/store/features/examples/src/wb-rules-modules/counter.ts +44 -0
  23. package/templates/classic/store/features/examples-vitest/tests/wb-rules-modules/counter.test.ts +49 -0
  24. package/templates/classic/store/template.json +14 -0
  25. package/templates/mono/core/content/package.json +6 -0
  26. package/templates/mono/core/content/pnpm-workspace.yaml +3 -0
  27. package/templates/mono/core/content/sites/.gitkeep +0 -0
  28. package/templates/mono/core/content/tsconfig.json +31 -0
  29. package/templates/mono/core/features/eslint/eslint.config.mjs.tt +126 -0
  30. package/templates/mono/core/features/vitest/package.json +10 -0
  31. package/templates/mono/core/template.json +5 -0
  32. package/templates/mono/package/features/package/packages/{{package}}/package.json.tt +25 -0
  33. package/templates/mono/package/features/package/packages/{{package}}/src/.gitkeep +0 -0
  34. package/templates/mono/package/features/package/packages/{{package}}/tsconfig.build.json +10 -0
  35. package/templates/mono/package/features/package/sites/{{package}}-demo/package.json.tt +19 -0
  36. package/templates/mono/package/features/package/sites/{{package}}-demo/src/wb-rules/.gitkeep +0 -0
  37. package/templates/mono/package/features/package/sites/{{package}}-demo/src/wb-rules-modules/.gitkeep +0 -0
  38. package/templates/mono/package/features/package/sites/{{package}}-demo/tsconfig.build.json +10 -0
  39. package/templates/mono/package/features/package-examples/packages/{{package}}/src/index.ts +2 -0
  40. package/templates/mono/package/features/package-examples/packages/{{package}}/src/thermostat.ts +99 -0
  41. package/templates/mono/package/features/package-examples/packages/{{package}}/src/types.ts +25 -0
  42. package/templates/mono/package/features/package-examples/sites/{{package}}-demo/src/wb-rules/01-thermo.ts.tt +11 -0
  43. package/templates/mono/package/features/package-examples-vitest/packages/{{package}}/tests/mirta-thermostat.test.ts +72 -0
  44. package/templates/mono/package/features/package-github/packages/{{package}}/package.json.tt +11 -0
  45. package/templates/mono/package/template.json +16 -0
  46. package/templates/mono/sites/content/mirta.config.json +37 -0
  47. package/templates/mono/sites/content/sites/home/package.json +17 -0
  48. package/templates/mono/sites/content/sites/home/src/wb-rules/.gitkeep +0 -0
  49. package/templates/mono/sites/content/sites/home/src/wb-rules-modules/.gitkeep +0 -0
  50. package/templates/mono/sites/content/sites/home-staging/package.json +17 -0
  51. package/templates/mono/sites/content/sites/home-staging/src/wb-rules/.gitkeep +0 -0
  52. package/templates/mono/sites/content/sites/home-staging/src/wb-rules-modules/.gitkeep +0 -0
  53. package/templates/mono/sites/template.json +9 -0
  54. package/{dist/templates/base/_editorconfig → templates/shared/base/content/_.editorconfig} +1 -1
  55. package/{dist/templates/base/_gitignore → templates/shared/base/content/_.gitignore} +1 -3
  56. package/templates/shared/base/content/_.node-version +1 -0
  57. package/{dist/templates/base/.vscode → templates/shared/base/content/_.vscode}/settings.json +12 -1
  58. package/templates/shared/base/content/package.json +22 -0
  59. package/templates/shared/base/features/connection/_.env.local.tt +1 -0
  60. package/templates/shared/base/features/connection/mirta.config.json +6 -0
  61. package/templates/shared/base/features/eslint/package.json +9 -0
  62. package/templates/shared/base/features/examples/mirta.config.json.tt +51 -0
  63. package/templates/shared/base/features/github/_.github/workflows/build.yml.tt +56 -0
  64. package/templates/shared/base/features/github-vitest/_.github/workflows/test.yml +30 -0
  65. package/templates/shared/base/template.json +16 -0
  66. package/dist/locales/en-US.json +0 -85
  67. package/dist/locales/ru-RU.json +0 -86
  68. package/dist/templates/base/package.json +0 -27
  69. package/dist/templates/base/rollup.config.mjs +0 -15
  70. package/dist/templates/config/typescript/package.json +0 -8
  71. package/dist/templates/config/vitest/package.json +0 -10
  72. package/dist/templates/config/vitest/tests/setup/dotenv.ts +0 -5
  73. package/dist/templates/config/vitest/tests/setup/mirta.ts +0 -41
  74. package/dist/templates/config/vitest/tests/tsconfig.json +0 -9
  75. package/dist/templates/config/vitest/vitest.config.ts +0 -37
  76. package/dist/templates/example/base/src/wb-rules/00-dotenv.ts +0 -52
  77. package/dist/templates/example/base/src/wb-rules/01-count.ts +0 -6
  78. package/dist/templates/example/base/src/wb-rules-modules/counter.ts +0 -14
  79. package/dist/templates/example/store/src/wb-rules/01-count.ts +0 -10
  80. package/dist/templates/example/store/src/wb-rules-modules/counter-store.ts +0 -7
  81. package/dist/templates/example/store/src/wb-rules-modules/counter.ts +0 -20
  82. package/dist/templates/example/vitest/base/tests/wb-rules-modules/counter.test.ts +0 -10
  83. package/dist/templates/example/vitest/store/tests/wb-rules-modules/counter-store.test.ts +0 -13
  84. /package/{dist/assets → assets}/logo.art +0 -0
  85. /package/{dist/templates/base → templates/classic/starter/content}/src/wb-rules/.gitkeep +0 -0
  86. /package/{dist/templates/base → templates/classic/starter/content}/src/wb-rules-modules/.gitkeep +0 -0
  87. /package/{dist/templates/base → templates/classic/starter/content}/types/env.d.ts +0 -0
  88. /package/{dist/templates/config → templates/classic/starter/features}/vitest/tests/wb-rules-modules/.gitkeep +0 -0
  89. /package/{dist/templates/config → templates/classic/starter/features}/vitest/tsconfig.json +0 -0
  90. /package/{dist/templates/base/_gitattributes → templates/shared/base/content/_.gitattributes} +0 -0
  91. /package/{dist/templates/base/_npmrc → templates/shared/base/content/_.npmrc} +0 -0
  92. /package/{dist/templates/base/.vscode → templates/shared/base/content/_.vscode}/extensions.json +0 -0
  93. /package/{dist/templates/base/.vscode → templates/shared/base/content/_.vscode}/tasks.json +0 -0
  94. /package/{dist/templates/config/eslint/.vscode → templates/shared/base/features/eslint/_.vscode}/extensions.json +0 -0
  95. /package/{dist/templates/config/eslint/.vscode → templates/shared/base/features/eslint/_.vscode}/settings.json +0 -0
  96. /package/{dist/templates/config/vitest/.vscode → templates/shared/base/features/vitest/_.vscode}/extensions.json +0 -0
@@ -0,0 +1,49 @@
1
+ vi.mock('#wbm/counter-store', () => {
2
+
3
+ const mockStore = {
4
+ count: 0,
5
+ double: 0,
6
+ increment: vi.fn(),
7
+ setCount: vi.fn(),
8
+ }
9
+
10
+ return {
11
+ useCounterStore: () => mockStore,
12
+ }
13
+
14
+ })
15
+
16
+ import { useCounter } from '#wbm/counter'
17
+ import { useCounterStore } from '#wbm/counter-store'
18
+
19
+ describe('useCounter', () => {
20
+
21
+ it('should read count from store', () => {
22
+
23
+ // Arrange
24
+ const store = useCounterStore()
25
+ store.count = 42
26
+
27
+ // Act
28
+ const counter = useCounter()
29
+
30
+ // Assert
31
+ expect(counter.count).toBe(42)
32
+
33
+ })
34
+
35
+ it('should call store.increment when increment is called', () => {
36
+
37
+ // Arrange
38
+ const store = useCounterStore()
39
+ const counter = useCounter()
40
+
41
+ // Act
42
+ counter.increment()
43
+
44
+ // Assert
45
+ expect(store.increment).toHaveBeenCalledOnce()
46
+
47
+ })
48
+
49
+ })
@@ -0,0 +1,14 @@
1
+ {
2
+ "extends": "starter",
3
+ "features": {
4
+ "global": {
5
+ "examples": "recommended",
6
+ "eslint": "recommended",
7
+ "vitest": "optional"
8
+ },
9
+ "compound": [
10
+ "examples-vitest"
11
+ ]
12
+ },
13
+ "order": 1020
14
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "workspaces": [
3
+ "packages/*",
4
+ "sites/*"
5
+ ]
6
+ }
@@ -0,0 +1,3 @@
1
+ packages:
2
+ - packages/*
3
+ - sites/*
File without changes
@@ -0,0 +1,31 @@
1
+ {
2
+ "extends": "@mirta/tsconfig",
3
+ "compilerOptions": {
4
+ "rootDir": ".",
5
+ "baseUrl": ".",
6
+ "types": [
7
+ "@mirta/globals",
8
+ "node"
9
+ ]
10
+ },
11
+ "include": [
12
+ "*.ts",
13
+ "*.mts",
14
+
15
+ // === JS ===
16
+
17
+ "packages/*/src/**/*.js",
18
+ "packages/*/tests/**/*.js",
19
+
20
+ "sites/*/src/**/*.js",
21
+ "sites/*/tests/**/*.js",
22
+
23
+ // === TS ===
24
+
25
+ "packages/*/src/**/*.ts",
26
+ "packages/*/tests/**/*.ts",
27
+
28
+ "sites/*/src/**/*.ts",
29
+ "sites/*/tests/**/*.ts"
30
+ ]
31
+ }
@@ -0,0 +1,126 @@
1
+ import js from '@eslint/js'
2
+ import globals from 'globals'
3
+ import globalsMirta from '@mirta/globals/eslint'
4
+ import tseslint from 'typescript-eslint'
5
+ import stylistic from '@stylistic/eslint-plugin'
6
+ {{#if features.vitest}}
7
+ import vitest from '@vitest/eslint-plugin'
8
+ {{/if features.vitest}}
9
+ import { defineConfig, globalIgnores } from 'eslint/config'
10
+
11
+ export default defineConfig([
12
+ {
13
+ files: ['**/*.{js,mjs,cjs,ts,mts,cts}'],
14
+ plugins: { js },
15
+ extends: ['js/recommended'],
16
+ },
17
+ {
18
+ files: ['**/*.{js,mjs,cjs,ts,mts,cts}'],
19
+ languageOptions: {
20
+ globals: {
21
+ ...globals.node,
22
+ ...globalsMirta,
23
+ },
24
+ },
25
+ },
26
+ // TypeScript Defaults
27
+ ...tseslint.configs.strictTypeChecked.map(config => ({
28
+ ...config,
29
+ files: ['**/*.ts'],
30
+ })),
31
+ ...tseslint.configs.stylisticTypeChecked.map(config => ({
32
+ ...config,
33
+ files: ['**/*.ts'],
34
+ })),
35
+ // TypeScript Overrides
36
+ {
37
+ files: ['**/*.ts'],
38
+ rules: {
39
+ // Позволяет работать с dev['deviceId']['controlId']
40
+ '@typescript-eslint/dot-notation': 'off',
41
+ // Разрешает интерполяцию базовых типов
42
+ '@typescript-eslint/restrict-template-expressions': ['error', {
43
+ allowAny: false,
44
+ allowBoolean: true,
45
+ allowNullish: true,
46
+ allowNumber: true,
47
+ allowRegExp: true,
48
+ }],
49
+ // Разрешает неиспользуемые переменные с символом подчёркивания
50
+ '@typescript-eslint/no-unused-vars': [
51
+ 'error',
52
+ {
53
+ 'args': 'all',
54
+ 'argsIgnorePattern': '^_',
55
+ 'caughtErrors': 'all',
56
+ 'caughtErrorsIgnorePattern': '^_',
57
+ 'destructuredArrayIgnorePattern': '^_',
58
+ 'varsIgnorePattern': '^_',
59
+ 'ignoreRestSiblings': true,
60
+ },
61
+ ],
62
+ '@typescript-eslint/prefer-nullish-coalescing': ['error', {
63
+ 'ignorePrimitives': {
64
+ 'string': true,
65
+ },
66
+ }],
67
+ },
68
+ languageOptions: {
69
+ parserOptions: {
70
+ project: [
71
+ './tsconfig.json',
72
+ './packages/*/tsconfig.json',
73
+ './sites/*/tsconfig.json',
74
+ ],
75
+ tsconfigRootDir: import.meta.dirname,
76
+ },
77
+ },
78
+ },
79
+ // Stylistic Defaults
80
+ {
81
+ files: ['**/*.{js,mjs,cjs,ts,mts,cts}'],
82
+ ...stylistic.configs.customize({
83
+ quotes: 'single',
84
+ quoteProps: 'consistent',
85
+ indent: 2,
86
+ }),
87
+ },
88
+ // Stylistic Overrides
89
+ {
90
+ files: ['**/*.{js,mjs,cjs,ts,mts,cts}'],
91
+ rules: {
92
+ '@stylistic/comma-dangle': ['error', {
93
+ 'arrays': 'always-multiline',
94
+ 'objects': 'always-multiline',
95
+ }],
96
+ '@stylistic/curly-newline': ['error', 'always'],
97
+ '@stylistic/nonblock-statement-body-position': ['error', 'below'],
98
+ '@stylistic/padded-blocks': ['error', {
99
+ 'blocks': 'always',
100
+ }],
101
+ },
102
+ },
103
+ {{#if features.vitest}}
104
+ // Vitest Defaults
105
+ {
106
+ files: ['packages/*/tests/**', 'sites/*/tests/**'],
107
+ plugins: {
108
+ vitest,
109
+ },
110
+ rules: {
111
+ ...vitest.configs.recommended.rules,
112
+ },
113
+ languageOptions: {
114
+ globals: {
115
+ ...vitest.environments.env.globals,
116
+ },
117
+ },
118
+ },
119
+ {{/if features.vitest}}
120
+ globalIgnores([
121
+ 'node_modules/',
122
+ 'dist/',
123
+ 'packages/*/dist/',
124
+ 'sites/*/dist/',
125
+ ]),
126
+ ])
@@ -0,0 +1,10 @@
1
+ {
2
+ "scripts": {
3
+ "test": "vitest run --config @mirta/testing/config"
4
+ },
5
+ "devDependencies": {
6
+ "@mirta/testing": "0.4.3",
7
+ "vitest": "^4.0.8",
8
+ "vitest-mock-extended": "^3.1.0"
9
+ }
10
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "extends": "base",
3
+ "hidden": true,
4
+ "order": 2000
5
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "{{packageFull}}",
3
+ "version": "0.0.0",
4
+ "keywords": [
5
+ "mirta",
6
+ "wb-rules"
7
+ ],
8
+ "type": "module",
9
+ "files": [
10
+ "dist",
11
+ "LICENSE",
12
+ "README.md"
13
+ ],
14
+ "exports": {
15
+ ".": {
16
+ "import": {
17
+ "types": "./dist/index.d.mts",
18
+ "default": "./dist/index.mjs"
19
+ }
20
+ }
21
+ },
22
+ "imports": {
23
+ "#src/*": "./src/*.js"
24
+ }
25
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "extends": "../../tsconfig.json",
3
+ "compilerOptions": {
4
+ "rootDir": "src"
5
+ },
6
+ "include": [
7
+ "src/**/*.js",
8
+ "src/**/*.ts"
9
+ ]
10
+ }
@@ -0,0 +1,19 @@
1
+ {
2
+ "name": "{{package}}-demo",
3
+ "private": true,
4
+ "imports": {
5
+ "#wb/*": [
6
+ "./src/wb-rules/*.js"
7
+ ],
8
+ "#wbm/*": [
9
+ "./src/wb-rules-modules/*.js"
10
+ ]
11
+ },
12
+ "scripts": {
13
+ "build:mono": "rollup -c node:@mirta/rollup/config",
14
+ "wb:deploy": "mirta deploy"
15
+ },
16
+ "dependencies": {
17
+ "{{packageFull}}": "workspace:*"
18
+ }
19
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "extends": "../../tsconfig.json",
3
+ "compilerOptions": {
4
+ "rootDir": "."
5
+ },
6
+ "include": [
7
+ "src/**/*.js",
8
+ "src/**/*.ts"
9
+ ]
10
+ }
@@ -0,0 +1,2 @@
1
+ export { useThermostat } from './thermostat'
2
+ export type { ThermostatOptions } from './types'
@@ -0,0 +1,99 @@
1
+ import { isNumber, isString } from '@mirta/basics'
2
+
3
+ import { type ThermostatOptions } from './types'
4
+
5
+ // Thermostat Module Example
6
+
7
+ // Примечание авторам модулей: обязательно используйте комментарии в формате JSDoc,
8
+ // чтобы документировать ваши конструкции удобными всплывающими подсказками.
9
+
10
+ /**
11
+ * Логика температурного регулятора.
12
+ *
13
+ * @param options Параметры термостата.
14
+ *
15
+ * @example
16
+ * ```ts
17
+ * import { useThermostat } from '@nickname/mirta-thermostat'
18
+ *
19
+ * const thermostat = useThermostat({
20
+ * sensorTopic: 'A60-M1W3/External Sensor 1',
21
+ * heaterTopic: 'wb-gpio/EXT4_R3A1',
22
+ * targetTemp: 22,
23
+ * hysteresis: 0.5
24
+ * })
25
+ *
26
+ * // Установить новое значение целевой температуры:
27
+ * thermostat.setTargetTemp(24)
28
+ *
29
+ * ```
30
+ **/
31
+ export function useThermostat(options: ThermostatOptions) {
32
+
33
+ const { sensorTopic, heaterTopic, hysteresis = 0.5 } = options
34
+
35
+ let targetTemp = options.targetTemp
36
+
37
+ defineRule({
38
+
39
+ // При изменении показаний в топике датчика температуры...
40
+ whenChanged: sensorTopic,
41
+
42
+ // ...проверяем, не вышла ли температура за пределы допустимых значений.
43
+ then: (newValue) => {
44
+
45
+ let currentTemp: number | undefined
46
+
47
+ // Проверяем, является ли значение текущей температуры допустимым.
48
+
49
+ if (isNumber(newValue)) {
50
+
51
+ currentTemp = newValue
52
+
53
+ }
54
+ else if (isString(newValue)) {
55
+
56
+ currentTemp = parseFloat(newValue)
57
+
58
+ }
59
+
60
+ if (currentTemp === undefined || isNaN(currentTemp)) {
61
+
62
+ // Отключаем нагреватель, если значение температуры не удаётся прочитать.
63
+ dev[heaterTopic] = false
64
+
65
+ // Записываем в лог сообщение об ошибке.
66
+ log.error('[Thermostat Module] Invalid temperature value: {}', newValue)
67
+
68
+ // Прерываем дальше выполнения правила.
69
+ return
70
+
71
+ }
72
+
73
+ if (currentTemp <= (targetTemp - hysteresis)) {
74
+
75
+ // Если температура ниже минимальной, включаем нагреватель.
76
+ dev[heaterTopic] = true
77
+
78
+ }
79
+ else if (currentTemp >= (targetTemp + hysteresis)) {
80
+
81
+ // Если температура выше максимальной, выключаем нагреватель.
82
+ dev[heaterTopic] = false
83
+
84
+ }
85
+
86
+ },
87
+ })
88
+
89
+ return {
90
+
91
+ /** Позволяет установить новое значение целевой температуры. */
92
+ setTargetTemp(newValue: number) {
93
+
94
+ targetTemp = newValue
95
+
96
+ },
97
+ }
98
+
99
+ }
@@ -0,0 +1,25 @@
1
+ /** Опции термостата. */
2
+ export interface ThermostatOptions {
3
+
4
+ /** MQTT-топик датчика температуры. */
5
+ sensorTopic: string
6
+
7
+ /** MQTT-топик нагревательного элемента. */
8
+ heaterTopic: string
9
+
10
+ /** Начальное значение целевой температуры. */
11
+ targetTemp: number
12
+
13
+ /**
14
+ * Разница температур для предотвращения частых переключений между включением и выключением нагрева.
15
+ *
16
+ * Значение по умолчанию: `0.5` °C.
17
+ *
18
+ * Обычно рекомендуется задавать гистерезис в диапазоне
19
+ * от `0.5` до `2` °C. Чем больше величина гистерезиса,
20
+ * тем реже будут происходить циклы включения-выключения, однако
21
+ * точность поддержания заданной температуры снизится.
22
+ *
23
+ **/
24
+ hysteresis?: number
25
+ }
@@ -0,0 +1,11 @@
1
+ import { useThermostat } from '{{packageFull}}'
2
+
3
+ const thermostat = useThermostat({
4
+ sensorTopic: 'A60-M1W3/External Sensor 1',
5
+ heaterTopic: 'wb-gpio/EXT4_R3A1',
6
+ targetTemp: 22,
7
+ hysteresis: 0.5,
8
+ })
9
+
10
+ // Установить новое значение целевой температуры:
11
+ thermostat.setTargetTemp(24)
@@ -0,0 +1,72 @@
1
+ import { useSimulator } from '@mirta/testing'
2
+ import { useThermostat } from '#src/index'
3
+
4
+ const simulator = useSimulator()
5
+
6
+ beforeEach(() => {
7
+
8
+ simulator.reset()
9
+
10
+ })
11
+
12
+ describe('useThermostat', () => {
13
+
14
+ const heaterTopic = 'deviceId/heater'
15
+ const sensorTopic = 'deviceId/sensor'
16
+
17
+ beforeEach(() => {
18
+
19
+ dev[heaterTopic] = false
20
+ useThermostat({
21
+ sensorTopic: sensorTopic,
22
+ heaterTopic: heaterTopic,
23
+ targetTemp: 22,
24
+ hysteresis: 0.5,
25
+ })
26
+
27
+ })
28
+
29
+ it('turns on heater when temperature drops below target', () => {
30
+
31
+ simulator.defineRule.run({ topic: sensorTopic, value: 21 })
32
+ expect(dev[heaterTopic]).toBe(true)
33
+
34
+ })
35
+
36
+ it('turns off heater when temperature above target', () => {
37
+
38
+ dev[heaterTopic] = true
39
+
40
+ simulator.defineRule.run({ topic: sensorTopic, value: 23 })
41
+ expect(dev[heaterTopic]).toBe(false)
42
+
43
+ })
44
+
45
+ it('handles invalid temperature values', () => {
46
+
47
+ dev[heaterTopic] = true
48
+
49
+ simulator.defineRule.run({ topic: sensorTopic, value: 'invalid_value' })
50
+ expect(dev[heaterTopic]).toBe(false)
51
+
52
+ })
53
+
54
+ it('does not toggle heater inside hysteresis band', () => {
55
+
56
+ dev[heaterTopic] = true
57
+
58
+ simulator.defineRule.run({ topic: sensorTopic, value: 22.4 })
59
+ expect(dev[heaterTopic]).toBe(true)
60
+
61
+ })
62
+
63
+ it('does not toggle heater inside hysteresis band (heater off)', () => {
64
+
65
+ dev[heaterTopic] = false
66
+
67
+ simulator.defineRule.run({ topic: sensorTopic, value: 21.6 })
68
+ expect(dev[heaterTopic]).toBe(false)
69
+
70
+ })
71
+
72
+ })
@@ -0,0 +1,11 @@
1
+ {
2
+ "homepage": "https://github.com/{{githubOwner}}/{{githubRepository}}/tree/{{githubBranch}}/packages/{{package}}#readme",
3
+ "repository": {
4
+ "type": "git",
5
+ "url": "git+https://github.com/{{githubOwner}}/{{githubRepository}}.git",
6
+ "directory": "packages/{{package}}"
7
+ },
8
+ "bugs": {
9
+ "url": "https://github.com/{{githubOwner}}/{{githubRepository}}/issues"
10
+ }
11
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "extends": "core",
3
+ "features": {
4
+ "global": {
5
+ "package": "required",
6
+ "github": "recommended",
7
+ "vitest": "recommended"
8
+ },
9
+ "compound": [
10
+ "package-github",
11
+ "package-examples",
12
+ "package-examples-vitest"
13
+ ]
14
+ },
15
+ "order": 2020
16
+ }
@@ -0,0 +1,37 @@
1
+ {
2
+ "deploy": {
3
+ // Профили деплоя.
4
+ "profiles": {
5
+ // Стабильные разработки
6
+ "home": {
7
+ // Использовать подключение по умолчанию.
8
+ "connection": "default",
9
+
10
+ // Предустановки копирования директорий.
11
+ "mappings": ["wb-rules-es5"]
12
+ },
13
+ // Экспериментальный код
14
+ "home-staging": {
15
+
16
+ /**
17
+ * Варианты значений для connection:
18
+ *
19
+ * Явная строка подключения (не рекомендуется для публичных репозиториев)
20
+ * "connection": "ssh://user@192.168.42.1",
21
+ *
22
+ * Переменные окружения и их комбинации:
23
+ * "connection": "${WB_CONN_WORK};wsl=${WB_WSL}",
24
+ *
25
+ * Предопределённая строка подключения из `connections`:
26
+ * "connection": "work",
27
+ **/
28
+
29
+ // Использовать подключение по умолчанию.
30
+ "connection": "default",
31
+
32
+ // Предустановки копирования директорий.
33
+ "mappings": ["wb-rules-es5"]
34
+ }
35
+ }
36
+ }
37
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "name": "home",
3
+ "private": true,
4
+ "type": "module",
5
+ "imports": {
6
+ "#wb/*": [
7
+ "./src/wb-rules/*.js"
8
+ ],
9
+ "#wbm/*": [
10
+ "./src/wb-rules-modules/*.js"
11
+ ]
12
+ },
13
+ "scripts": {
14
+ "build:mono": "rollup -c node:@mirta/rollup/config",
15
+ "wb:deploy": "mirta deploy --profile=home"
16
+ }
17
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "name": "work",
3
+ "private": true,
4
+ "type": "module",
5
+ "imports": {
6
+ "#wb/*": [
7
+ "./src/wb-rules/*.js"
8
+ ],
9
+ "#wbm/*": [
10
+ "./src/wb-rules-modules/*.js"
11
+ ]
12
+ },
13
+ "scripts": {
14
+ "build:mono": "rollup -c node:@mirta/rollup/config",
15
+ "wb:deploy": "mirta deploy --profile=home-staging"
16
+ }
17
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "extends": "core",
3
+ "features": {
4
+ "global": {
5
+ "examples": "blocked"
6
+ }
7
+ },
8
+ "order": 2010
9
+ }