@uns-kit/cli 2.0.23 → 2.0.25
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/LICENSE +21 -21
- package/README.md +175 -175
- package/dist/index.js +37 -0
- package/package.json +6 -6
- package/templates/api/src/examples/api-example.ts +91 -91
- package/templates/azure-pipelines.yml +21 -21
- package/templates/codegen/codegen.ts +15 -15
- package/templates/codegen/src/uns/uns-tags.ts +1 -1
- package/templates/codegen/src/uns/uns-topics.ts +1 -1
- package/templates/config-files/config-docker.json +26 -26
- package/templates/config-files/config-localhost.json +26 -26
- package/templates/cron/AGENTS.md +24 -23
- package/templates/cron/src/examples/cron-example.ts +71 -71
- package/templates/default/.prettierignore +1 -1
- package/templates/default/.prettierrc +7 -7
- package/templates/default/AGENTS.md +24 -23
- package/templates/default/README.md +43 -41
- package/templates/default/config.json +27 -27
- package/templates/default/eslint.config.js +30 -30
- package/templates/default/gitignore +51 -51
- package/templates/default/package.json +49 -46
- package/templates/default/src/config/project.config.extension.example +23 -23
- package/templates/default/src/config/project.config.extension.ts +6 -6
- package/templates/default/src/examples/data-example.ts +86 -86
- package/templates/default/src/examples/load-test-data.ts +110 -110
- package/templates/default/src/examples/table-example.ts +97 -97
- package/templates/default/src/examples/table-window-load-test.ts +446 -446
- package/templates/default/src/examples/uns-gateway-cli.ts +10 -10
- package/templates/default/src/index.ts +15 -15
- package/templates/default/src/uns/uns-assets.ts +12 -12
- package/templates/default/src/uns/uns-dictionary.generated.ts +758 -758
- package/templates/default/src/uns/uns-measurements.generated.ts +366 -366
- package/templates/default/src/uns/uns-tags.ts +2 -2
- package/templates/default/src/uns/uns-topics.ts +2 -2
- package/templates/default/tsconfig.json +29 -29
- package/templates/python/app/README.md +8 -8
- package/templates/python/examples/README.md +134 -134
- package/templates/python/examples/api_handler.py +28 -28
- package/templates/python/examples/data_publish.py +11 -11
- package/templates/python/examples/data_subscribe.py +8 -8
- package/templates/python/examples/data_transformer.py +17 -17
- package/templates/python/examples/table_transformer.py +15 -15
- package/templates/python/gateway/cli.py +75 -75
- package/templates/python/gateway/client.py +155 -155
- package/templates/python/gateway/manager.py +97 -97
- package/templates/python/gitignore +47 -47
- package/templates/python/proto/uns-gateway.proto +102 -102
- package/templates/python/pyproject.toml +4 -4
- package/templates/python/runtime.json +4 -4
- package/templates/python/scripts/setup.sh +87 -87
- package/templates/temporal/src/examples/temporal-example.ts +37 -37
- package/templates/uns-dictionary/uns-dictionary.json +650 -650
- package/templates/uns-measurements/uns-measurements.json +360 -360
- package/templates/vscode/.vscode/launch.json +164 -164
- package/templates/vscode/.vscode/settings.json +9 -9
- package/templates/vscode/.vscode/tasks.json +27 -27
- package/templates/vscode/uns-kit.code-workspace +13 -13
- package/templates/python/gen/__init__.py +0 -1
- package/templates/python/gen/uns_gateway_pb2.py +0 -70
- package/templates/python/gen/uns_gateway_pb2_grpc.py +0 -312
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2023 Aljoša Vister
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Aljoša Vister
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,175 +1,175 @@
|
|
|
1
|
-
# @uns-kit/cli
|
|
2
|
-
|
|
3
|
-
Command line scaffolding tool for the UNS toolkit. It bootstraps a new project with `@uns-kit/core` preconfigured and ready to extend with additional plugins.
|
|
4
|
-
|
|
5
|
-
Note: Apps built with uns-kit are intended to be managed by the **UNS Datahub controller**.
|
|
6
|
-
|
|
7
|
-
## uns-kit in context
|
|
8
|
-
|
|
9
|
-
uns-kit is a batteries-included toolkit for Unified Namespace applications. It standardizes MQTT wiring, auth, config schemas, and scaffolding so you can focus on your domain logic. The toolkit packages are:
|
|
10
|
-
|
|
11
|
-
| Package | Description |
|
|
12
|
-
| --- | --- |
|
|
13
|
-
| [`@uns-kit/core`](https://github.com/uns-datahub/uns-kit/tree/main/packages/uns-core) | Base runtime utilities (UnsProxyProcess, MQTT helpers, configuration tooling, gRPC gateway support). |
|
|
14
|
-
| [`@uns-kit/api`](https://github.com/uns-datahub/uns-kit/tree/main/packages/uns-api) | Express plugin that exposes HTTP endpoints, handles JWT/JWKS auth, and republishes API metadata to UNS. |
|
|
15
|
-
| [`@uns-kit/cron`](https://github.com/uns-datahub/uns-kit/tree/main/packages/uns-cron) | Cron-driven scheduler that emits UNS events on a fixed cadence. |
|
|
16
|
-
| [`@uns-kit/temporal`](https://github.com/uns-datahub/uns-kit/tree/main/packages/uns-temporal) | Temporal.io integration that wires workflows into UnsProxyProcess. |
|
|
17
|
-
| [`@uns-kit/cli`](https://github.com/uns-datahub/uns-kit/tree/main/packages/uns-cli) | Command line tool for scaffolding new UNS applications. |
|
|
18
|
-
|
|
19
|
-
## Prerequisites
|
|
20
|
-
|
|
21
|
-
- Node.js 18 or newer (ES2022 runtime features)
|
|
22
|
-
- A package manager such as `pnpm`, `npm`, or `yarn`
|
|
23
|
-
- `git` available on PATH (required for `configure-devops`, used to initialize new projects automatically)
|
|
24
|
-
|
|
25
|
-
## Usage
|
|
26
|
-
|
|
27
|
-
```bash
|
|
28
|
-
pnpm --package=@uns-kit/cli dlx uns-kit create my-uns-app
|
|
29
|
-
# or with npx
|
|
30
|
-
npx @uns-kit/cli create my-uns-app
|
|
31
|
-
# or after installing globally
|
|
32
|
-
npm install -g @uns-kit/cli
|
|
33
|
-
uns-kit create my-uns-app
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
The command creates a new directory, copies the starter template, and pins `@uns-kit/core` to the currently published version. After the scaffold finishes:
|
|
37
|
-
|
|
38
|
-
```bash
|
|
39
|
-
cd my-uns-app
|
|
40
|
-
pnpm install
|
|
41
|
-
pnpm run dev
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
When `git` is available on your PATH the scaffold also initializes a fresh repository so you can commit immediately.
|
|
45
|
-
|
|
46
|
-
### Create from a service bundle
|
|
47
|
-
|
|
48
|
-
```bash
|
|
49
|
-
uns-kit create --bundle ./service.bundle.json
|
|
50
|
-
uns-kit create --bundle ./service.bundle.json --dest ./my-dir
|
|
51
|
-
uns-kit create --bundle ./service.bundle.json --dest . --allow-existing
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
Bundle-driven create uses `service.bundle.json` as the source of truth. The CLI:
|
|
55
|
-
|
|
56
|
-
- scaffolds the base TypeScript app from the existing default template
|
|
57
|
-
- copies the original bundle into the project root as `service.bundle.json`
|
|
58
|
-
- generates `SERVICE_SPEC.md` and `AGENTS.md`
|
|
59
|
-
- applies supported bundle features such as `vscode` and `devops`
|
|
60
|
-
|
|
61
|
-
When `--bundle` is used, the default destination is `./<metadata.name>`. The TypeScript CLI only accepts bundles with `scaffold.stack = "ts"` and currently supports `scaffold.template = "default"` for this MVP. If the bundle targets Python instead, use `uns-kit-py create --bundle ...`.
|
|
62
|
-
|
|
63
|
-
## Commands
|
|
64
|
-
|
|
65
|
-
- `uns-kit create <name>` – create a new UNS project in the specified directory.
|
|
66
|
-
- `uns-kit create --bundle <path> [--dest <dir>] [--allow-existing]` – create a new TypeScript UNS project from `service.bundle.json`.
|
|
67
|
-
- `uns-kit configure [path] [features...]` – run multiple configure templates in sequence (`--all`, `--overwrite`).
|
|
68
|
-
- `uns-kit configure-templates [path] [templates...]` – copy any template directory (`--all`, `--overwrite`).
|
|
69
|
-
- `uns-kit configure-devops [path]` – add Azure DevOps tooling (dependencies, script, config) to an existing project.
|
|
70
|
-
- `uns-kit configure-vscode [path]` – copy VS Code launch/workspace files into an existing project.
|
|
71
|
-
- `uns-kit configure-codegen [path]` – scaffold GraphQL code generation and UNS refresh scripts.
|
|
72
|
-
- `uns-kit configure-api [path]` – copy UNS API examples and add `@uns-kit/api`.
|
|
73
|
-
- `uns-kit configure-cron [path]` – copy UNS cron examples and add `@uns-kit/cron`.
|
|
74
|
-
- `uns-kit configure-temporal [path]` – copy UNS Temporal examples and add `@uns-kit/temporal`.
|
|
75
|
-
- `uns-kit configure-python [path]` – copy Python gateway client scaffolding (no npm dependency required).
|
|
76
|
-
- `uns-kit help` – display usage information.
|
|
77
|
-
|
|
78
|
-
### Configure multiple features at once
|
|
79
|
-
|
|
80
|
-
Chain several add-ons without running each subcommand manually:
|
|
81
|
-
|
|
82
|
-
```bash
|
|
83
|
-
uns-kit configure --all
|
|
84
|
-
uns-kit configure ./apps/gateway devops vscode codegen
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
Mix and match feature names after an optional target directory. Use `--all` to apply every available template in one shot. Add `--overwrite` to refresh files from newer template versions.
|
|
88
|
-
|
|
89
|
-
### Copy arbitrary templates
|
|
90
|
-
|
|
91
|
-
Need a template that is not wired into a configure feature (or added in a newer release)? Use:
|
|
92
|
-
|
|
93
|
-
```bash
|
|
94
|
-
uns-kit configure-templates --all
|
|
95
|
-
uns-kit configure-templates ./apps/gateway uns-dictionary uns-measurements --overwrite
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
### Configure Azure DevOps
|
|
99
|
-
|
|
100
|
-
Run inside a scaffolded project to add the Azure DevOps pull-request tooling:
|
|
101
|
-
|
|
102
|
-
```bash
|
|
103
|
-
uns-kit configure-devops
|
|
104
|
-
pnpm install
|
|
105
|
-
pnpm run pull-request
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
The command prompts for your Azure DevOps organization/project, ensures the remote repository exists, and updates `config.json` along with the necessary dev dependencies.
|
|
109
|
-
|
|
110
|
-
### Configure VS Code workspace
|
|
111
|
-
|
|
112
|
-
```bash
|
|
113
|
-
uns-kit configure-vscode
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
Copies `.vscode/launch.json` plus a baseline workspace file into the project. Existing files are skipped unless you pass `--overwrite`.
|
|
117
|
-
|
|
118
|
-
### Configure GraphQL code generation
|
|
119
|
-
|
|
120
|
-
```bash
|
|
121
|
-
uns-kit configure-codegen
|
|
122
|
-
pnpm install
|
|
123
|
-
pnpm run codegen
|
|
124
|
-
pnpm run refresh-uns
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
Adds `codegen.ts`, seeds `src/uns/` placeholder types, and wires the GraphQL Code Generator / `refresh-uns` script into `package.json`. After installing the new dev dependencies you can regenerate strongly-typed operations (`pnpm run codegen`) and rebuild UNS topics/tags from your environment (`pnpm run refresh-uns`).
|
|
128
|
-
After installing the new dev dependencies you can regenerate strongly-typed operations (`pnpm run codegen`) and rebuild UNS metadata (topics/tags/assets) from your environment (`pnpm run generate-uns-metadata`).
|
|
129
|
-
|
|
130
|
-
### Add UNS API scaffolding
|
|
131
|
-
|
|
132
|
-
```bash
|
|
133
|
-
uns-kit configure-api
|
|
134
|
-
pnpm install
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
Copies API-oriented examples (under `src/examples/`) and adds `@uns-kit/api` to your project dependencies.
|
|
138
|
-
Use `--overwrite` to refresh the examples after updating `uns-kit`.
|
|
139
|
-
|
|
140
|
-
### Add cron-based scaffolding
|
|
141
|
-
|
|
142
|
-
```bash
|
|
143
|
-
uns-kit configure-cron
|
|
144
|
-
pnpm install
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
Adds cron-oriented example stubs and installs `@uns-kit/cron`.
|
|
148
|
-
Use `--overwrite` to refresh the examples after updating `uns-kit`.
|
|
149
|
-
|
|
150
|
-
### Add Temporal scaffolding
|
|
151
|
-
|
|
152
|
-
```bash
|
|
153
|
-
uns-kit configure-temporal
|
|
154
|
-
pnpm install
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
Copies Temporal example placeholders and installs `@uns-kit/temporal`.
|
|
158
|
-
Use `--overwrite` to refresh the examples after updating `uns-kit`.
|
|
159
|
-
|
|
160
|
-
### Add Python gateway scaffolding
|
|
161
|
-
|
|
162
|
-
```bash
|
|
163
|
-
uns-kit configure-python
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
Copies the Python gateway client template (examples, scripts, requirements, proto) into your project so you can iterate on the gRPC gateway from Python alongside your TypeScript project.
|
|
167
|
-
Use `--overwrite` to refresh the examples after updating `uns-kit`.
|
|
168
|
-
|
|
169
|
-
### Extend the Config Schema
|
|
170
|
-
|
|
171
|
-
Edit `src/config/project.config.extension.ts` inside your generated project and run `pnpm run generate-config-schema`. This regenerates `config.schema.json` and `src/config/app-config.ts`, augmenting `@uns-kit/core`'s `AppConfig` so editors and runtime types stay in sync. If completions lag, reload the TypeScript server in your editor.
|
|
172
|
-
|
|
173
|
-
## License
|
|
174
|
-
|
|
175
|
-
MIT © Aljoša Vister
|
|
1
|
+
# @uns-kit/cli
|
|
2
|
+
|
|
3
|
+
Command line scaffolding tool for the UNS toolkit. It bootstraps a new project with `@uns-kit/core` preconfigured and ready to extend with additional plugins.
|
|
4
|
+
|
|
5
|
+
Note: Apps built with uns-kit are intended to be managed by the **UNS Datahub controller**.
|
|
6
|
+
|
|
7
|
+
## uns-kit in context
|
|
8
|
+
|
|
9
|
+
uns-kit is a batteries-included toolkit for Unified Namespace applications. It standardizes MQTT wiring, auth, config schemas, and scaffolding so you can focus on your domain logic. The toolkit packages are:
|
|
10
|
+
|
|
11
|
+
| Package | Description |
|
|
12
|
+
| --- | --- |
|
|
13
|
+
| [`@uns-kit/core`](https://github.com/uns-datahub/uns-kit/tree/main/packages/uns-core) | Base runtime utilities (UnsProxyProcess, MQTT helpers, configuration tooling, gRPC gateway support). |
|
|
14
|
+
| [`@uns-kit/api`](https://github.com/uns-datahub/uns-kit/tree/main/packages/uns-api) | Express plugin that exposes HTTP endpoints, handles JWT/JWKS auth, and republishes API metadata to UNS. |
|
|
15
|
+
| [`@uns-kit/cron`](https://github.com/uns-datahub/uns-kit/tree/main/packages/uns-cron) | Cron-driven scheduler that emits UNS events on a fixed cadence. |
|
|
16
|
+
| [`@uns-kit/temporal`](https://github.com/uns-datahub/uns-kit/tree/main/packages/uns-temporal) | Temporal.io integration that wires workflows into UnsProxyProcess. |
|
|
17
|
+
| [`@uns-kit/cli`](https://github.com/uns-datahub/uns-kit/tree/main/packages/uns-cli) | Command line tool for scaffolding new UNS applications. |
|
|
18
|
+
|
|
19
|
+
## Prerequisites
|
|
20
|
+
|
|
21
|
+
- Node.js 18 or newer (ES2022 runtime features)
|
|
22
|
+
- A package manager such as `pnpm`, `npm`, or `yarn`
|
|
23
|
+
- `git` available on PATH (required for `configure-devops`, used to initialize new projects automatically)
|
|
24
|
+
|
|
25
|
+
## Usage
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
pnpm --package=@uns-kit/cli dlx uns-kit create my-uns-app
|
|
29
|
+
# or with npx
|
|
30
|
+
npx @uns-kit/cli create my-uns-app
|
|
31
|
+
# or after installing globally
|
|
32
|
+
npm install -g @uns-kit/cli
|
|
33
|
+
uns-kit create my-uns-app
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
The command creates a new directory, copies the starter template, and pins `@uns-kit/core` to the currently published version. After the scaffold finishes:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
cd my-uns-app
|
|
40
|
+
pnpm install
|
|
41
|
+
pnpm run dev
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
When `git` is available on your PATH the scaffold also initializes a fresh repository so you can commit immediately.
|
|
45
|
+
|
|
46
|
+
### Create from a service bundle
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
uns-kit create --bundle ./service.bundle.json
|
|
50
|
+
uns-kit create --bundle ./service.bundle.json --dest ./my-dir
|
|
51
|
+
uns-kit create --bundle ./service.bundle.json --dest . --allow-existing
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Bundle-driven create uses `service.bundle.json` as the source of truth. The CLI:
|
|
55
|
+
|
|
56
|
+
- scaffolds the base TypeScript app from the existing default template
|
|
57
|
+
- copies the original bundle into the project root as `service.bundle.json`
|
|
58
|
+
- generates `SERVICE_SPEC.md` and `AGENTS.md`
|
|
59
|
+
- applies supported bundle features such as `vscode` and `devops`
|
|
60
|
+
|
|
61
|
+
When `--bundle` is used, the default destination is `./<metadata.name>`. The TypeScript CLI only accepts bundles with `scaffold.stack = "ts"` and currently supports `scaffold.template = "default"` for this MVP. If the bundle targets Python instead, use `uns-kit-py create --bundle ...`.
|
|
62
|
+
|
|
63
|
+
## Commands
|
|
64
|
+
|
|
65
|
+
- `uns-kit create <name>` – create a new UNS project in the specified directory.
|
|
66
|
+
- `uns-kit create --bundle <path> [--dest <dir>] [--allow-existing]` – create a new TypeScript UNS project from `service.bundle.json`.
|
|
67
|
+
- `uns-kit configure [path] [features...]` – run multiple configure templates in sequence (`--all`, `--overwrite`).
|
|
68
|
+
- `uns-kit configure-templates [path] [templates...]` – copy any template directory (`--all`, `--overwrite`).
|
|
69
|
+
- `uns-kit configure-devops [path]` – add Azure DevOps tooling (dependencies, script, config) to an existing project.
|
|
70
|
+
- `uns-kit configure-vscode [path]` – copy VS Code launch/workspace files into an existing project.
|
|
71
|
+
- `uns-kit configure-codegen [path]` – scaffold GraphQL code generation and UNS refresh scripts.
|
|
72
|
+
- `uns-kit configure-api [path]` – copy UNS API examples and add `@uns-kit/api`.
|
|
73
|
+
- `uns-kit configure-cron [path]` – copy UNS cron examples and add `@uns-kit/cron`.
|
|
74
|
+
- `uns-kit configure-temporal [path]` – copy UNS Temporal examples and add `@uns-kit/temporal`.
|
|
75
|
+
- `uns-kit configure-python [path]` – copy Python gateway client scaffolding (no npm dependency required).
|
|
76
|
+
- `uns-kit help` – display usage information.
|
|
77
|
+
|
|
78
|
+
### Configure multiple features at once
|
|
79
|
+
|
|
80
|
+
Chain several add-ons without running each subcommand manually:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
uns-kit configure --all
|
|
84
|
+
uns-kit configure ./apps/gateway devops vscode codegen
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Mix and match feature names after an optional target directory. Use `--all` to apply every available template in one shot. Add `--overwrite` to refresh files from newer template versions.
|
|
88
|
+
|
|
89
|
+
### Copy arbitrary templates
|
|
90
|
+
|
|
91
|
+
Need a template that is not wired into a configure feature (or added in a newer release)? Use:
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
uns-kit configure-templates --all
|
|
95
|
+
uns-kit configure-templates ./apps/gateway uns-dictionary uns-measurements --overwrite
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Configure Azure DevOps
|
|
99
|
+
|
|
100
|
+
Run inside a scaffolded project to add the Azure DevOps pull-request tooling:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
uns-kit configure-devops
|
|
104
|
+
pnpm install
|
|
105
|
+
pnpm run pull-request
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
The command prompts for your Azure DevOps organization/project, ensures the remote repository exists, and updates `config.json` along with the necessary dev dependencies.
|
|
109
|
+
|
|
110
|
+
### Configure VS Code workspace
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
uns-kit configure-vscode
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Copies `.vscode/launch.json` plus a baseline workspace file into the project. Existing files are skipped unless you pass `--overwrite`.
|
|
117
|
+
|
|
118
|
+
### Configure GraphQL code generation
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
uns-kit configure-codegen
|
|
122
|
+
pnpm install
|
|
123
|
+
pnpm run codegen
|
|
124
|
+
pnpm run refresh-uns
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Adds `codegen.ts`, seeds `src/uns/` placeholder types, and wires the GraphQL Code Generator / `refresh-uns` script into `package.json`. After installing the new dev dependencies you can regenerate strongly-typed operations (`pnpm run codegen`) and rebuild UNS topics/tags from your environment (`pnpm run refresh-uns`).
|
|
128
|
+
After installing the new dev dependencies you can regenerate strongly-typed operations (`pnpm run codegen`) and rebuild UNS metadata (topics/tags/assets) from your environment (`pnpm run generate-uns-metadata`).
|
|
129
|
+
|
|
130
|
+
### Add UNS API scaffolding
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
uns-kit configure-api
|
|
134
|
+
pnpm install
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Copies API-oriented examples (under `src/examples/`) and adds `@uns-kit/api` to your project dependencies.
|
|
138
|
+
Use `--overwrite` to refresh the examples after updating `uns-kit`.
|
|
139
|
+
|
|
140
|
+
### Add cron-based scaffolding
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
uns-kit configure-cron
|
|
144
|
+
pnpm install
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
Adds cron-oriented example stubs and installs `@uns-kit/cron`.
|
|
148
|
+
Use `--overwrite` to refresh the examples after updating `uns-kit`.
|
|
149
|
+
|
|
150
|
+
### Add Temporal scaffolding
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
uns-kit configure-temporal
|
|
154
|
+
pnpm install
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Copies Temporal example placeholders and installs `@uns-kit/temporal`.
|
|
158
|
+
Use `--overwrite` to refresh the examples after updating `uns-kit`.
|
|
159
|
+
|
|
160
|
+
### Add Python gateway scaffolding
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
uns-kit configure-python
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
Copies the Python gateway client template (examples, scripts, requirements, proto) into your project so you can iterate on the gRPC gateway from Python alongside your TypeScript project.
|
|
167
|
+
Use `--overwrite` to refresh the examples after updating `uns-kit`.
|
|
168
|
+
|
|
169
|
+
### Extend the Config Schema
|
|
170
|
+
|
|
171
|
+
Edit `src/config/project.config.extension.ts` inside your generated project and run `pnpm run generate-config-schema`. This regenerates `config.schema.json` and `src/config/app-config.ts`, augmenting `@uns-kit/core`'s `AppConfig` so editors and runtime types stay in sync. If completions lag, reload the TypeScript server in your editor.
|
|
172
|
+
|
|
173
|
+
## License
|
|
174
|
+
|
|
175
|
+
MIT © Aljoša Vister
|
package/dist/index.js
CHANGED
|
@@ -374,6 +374,21 @@ async function initGitRepository(targetDir) {
|
|
|
374
374
|
return false;
|
|
375
375
|
}
|
|
376
376
|
}
|
|
377
|
+
function setPackageScript(scripts, name, command) {
|
|
378
|
+
if (scripts[name] === command) {
|
|
379
|
+
return false;
|
|
380
|
+
}
|
|
381
|
+
scripts[name] = command;
|
|
382
|
+
return true;
|
|
383
|
+
}
|
|
384
|
+
function ensureUnsReferenceScripts(scripts) {
|
|
385
|
+
let changed = false;
|
|
386
|
+
changed = setPackageScript(scripts, "generate-uns-dictionary", "node ./node_modules/@uns-kit/core/dist/tools/generate-uns-dictionary.js --input uns-dictionary.json --output src/uns/uns-dictionary.generated.ts") || changed;
|
|
387
|
+
changed = setPackageScript(scripts, "generate-uns-measurements", "node ./node_modules/@uns-kit/core/dist/tools/generate-uns-measurements.js --input uns-measurements.json --output src/uns/uns-measurements.generated.ts") || changed;
|
|
388
|
+
changed = setPackageScript(scripts, "generate-uns-reference", "node ./node_modules/@uns-kit/core/dist/tools/generate-uns-reference.js --dictionary uns-dictionary.json --dictionary-output src/uns/uns-dictionary.generated.ts --measurements uns-measurements.json --measurements-output src/uns/uns-measurements.generated.ts") || changed;
|
|
389
|
+
changed = setPackageScript(scripts, "sync-uns-schema", "node ./node_modules/@uns-kit/core/dist/tools/sync-uns-schema.js") || changed;
|
|
390
|
+
return changed;
|
|
391
|
+
}
|
|
377
392
|
async function configureDevops(targetPath, options) {
|
|
378
393
|
const targetDir = path.resolve(process.cwd(), targetPath ?? ".");
|
|
379
394
|
await ensureGitRepository(targetDir);
|
|
@@ -762,6 +777,7 @@ async function configurePython(targetPath, options = {}) {
|
|
|
762
777
|
});
|
|
763
778
|
}
|
|
764
779
|
async function configureUnsReference(targetPath, options = {}) {
|
|
780
|
+
const targetDir = path.resolve(process.cwd(), targetPath ?? ".");
|
|
765
781
|
await configurePlugin({
|
|
766
782
|
targetPath,
|
|
767
783
|
templateName: "uns-dictionary",
|
|
@@ -774,6 +790,27 @@ async function configureUnsReference(targetPath, options = {}) {
|
|
|
774
790
|
label: "UNS measurements (units)",
|
|
775
791
|
overwrite: options.overwrite,
|
|
776
792
|
});
|
|
793
|
+
const packagePath = path.join(targetDir, "package.json");
|
|
794
|
+
let pkgRaw;
|
|
795
|
+
try {
|
|
796
|
+
pkgRaw = await readFile(packagePath, "utf8");
|
|
797
|
+
}
|
|
798
|
+
catch (error) {
|
|
799
|
+
if (error.code === "ENOENT") {
|
|
800
|
+
throw new Error(`Could not find package.json in ${targetDir}`);
|
|
801
|
+
}
|
|
802
|
+
throw error;
|
|
803
|
+
}
|
|
804
|
+
const pkg = JSON.parse(pkgRaw);
|
|
805
|
+
const scripts = (pkg.scripts ??= {});
|
|
806
|
+
const pkgChanged = ensureUnsReferenceScripts(scripts);
|
|
807
|
+
if (pkgChanged) {
|
|
808
|
+
await writeFile(packagePath, JSON.stringify(pkg, null, 2) + "\n", "utf8");
|
|
809
|
+
console.log(" Updated package.json schema scripts.");
|
|
810
|
+
}
|
|
811
|
+
else {
|
|
812
|
+
console.log(" Existing package.json already contained schema scripts.");
|
|
813
|
+
}
|
|
777
814
|
}
|
|
778
815
|
const configureFeatureHandlers = {
|
|
779
816
|
devops: configureDevops,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uns-kit/cli",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.25",
|
|
4
4
|
"description": "Command line scaffolding tool for UNS applications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -26,13 +26,13 @@
|
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"azure-devops-node-api": "^15.1.1",
|
|
29
|
-
"@uns-kit/core": "2.0.
|
|
29
|
+
"@uns-kit/core": "2.0.25"
|
|
30
30
|
},
|
|
31
31
|
"unsKitPackages": {
|
|
32
|
-
"@uns-kit/core": "2.0.
|
|
33
|
-
"@uns-kit/api": "2.0.
|
|
34
|
-
"@uns-kit/cron": "2.0.
|
|
35
|
-
"@uns-kit/temporal": "2.0.
|
|
32
|
+
"@uns-kit/core": "2.0.25",
|
|
33
|
+
"@uns-kit/api": "2.0.25",
|
|
34
|
+
"@uns-kit/cron": "2.0.25",
|
|
35
|
+
"@uns-kit/temporal": "2.0.25"
|
|
36
36
|
},
|
|
37
37
|
"scripts": {
|
|
38
38
|
"build": "tsc -p tsconfig.build.json",
|