@uns-kit/cli 2.0.27 → 2.0.29
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 +67 -9
- 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 -24
- 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 -24
- package/templates/default/README.md +43 -43
- 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 +45 -49
- 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
|
@@ -145,6 +145,17 @@ async function main() {
|
|
|
145
145
|
}
|
|
146
146
|
return;
|
|
147
147
|
}
|
|
148
|
+
if (command === "upgrade") {
|
|
149
|
+
const targetPath = args[1] && !args[1].startsWith("--") ? args[1] : undefined;
|
|
150
|
+
try {
|
|
151
|
+
await upgradeProject(targetPath);
|
|
152
|
+
}
|
|
153
|
+
catch (error) {
|
|
154
|
+
console.error(error.message);
|
|
155
|
+
process.exitCode = 1;
|
|
156
|
+
}
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
148
159
|
if (command === "create") {
|
|
149
160
|
try {
|
|
150
161
|
const createOptions = parseCreateArgs(args.slice(1));
|
|
@@ -184,6 +195,7 @@ function printHelp() {
|
|
|
184
195
|
" configure-temporal [dir] Copy UNS Temporal examples and add @uns-kit/temporal\n" +
|
|
185
196
|
" configure-python [dir] Copy Python gateway client scaffolding\n" +
|
|
186
197
|
" configure-uns-reference [dir] Copy UNS dictionaries (objects/attributes/measurements)\n" +
|
|
198
|
+
" upgrade [dir] Remove obsolete scripts and update to current conventions\n" +
|
|
187
199
|
" help Show this message\n");
|
|
188
200
|
}
|
|
189
201
|
function parseCreateArgs(args) {
|
|
@@ -382,13 +394,14 @@ function setPackageScript(scripts, name, command) {
|
|
|
382
394
|
return true;
|
|
383
395
|
}
|
|
384
396
|
function ensureUnsReferenceScripts(scripts) {
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
397
|
+
return setPackageScript(scripts, "sync-uns-schema", "node ./node_modules/@uns-kit/core/dist/tools/sync-uns-schema.js");
|
|
398
|
+
}
|
|
399
|
+
const OBSOLETE_SCRIPTS = [
|
|
400
|
+
"generate-uns-dictionary",
|
|
401
|
+
"generate-uns-measurements",
|
|
402
|
+
"generate-uns-reference",
|
|
403
|
+
"generate-uns-metadata",
|
|
404
|
+
];
|
|
392
405
|
async function configureDevops(targetPath, options) {
|
|
393
406
|
const targetDir = path.resolve(process.cwd(), targetPath ?? ".");
|
|
394
407
|
await ensureGitRepository(targetDir);
|
|
@@ -704,8 +717,6 @@ async function configureCodegen(targetPath, options = {}) {
|
|
|
704
717
|
scripts["generate-codegen"] = "graphql-code-generator --config codegen.ts";
|
|
705
718
|
pkgChanged = true;
|
|
706
719
|
}
|
|
707
|
-
scripts["generate-uns-metadata"] = "node ./node_modules/@uns-kit/core/dist/tools/refresh-uns.js";
|
|
708
|
-
pkgChanged = true;
|
|
709
720
|
if (pkgChanged) {
|
|
710
721
|
await writeFile(packagePath, JSON.stringify(pkg, null, 2) + "\n", "utf8");
|
|
711
722
|
}
|
|
@@ -812,6 +823,53 @@ async function configureUnsReference(targetPath, options = {}) {
|
|
|
812
823
|
console.log(" Existing package.json already contained schema scripts.");
|
|
813
824
|
}
|
|
814
825
|
}
|
|
826
|
+
async function upgradeProject(targetPath) {
|
|
827
|
+
const targetDir = path.resolve(process.cwd(), targetPath ?? ".");
|
|
828
|
+
const packagePath = path.join(targetDir, "package.json");
|
|
829
|
+
let pkgRaw;
|
|
830
|
+
try {
|
|
831
|
+
pkgRaw = await readFile(packagePath, "utf8");
|
|
832
|
+
}
|
|
833
|
+
catch (error) {
|
|
834
|
+
if (error.code === "ENOENT") {
|
|
835
|
+
throw new Error(`Could not find package.json in ${targetDir}`);
|
|
836
|
+
}
|
|
837
|
+
throw error;
|
|
838
|
+
}
|
|
839
|
+
const pkg = JSON.parse(pkgRaw);
|
|
840
|
+
const scripts = (pkg.scripts ??= {});
|
|
841
|
+
let changed = false;
|
|
842
|
+
const removed = [];
|
|
843
|
+
for (const name of OBSOLETE_SCRIPTS) {
|
|
844
|
+
if (scripts[name] !== undefined) {
|
|
845
|
+
delete scripts[name];
|
|
846
|
+
removed.push(name);
|
|
847
|
+
changed = true;
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
// Ensure sync-uns-schema is present if any uns-reference scripts were present
|
|
851
|
+
const hadUnsReference = removed.some((name) => name.startsWith("generate-uns"));
|
|
852
|
+
if (hadUnsReference && !scripts["sync-uns-schema"]) {
|
|
853
|
+
scripts["sync-uns-schema"] = "node ./node_modules/@uns-kit/core/dist/tools/sync-uns-schema.js";
|
|
854
|
+
changed = true;
|
|
855
|
+
}
|
|
856
|
+
if (changed) {
|
|
857
|
+
await writeFile(packagePath, JSON.stringify(pkg, null, 2) + "\n", "utf8");
|
|
858
|
+
}
|
|
859
|
+
console.log(`\nUpgrade complete for ${targetDir}`);
|
|
860
|
+
if (removed.length > 0) {
|
|
861
|
+
console.log(" Removed obsolete scripts:");
|
|
862
|
+
for (const name of removed) {
|
|
863
|
+
console.log(` - ${name}`);
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
if (hadUnsReference && !scripts["sync-uns-schema"]) {
|
|
867
|
+
console.log(" Added: sync-uns-schema");
|
|
868
|
+
}
|
|
869
|
+
if (!changed) {
|
|
870
|
+
console.log(" Already up to date.");
|
|
871
|
+
}
|
|
872
|
+
}
|
|
815
873
|
const configureFeatureHandlers = {
|
|
816
874
|
devops: configureDevops,
|
|
817
875
|
vscode: configureVscode,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uns-kit/cli",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.29",
|
|
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.29"
|
|
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.29",
|
|
33
|
+
"@uns-kit/api": "2.0.29",
|
|
34
|
+
"@uns-kit/cron": "2.0.29",
|
|
35
|
+
"@uns-kit/temporal": "2.0.28"
|
|
36
36
|
},
|
|
37
37
|
"scripts": {
|
|
38
38
|
"build": "tsc -p tsconfig.build.json",
|