create-mirta 0.3.5 → 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.
- package/dist/classic.mjs +120 -0
- package/dist/index.mjs +800 -690
- package/dist/mono.mjs +208 -0
- package/dist/resolver.mjs +843 -0
- package/locales/en-US.json +109 -0
- package/locales/ru-RU.json +109 -0
- package/package.json +25 -22
- package/templates/classic/starter/content/package.json +11 -0
- package/{dist/templates/config/typescript → templates/classic/starter/content}/tsconfig.json +0 -5
- package/{dist/templates/eslint/eslint.config.mjs.ejs → templates/classic/starter/features/eslint/eslint.config.mjs.tt} +11 -6
- package/{dist/templates/base/_env → templates/classic/starter/features/examples/_.env} +1 -1
- package/templates/classic/starter/features/examples/src/wb-rules/01-counter.ts +12 -0
- package/templates/classic/starter/features/examples/src/wb-rules-modules/counter.ts +42 -0
- package/templates/classic/starter/features/examples-vitest/tests/wb-rules-modules/counter.test.ts +56 -0
- package/templates/classic/starter/features/vitest/package.json +10 -0
- package/templates/classic/starter/features/vitest-eslint/package.json +5 -0
- package/templates/classic/starter/template.json +10 -0
- package/{dist/templates/config/store → templates/classic/store/content}/package.json +1 -1
- package/templates/classic/store/features/examples/src/wb-rules/01-counter.ts +13 -0
- package/templates/classic/store/features/examples/src/wb-rules/02-counter.ts +19 -0
- package/templates/classic/store/features/examples/src/wb-rules-modules/counter-store.ts +33 -0
- package/templates/classic/store/features/examples/src/wb-rules-modules/counter.ts +44 -0
- package/templates/classic/store/features/examples-vitest/tests/wb-rules-modules/counter.test.ts +49 -0
- package/templates/classic/store/template.json +14 -0
- package/templates/mono/core/content/package.json +6 -0
- package/templates/mono/core/content/pnpm-workspace.yaml +3 -0
- package/templates/mono/core/content/sites/.gitkeep +0 -0
- package/templates/mono/core/content/tsconfig.json +31 -0
- package/templates/mono/core/features/eslint/eslint.config.mjs.tt +126 -0
- package/templates/mono/core/features/vitest/package.json +10 -0
- package/templates/mono/core/template.json +5 -0
- package/templates/mono/package/features/package/packages/{{package}}/package.json.tt +25 -0
- package/templates/mono/package/features/package/packages/{{package}}/src/.gitkeep +0 -0
- package/templates/mono/package/features/package/packages/{{package}}/tsconfig.build.json +10 -0
- package/templates/mono/package/features/package/sites/{{package}}-demo/package.json.tt +19 -0
- package/templates/mono/package/features/package/sites/{{package}}-demo/src/wb-rules/.gitkeep +0 -0
- package/templates/mono/package/features/package/sites/{{package}}-demo/src/wb-rules-modules/.gitkeep +0 -0
- package/templates/mono/package/features/package/sites/{{package}}-demo/tsconfig.build.json +10 -0
- package/templates/mono/package/features/package-examples/packages/{{package}}/src/index.ts +2 -0
- package/templates/mono/package/features/package-examples/packages/{{package}}/src/thermostat.ts +99 -0
- package/templates/mono/package/features/package-examples/packages/{{package}}/src/types.ts +25 -0
- package/templates/mono/package/features/package-examples/sites/{{package}}-demo/src/wb-rules/01-thermo.ts.tt +11 -0
- package/templates/mono/package/features/package-examples-vitest/packages/{{package}}/tests/mirta-thermostat.test.ts +72 -0
- package/templates/mono/package/features/package-github/packages/{{package}}/package.json.tt +11 -0
- package/templates/mono/package/template.json +16 -0
- package/templates/mono/sites/content/mirta.config.json +37 -0
- package/templates/mono/sites/content/sites/home/package.json +17 -0
- package/templates/mono/sites/content/sites/home/src/wb-rules/.gitkeep +0 -0
- package/templates/mono/sites/content/sites/home/src/wb-rules-modules/.gitkeep +0 -0
- package/templates/mono/sites/content/sites/home-staging/package.json +17 -0
- package/templates/mono/sites/content/sites/home-staging/src/wb-rules/.gitkeep +0 -0
- package/templates/mono/sites/content/sites/home-staging/src/wb-rules-modules/.gitkeep +0 -0
- package/templates/mono/sites/template.json +9 -0
- package/{dist/templates/base/_editorconfig → templates/shared/base/content/_.editorconfig} +1 -1
- package/{dist/templates/base/_gitignore → templates/shared/base/content/_.gitignore} +1 -3
- package/templates/shared/base/content/_.node-version +1 -0
- package/{dist/templates/base/.vscode → templates/shared/base/content/_.vscode}/settings.json +12 -1
- package/templates/shared/base/content/package.json +22 -0
- package/templates/shared/base/features/connection/_.env.local.tt +1 -0
- package/templates/shared/base/features/connection/mirta.config.json +6 -0
- package/templates/shared/base/features/eslint/package.json +9 -0
- package/templates/shared/base/features/examples/mirta.config.json.tt +51 -0
- package/templates/shared/base/features/github/_.github/workflows/build.yml.tt +56 -0
- package/templates/shared/base/features/github-vitest/_.github/workflows/test.yml +30 -0
- package/templates/shared/base/template.json +16 -0
- package/dist/locales/en-US.json +0 -85
- package/dist/locales/ru-RU.json +0 -86
- package/dist/templates/base/package.json +0 -27
- package/dist/templates/base/rollup.config.mjs +0 -15
- package/dist/templates/config/typescript/package.json +0 -8
- package/dist/templates/config/vitest/package.json +0 -10
- package/dist/templates/config/vitest/tests/setup/dotenv.ts +0 -5
- package/dist/templates/config/vitest/tests/setup/mirta.ts +0 -41
- package/dist/templates/config/vitest/tests/tsconfig.json +0 -9
- package/dist/templates/config/vitest/vitest.config.ts +0 -37
- package/dist/templates/example/base/src/wb-rules/00-dotenv.ts +0 -52
- package/dist/templates/example/base/src/wb-rules/01-count.ts +0 -6
- package/dist/templates/example/base/src/wb-rules-modules/counter.ts +0 -14
- package/dist/templates/example/store/src/wb-rules/01-count.ts +0 -10
- package/dist/templates/example/store/src/wb-rules-modules/counter-store.ts +0 -7
- package/dist/templates/example/store/src/wb-rules-modules/counter.ts +0 -20
- package/dist/templates/example/vitest/base/tests/wb-rules-modules/counter.test.ts +0 -10
- package/dist/templates/example/vitest/store/tests/wb-rules-modules/counter-store.test.ts +0 -13
- /package/{dist/assets → assets}/logo.art +0 -0
- /package/{dist/templates/base → templates/classic/starter/content}/src/wb-rules/.gitkeep +0 -0
- /package/{dist/templates/base → templates/classic/starter/content}/src/wb-rules-modules/.gitkeep +0 -0
- /package/{dist/templates/base → templates/classic/starter/content}/types/env.d.ts +0 -0
- /package/{dist/templates/config → templates/classic/starter/features}/vitest/tests/wb-rules-modules/.gitkeep +0 -0
- /package/{dist/templates/config → templates/classic/starter/features}/vitest/tsconfig.json +0 -0
- /package/{dist/templates/base/_gitattributes → templates/shared/base/content/_.gitattributes} +0 -0
- /package/{dist/templates/base/_npmrc → templates/shared/base/content/_.npmrc} +0 -0
- /package/{dist/templates/base/.vscode → templates/shared/base/content/_.vscode}/extensions.json +0 -0
- /package/{dist/templates/base/.vscode → templates/shared/base/content/_.vscode}/tasks.json +0 -0
- /package/{dist/templates/config/eslint/.vscode → templates/shared/base/features/eslint/_.vscode}/extensions.json +0 -0
- /package/{dist/templates/config/eslint/.vscode → templates/shared/base/features/eslint/_.vscode}/settings.json +0 -0
- /package/{dist/templates/config/vitest/.vscode → templates/shared/base/features/vitest/_.vscode}/extensions.json +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
24.12.0
|
package/{dist/templates/base/.vscode → templates/shared/base/content/_.vscode}/settings.json
RENAMED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"files.eol": "\n",
|
|
3
|
+
"files.associations": {
|
|
4
|
+
"mirta.config.json": "jsonc"
|
|
5
|
+
},
|
|
6
|
+
"json.schemas": [{
|
|
7
|
+
"fileMatch": ["mirta.config.json"],
|
|
8
|
+
"schema": {
|
|
9
|
+
"allowTrailingCommas": true
|
|
10
|
+
}
|
|
11
|
+
}],
|
|
3
12
|
"task.autoDetect": "off",
|
|
4
13
|
"todohighlight.keywords": [
|
|
5
14
|
{
|
|
@@ -37,5 +46,7 @@
|
|
|
37
46
|
"cursor": "pointer",
|
|
38
47
|
"fontWeight": "bold",
|
|
39
48
|
"borderRadius": "2px"
|
|
40
|
-
}
|
|
49
|
+
},
|
|
50
|
+
"npm.packageManager": "pnpm",
|
|
51
|
+
"npm.scriptRunner": "pnpm"
|
|
41
52
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"private": true,
|
|
3
|
+
"type": "module",
|
|
4
|
+
"scripts": {},
|
|
5
|
+
"dependencies": {
|
|
6
|
+
"@mirta/basics": "0.4.3",
|
|
7
|
+
"mirta": "0.4.3"
|
|
8
|
+
},
|
|
9
|
+
"devDependencies": {
|
|
10
|
+
"@mirta/cli": "0.4.3",
|
|
11
|
+
"@mirta/globals": "0.4.3",
|
|
12
|
+
"@mirta/rollup": "0.4.3",
|
|
13
|
+
"@mirta/tsconfig": "0.4.3",
|
|
14
|
+
"@types/node": "^24.10.1",
|
|
15
|
+
"cross-env": "^10.1.0",
|
|
16
|
+
"rollup": "^4.55.1",
|
|
17
|
+
"typescript": "^5.8.3"
|
|
18
|
+
},
|
|
19
|
+
"engines": {
|
|
20
|
+
"node": ">=24.12.0"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
WB_CONN_SECRET={{connectionString}}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"connections": {
|
|
3
|
+
"default": "{{defaultConnectionString}}"
|
|
4
|
+
},
|
|
5
|
+
"deploy": {
|
|
6
|
+
// Наборы правил копирования файлов: из папки проекта в папку контроллера.
|
|
7
|
+
"mappings": {
|
|
8
|
+
// Стандартный набор для wb-rules под Duktape на ES5.
|
|
9
|
+
"wb-rules-es5": [
|
|
10
|
+
// Копирование модулей.
|
|
11
|
+
{
|
|
12
|
+
"from": "dist/es5/wb-rules-modules/",
|
|
13
|
+
"to": "/mnt/data/etc/wb-rules-modules/",
|
|
14
|
+
|
|
15
|
+
// Очистить целевое расположение от других файлов.
|
|
16
|
+
"cleanup": true
|
|
17
|
+
},
|
|
18
|
+
// Копирование скриптов.
|
|
19
|
+
{
|
|
20
|
+
"from": "dist/es5/wb-rules/",
|
|
21
|
+
"to": "/mnt/data/etc/wb-rules/",
|
|
22
|
+
|
|
23
|
+
// Очистить целевое расположение от других файлов.
|
|
24
|
+
"cleanup": true,
|
|
25
|
+
|
|
26
|
+
// Предотвратить очистку для указанных файлов, они останутся.
|
|
27
|
+
// Можно использовать wildcard.
|
|
28
|
+
"protect": ["alarms.conf"]
|
|
29
|
+
}
|
|
30
|
+
],
|
|
31
|
+
// Расширенный набор: добавляем ещё и шаблоны устройств.
|
|
32
|
+
"templates": [
|
|
33
|
+
{
|
|
34
|
+
"from": "templates/",
|
|
35
|
+
"to": "/etc/wb-mqtt-serial.conf.d/templates/",
|
|
36
|
+
|
|
37
|
+
// Существующие шаблоны не удаляем.
|
|
38
|
+
"cleanup": false
|
|
39
|
+
}
|
|
40
|
+
]
|
|
41
|
+
},
|
|
42
|
+
// Профили деплоя.
|
|
43
|
+
"profiles": {
|
|
44
|
+
// Встроенный профиль (здесь переопределён явно)
|
|
45
|
+
"default": {
|
|
46
|
+
"connection": "default",
|
|
47
|
+
"mappings": ["wb-rules-es5"]
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
name: Build
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- {{githubBranch}}
|
|
7
|
+
pull_request:
|
|
8
|
+
branches:
|
|
9
|
+
- {{githubBranch}}
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
{{#if features.vitest}}
|
|
13
|
+
test:
|
|
14
|
+
if: ${{ !startsWith(github.event.head_commit.message, 'release') }}
|
|
15
|
+
uses: ./.github/workflows/test.yml
|
|
16
|
+
{{/if features.vitest}}
|
|
17
|
+
build:
|
|
18
|
+
# Prevents this action from running on forks.
|
|
19
|
+
if: github.repository == '{{githubOwner}}/{{githubRepository}}'
|
|
20
|
+
{{#if features.vitest}}
|
|
21
|
+
needs: test
|
|
22
|
+
{{/if features.vitest}}
|
|
23
|
+
runs-on: ubuntu-latest
|
|
24
|
+
timeout-minutes: 5
|
|
25
|
+
steps:
|
|
26
|
+
- name: Checkout
|
|
27
|
+
uses: actions/checkout@v6
|
|
28
|
+
|
|
29
|
+
- name: Install pnpm
|
|
30
|
+
uses: pnpm/action-setup@v4
|
|
31
|
+
|
|
32
|
+
- name: Install Node.js
|
|
33
|
+
uses: actions/setup-node@v6
|
|
34
|
+
with:
|
|
35
|
+
node-version-file: '.node-version'
|
|
36
|
+
cache: 'pnpm'
|
|
37
|
+
|
|
38
|
+
- name: Install Dependencies
|
|
39
|
+
run: pnpm install
|
|
40
|
+
|
|
41
|
+
- name: Build
|
|
42
|
+
run: pnpm build
|
|
43
|
+
{{#if templates.packages}}
|
|
44
|
+
- name: Continuous Release
|
|
45
|
+
# Prevents this step from running on pull requests.
|
|
46
|
+
# Runs only when commit message starts with 'fix' or 'feat'.
|
|
47
|
+
if: |
|
|
48
|
+
github.event_name == 'push' && (
|
|
49
|
+
startsWith(github.event.head_commit.message, 'fix') ||
|
|
50
|
+
startsWith(github.event.head_commit.message, 'feat')
|
|
51
|
+
)
|
|
52
|
+
# NOTE: --compact is temporarily removed
|
|
53
|
+
# because some packages in ./packages/* are not yet published to npm.
|
|
54
|
+
# It will be re-enabled once all packages are published or we add filtering.
|
|
55
|
+
run: pnpx pkg-pr-new publish --pnpm './packages/*' --template './sites/*'
|
|
56
|
+
{{/if templates.packages}}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
name: Test
|
|
2
|
+
|
|
3
|
+
on: workflow_call
|
|
4
|
+
|
|
5
|
+
permissions:
|
|
6
|
+
contents: read # To fetch code (actions/checkout)
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
test:
|
|
10
|
+
name: Run Tests
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
timeout-minutes: 5
|
|
13
|
+
steps:
|
|
14
|
+
- name: Checkout
|
|
15
|
+
uses: actions/checkout@v6
|
|
16
|
+
|
|
17
|
+
- name: Install pnpm
|
|
18
|
+
uses: pnpm/action-setup@v4
|
|
19
|
+
|
|
20
|
+
- name: Install Node.js
|
|
21
|
+
uses: actions/setup-node@v6
|
|
22
|
+
with:
|
|
23
|
+
node-version-file: '.node-version'
|
|
24
|
+
cache: 'pnpm'
|
|
25
|
+
|
|
26
|
+
- name: Install dependencies
|
|
27
|
+
run: pnpm install
|
|
28
|
+
|
|
29
|
+
- name: Run tests
|
|
30
|
+
run: pnpm run test
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"hidden": true,
|
|
3
|
+
"features": {
|
|
4
|
+
"global": {
|
|
5
|
+
"examples": "recommended",
|
|
6
|
+
"connection": "recommended",
|
|
7
|
+
"eslint": "recommended",
|
|
8
|
+
"vitest": "optional",
|
|
9
|
+
"github": "optional"
|
|
10
|
+
},
|
|
11
|
+
"compound": [
|
|
12
|
+
"github-vitest"
|
|
13
|
+
]
|
|
14
|
+
},
|
|
15
|
+
"order": 0
|
|
16
|
+
}
|
package/dist/locales/en-US.json
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"title": "The Framework to write wb-rules in TypeScript",
|
|
3
|
-
"captions": {
|
|
4
|
-
"intro": "Project Settings",
|
|
5
|
-
"deploy": "Deploy Settings"
|
|
6
|
-
},
|
|
7
|
-
"projectName": {
|
|
8
|
-
"message": "Project Name (target directory):"
|
|
9
|
-
},
|
|
10
|
-
"packageName": {
|
|
11
|
-
"message": "Package name:",
|
|
12
|
-
"errorMessage": "Format is not valid"
|
|
13
|
-
},
|
|
14
|
-
"shouldOverwrite": {
|
|
15
|
-
"directory": {
|
|
16
|
-
"current": "Current directory",
|
|
17
|
-
"target": "Target directory"
|
|
18
|
-
},
|
|
19
|
-
"message": "is not empty.",
|
|
20
|
-
"confirmDelete": "Remove existing files before continue?"
|
|
21
|
-
},
|
|
22
|
-
"ssh": {
|
|
23
|
-
"username": "🔑 SSH Username:",
|
|
24
|
-
"host": "🌐 SSH Host:",
|
|
25
|
-
"port": "🚩 SSH Port:",
|
|
26
|
-
"useRutoken": "Use Rutoken ECP"
|
|
27
|
-
},
|
|
28
|
-
"featureSelection": {
|
|
29
|
-
"message": "Select features to include in your project:",
|
|
30
|
-
"hint": "↑/↓ to navigate, space to select, A to toggle all, Enter to confirm"
|
|
31
|
-
},
|
|
32
|
-
"addEslint": {
|
|
33
|
-
"message": "ESLint",
|
|
34
|
-
"hint": "error prevention"
|
|
35
|
-
},
|
|
36
|
-
"addVitest": {
|
|
37
|
-
"message": "Mirta Testing",
|
|
38
|
-
"hint": "Vitest, unit-testing and simulations"
|
|
39
|
-
},
|
|
40
|
-
"addStore": {
|
|
41
|
-
"message": "Mirta Store",
|
|
42
|
-
"hint": "state management"
|
|
43
|
-
},
|
|
44
|
-
"validation": {
|
|
45
|
-
"required": "Must be provided"
|
|
46
|
-
},
|
|
47
|
-
"status": {
|
|
48
|
-
"success": "Success",
|
|
49
|
-
"error": "Error",
|
|
50
|
-
"canceled": "Canceled",
|
|
51
|
-
"scaffolding": "Scaffolding project in",
|
|
52
|
-
"scaffolded": "The project has been scaffolded",
|
|
53
|
-
"installingDependencies": "Calling the package manager"
|
|
54
|
-
},
|
|
55
|
-
"accent": {
|
|
56
|
-
"recommended": "(recommended)",
|
|
57
|
-
"ifConfigured": "(if configured)"
|
|
58
|
-
},
|
|
59
|
-
"dependencies": {
|
|
60
|
-
"question": "Install project dependencies?",
|
|
61
|
-
"current": {
|
|
62
|
-
"message": "Yes, use"
|
|
63
|
-
},
|
|
64
|
-
"pnpm": {
|
|
65
|
-
"message": "Yes, use PNPM",
|
|
66
|
-
"hint": "recommended"
|
|
67
|
-
},
|
|
68
|
-
"yarn": {
|
|
69
|
-
"message": "Yes, use Yarn"
|
|
70
|
-
},
|
|
71
|
-
"npm": {
|
|
72
|
-
"message": "Yes, use NPM"
|
|
73
|
-
},
|
|
74
|
-
"bun": {
|
|
75
|
-
"message": "Yes, use Bun"
|
|
76
|
-
},
|
|
77
|
-
"no": {
|
|
78
|
-
"message": "No, I will handle that myself"
|
|
79
|
-
}
|
|
80
|
-
},
|
|
81
|
-
"errors": {
|
|
82
|
-
"operationCanceled": "Operation canceled",
|
|
83
|
-
"rootIsNotRelative": "Location is out of working directory"
|
|
84
|
-
}
|
|
85
|
-
}
|
package/dist/locales/ru-RU.json
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"title": "Фреймворк для создания правил wb-rules на TypeScript",
|
|
3
|
-
"captions": {
|
|
4
|
-
"intro": "Параметры проекта",
|
|
5
|
-
"deploy": "Параметры деплоя на контроллер"
|
|
6
|
-
},
|
|
7
|
-
"projectName": {
|
|
8
|
-
"message": "Название (целевая директория):",
|
|
9
|
-
"errorMessage": "Требуется указать значение"
|
|
10
|
-
},
|
|
11
|
-
"packageName": {
|
|
12
|
-
"message": "Название пакета:",
|
|
13
|
-
"errorMessage": "Недопустимый формат ввода"
|
|
14
|
-
},
|
|
15
|
-
"shouldOverwrite": {
|
|
16
|
-
"directory": {
|
|
17
|
-
"current": "Текущая директория",
|
|
18
|
-
"target": "Указанная директория"
|
|
19
|
-
},
|
|
20
|
-
"message": "содержит файлы.",
|
|
21
|
-
"confirmDelete": "Удалить их?"
|
|
22
|
-
},
|
|
23
|
-
"ssh": {
|
|
24
|
-
"username": "🔑 Пользователь SSH:",
|
|
25
|
-
"host": "🌐 Хост SSH:",
|
|
26
|
-
"port": "🚩 Порт SSH:",
|
|
27
|
-
"useRutoken": "Использовать Рутокен ЭЦП?"
|
|
28
|
-
},
|
|
29
|
-
"featureSelection": {
|
|
30
|
-
"message": "Выберите добавляемый функционал:",
|
|
31
|
-
"hint": "↑/↓ для навигации, пробел для выбора, A - выбрать всё, Enter - подтвердить"
|
|
32
|
-
},
|
|
33
|
-
"addEslint": {
|
|
34
|
-
"message": "ESLint",
|
|
35
|
-
"hint": "предотвращение потенциальных проблем в коде"
|
|
36
|
-
},
|
|
37
|
-
"addVitest": {
|
|
38
|
-
"message": "Mirta Testing",
|
|
39
|
-
"hint": "Юнит-тесты и имитатор запуска на контроллере"
|
|
40
|
-
},
|
|
41
|
-
"addStore": {
|
|
42
|
-
"message": "Mirta Store",
|
|
43
|
-
"hint": "хранилище состояний"
|
|
44
|
-
},
|
|
45
|
-
"validation": {
|
|
46
|
-
"required": "Требуется указать значение"
|
|
47
|
-
},
|
|
48
|
-
"status": {
|
|
49
|
-
"success": "Успешно",
|
|
50
|
-
"error": "Ошибка",
|
|
51
|
-
"canceled": "Отменено",
|
|
52
|
-
"scaffolding": "Генерация файлов проекта в",
|
|
53
|
-
"scaffolded": "Проект создан",
|
|
54
|
-
"installingDependencies": "Вызов менеджера пакетов"
|
|
55
|
-
},
|
|
56
|
-
"accent": {
|
|
57
|
-
"recommended": "(рекомендуется)",
|
|
58
|
-
"ifConfigured": "(если настроен)"
|
|
59
|
-
},
|
|
60
|
-
"dependencies": {
|
|
61
|
-
"question": "Установить требуемые зависимости?",
|
|
62
|
-
"current": {
|
|
63
|
-
"message": "Да, используя"
|
|
64
|
-
},
|
|
65
|
-
"pnpm": {
|
|
66
|
-
"message": "Да, используя pnpm",
|
|
67
|
-
"hint": "рекомендуется"
|
|
68
|
-
},
|
|
69
|
-
"yarn": {
|
|
70
|
-
"message": "Да, используя yarn"
|
|
71
|
-
},
|
|
72
|
-
"npm": {
|
|
73
|
-
"message": "Да, используя npm"
|
|
74
|
-
},
|
|
75
|
-
"bun": {
|
|
76
|
-
"message": "Да, используя bun"
|
|
77
|
-
},
|
|
78
|
-
"no": {
|
|
79
|
-
"message": "Нет, разберусь с этим самостоятельно"
|
|
80
|
-
}
|
|
81
|
-
},
|
|
82
|
-
"errors": {
|
|
83
|
-
"operationCanceled": "Операция прервана",
|
|
84
|
-
"rootIsNotRelative": "Расположение находится вне рабочей директории"
|
|
85
|
-
}
|
|
86
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"private": true,
|
|
3
|
-
"engines": {
|
|
4
|
-
"node": ">=20.6.0"
|
|
5
|
-
},
|
|
6
|
-
"type": "module",
|
|
7
|
-
"imports": {
|
|
8
|
-
"#wb/*": [
|
|
9
|
-
"./src/wb-rules/*.js"
|
|
10
|
-
],
|
|
11
|
-
"#wbm/*": [
|
|
12
|
-
"./src/wb-rules-modules/*.js"
|
|
13
|
-
]
|
|
14
|
-
},
|
|
15
|
-
"scripts": {
|
|
16
|
-
"build": "cross-env NODE_ENV=production rollup -c",
|
|
17
|
-
"build:dev": "cross-env NODE_ENV=development rollup -c"
|
|
18
|
-
},
|
|
19
|
-
"dependencies": {
|
|
20
|
-
"mirta": "0.3.5"
|
|
21
|
-
},
|
|
22
|
-
"devDependencies": {
|
|
23
|
-
"@mirta/rollup": "0.3.5",
|
|
24
|
-
"cross-env": "^10.1.0",
|
|
25
|
-
"rollup": "^4.52.4"
|
|
26
|
-
}
|
|
27
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from '@mirta/rollup'
|
|
2
|
-
|
|
3
|
-
export default defineConfig({
|
|
4
|
-
dotenv: {
|
|
5
|
-
/**
|
|
6
|
-
* При использовании префикса, переменные
|
|
7
|
-
* окружения будут отфильтрованы по нему.
|
|
8
|
-
*
|
|
9
|
-
* Например, префиксу APP_ соответствует
|
|
10
|
-
* переменная окружения APP_NAME.
|
|
11
|
-
*
|
|
12
|
-
**/
|
|
13
|
-
prefix: '^APP_',
|
|
14
|
-
},
|
|
15
|
-
})
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { vi } from 'vitest'
|
|
2
|
-
import { mock } from 'vitest-mock-extended'
|
|
3
|
-
|
|
4
|
-
// Базовая (подавляющая) имитация API движка wb-rules.
|
|
5
|
-
// Для каждого файла с тестами этот код выполняется заново.
|
|
6
|
-
//
|
|
7
|
-
// Используется с целью перехвата и подавления обращений
|
|
8
|
-
// к отсутствующим на компьютере функциям контроллера.
|
|
9
|
-
//
|
|
10
|
-
// В файлах тестов можно переопределить поведение подавления
|
|
11
|
-
// на выдачу заготовленного ответа. Пригодится для симуляции
|
|
12
|
-
// внештатных ситуаций и оценки работы алгоритма
|
|
13
|
-
// в этих условиях.
|
|
14
|
-
|
|
15
|
-
const createLogger = () => {
|
|
16
|
-
|
|
17
|
-
const logger = vi.fn() as unknown as WbRules.Log
|
|
18
|
-
|
|
19
|
-
logger.info = vi.fn()
|
|
20
|
-
logger.debug = vi.fn()
|
|
21
|
-
logger.warning = vi.fn()
|
|
22
|
-
logger.error = vi.fn()
|
|
23
|
-
|
|
24
|
-
return logger
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
global.module = mock<NodeJS.Module>()
|
|
29
|
-
|
|
30
|
-
global.log = createLogger()
|
|
31
|
-
global.debug = vi.fn() as WbRules.Debug
|
|
32
|
-
global.dev = mock<WbRules.Dev>()
|
|
33
|
-
global.defineVirtualDevice = vi.fn()
|
|
34
|
-
global.getDevice = vi.fn(() => mock<WbRules.Device>({
|
|
35
|
-
getControl: () => mock<WbRules.Control>(),
|
|
36
|
-
}))
|
|
37
|
-
global.getControl = vi.fn()
|
|
38
|
-
global.trackMqtt = vi.fn()
|
|
39
|
-
global.defineRule = vi.fn()
|
|
40
|
-
global.Notify = mock<WbRules.Notify>()
|
|
41
|
-
global.Alarms = mock<WbRules.Alarms>()
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from 'vitest/config'
|
|
2
|
-
import { fileURLToPath } from 'node:url'
|
|
3
|
-
|
|
4
|
-
export default defineConfig({
|
|
5
|
-
define: {
|
|
6
|
-
__DEV__: true,
|
|
7
|
-
__TEST__: true,
|
|
8
|
-
},
|
|
9
|
-
resolve: {
|
|
10
|
-
alias: [
|
|
11
|
-
{
|
|
12
|
-
find: /^@wb\/(.*?)$/,
|
|
13
|
-
replacement: fileURLToPath(
|
|
14
|
-
new URL('./src/wb-rules/$1', import.meta.url)
|
|
15
|
-
),
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
find: /^@wbm\/(.*?)$/,
|
|
19
|
-
replacement: fileURLToPath(
|
|
20
|
-
new URL('./src/wb-rules-modules/$1', import.meta.url)
|
|
21
|
-
),
|
|
22
|
-
},
|
|
23
|
-
],
|
|
24
|
-
},
|
|
25
|
-
test: {
|
|
26
|
-
globals: true,
|
|
27
|
-
include: ['tests/**/*.{test,spec}.[jt]s'],
|
|
28
|
-
setupFiles: [
|
|
29
|
-
fileURLToPath(
|
|
30
|
-
new URL('./tests/setup/dotenv.ts', import.meta.url)
|
|
31
|
-
),
|
|
32
|
-
fileURLToPath(
|
|
33
|
-
new URL('./tests/setup/mirta.ts', import.meta.url)
|
|
34
|
-
),
|
|
35
|
-
],
|
|
36
|
-
},
|
|
37
|
-
})
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file Пример использования переменных окружения.
|
|
3
|
-
*
|
|
4
|
-
* Для типизации используется файл `types/env.d.ts`
|
|
5
|
-
*
|
|
6
|
-
* Значение каждой переменной определяется в специальных
|
|
7
|
-
* файлах формата `.env`. Эти файлы хранятся отдельно от
|
|
8
|
-
* основного исходного кода, что предотвращает случайную
|
|
9
|
-
* утечку секретных данных в публичные репозитории.
|
|
10
|
-
*
|
|
11
|
-
* Основные файлы конфигурации включают:
|
|
12
|
-
* .env
|
|
13
|
-
* .env.local
|
|
14
|
-
* .env.[mode].local
|
|
15
|
-
*
|
|
16
|
-
* Значение [mode] принимает `development`, `test` или `production`.
|
|
17
|
-
*
|
|
18
|
-
* Команда build:dev первым делом заглядывает
|
|
19
|
-
* в файл `.env.development.local`
|
|
20
|
-
*
|
|
21
|
-
* Команда build обращается к значениям
|
|
22
|
-
* в файле `.env.production.local`
|
|
23
|
-
*
|
|
24
|
-
* Юнит-тесты используют `.env.test.local`
|
|
25
|
-
*
|
|
26
|
-
* Если в обозначенных местах не обнаружилось искомых ключевых пар,
|
|
27
|
-
* поиск выполняется поочерёдно в файлах `.env.local` и `.env`
|
|
28
|
-
*
|
|
29
|
-
* Примечание: переменные окружения
|
|
30
|
-
* допускается передавать через командную строку - обратите
|
|
31
|
-
* внимание на использование cross-env в package.json
|
|
32
|
-
*
|
|
33
|
-
* @since 0.2.1
|
|
34
|
-
*
|
|
35
|
-
**/
|
|
36
|
-
|
|
37
|
-
// Условие выполнится только при сборке
|
|
38
|
-
// командой `build:dev` (в режиме development).
|
|
39
|
-
//
|
|
40
|
-
// Если собрать проект
|
|
41
|
-
// командой `build` (в режиме production),
|
|
42
|
-
// код этого блока не попадёт на контроллер.
|
|
43
|
-
//
|
|
44
|
-
// Более того, поскольку других конструкций в скрипте нет,
|
|
45
|
-
// то и сам скрипт не появится в каталоге dist.
|
|
46
|
-
//
|
|
47
|
-
if (__DEV__) {
|
|
48
|
-
|
|
49
|
-
// Выводим приветствие, подставляя название из переменной окружения.
|
|
50
|
-
log(`Hello from ${process.env.APP_NAME}`)
|
|
51
|
-
|
|
52
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { useCounter } from '#wbm/counter'
|
|
2
|
-
import { useCounterStore } from '#wbm/counter-store'
|
|
3
|
-
|
|
4
|
-
const counter = useCounter()
|
|
5
|
-
|
|
6
|
-
counter.increment()
|
|
7
|
-
log(`Current Value: ${counter.count}`)
|
|
8
|
-
|
|
9
|
-
const counterStore = useCounterStore()
|
|
10
|
-
log(`Current Store Value: ${counterStore.count}`)
|