@ksp-gonogo/uplink-tools 0.0.0 → 0.2.0-rc.12
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/README.md +153 -1
- package/bin/uplink-tools.mjs +5 -0
- package/dist/chunk-D7WPQAJB.js +2204 -0
- package/dist/chunk-D7WPQAJB.js.map +1 -0
- package/dist/chunk-HK4MPZTZ.js +7 -0
- package/dist/chunk-HK4MPZTZ.js.map +1 -0
- package/dist/chunk-QJ4XATKJ.js +1606 -0
- package/dist/chunk-QJ4XATKJ.js.map +1 -0
- package/dist/chunk-ZXX5ILJ5.js +1287 -0
- package/dist/chunk-ZXX5ILJ5.js.map +1 -0
- package/dist/cli-WHKXPUWS.js +512 -0
- package/dist/cli-WHKXPUWS.js.map +1 -0
- package/dist/cli.d.ts +20 -0
- package/dist/cli.js +8 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +1101 -0
- package/dist/index.js +72 -0
- package/dist/index.js.map +1 -0
- package/dist/page-check.d.ts +85 -0
- package/dist/page-check.js +347 -0
- package/dist/page-check.js.map +1 -0
- package/dist/render-probe.d.ts +683 -0
- package/dist/render-probe.js +1746 -0
- package/dist/render-probe.js.map +1 -0
- package/dist/widgets.d.ts +2 -0
- package/dist/widgets.js +29813 -0
- package/dist/widgets.js.map +1 -0
- package/dist/widgets.json +12287 -0
- package/package.json +102 -4
package/README.md
CHANGED
|
@@ -1,3 +1,155 @@
|
|
|
1
1
|
# @ksp-gonogo/uplink-tools
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The Uplink author's toolchain: it scaffolds an Uplink, bundles its client,
|
|
4
|
+
renders its scenes in a real browser, generates its page, and supplies the app's
|
|
5
|
+
own widgets as the host widgets an augment is drawn inside.
|
|
6
|
+
|
|
7
|
+
It is a **devDependency**. Nothing here ships in an Uplink's bundle.
|
|
8
|
+
|
|
9
|
+
## The command line
|
|
10
|
+
|
|
11
|
+
One command, `uplink-tools`, and nothing to install before the first run:
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
npx @ksp-gonogo/uplink-tools new myuplink --repo you/myuplink # in an empty directory
|
|
15
|
+
npx @ksp-gonogo/uplink-tools --help
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
`new` writes the Uplink and then runs its generators, so the directory it leaves
|
|
19
|
+
builds and tests: `npm test` in `client/`, and `dotnet test mod-tests`. It needs
|
|
20
|
+
Node and the .NET SDK, and no clone of anything. The C# half reaches Gonogo
|
|
21
|
+
through one NuGet package, `KspGonogo.Sitrep.Contract`, at the same version as
|
|
22
|
+
this package.
|
|
23
|
+
|
|
24
|
+
Once it is in an Uplink's devDependencies the same commands answer to
|
|
25
|
+
`uplink-tools` in a `package.json` script, which is what a workflow calls:
|
|
26
|
+
|
|
27
|
+
| command | what it does |
|
|
28
|
+
|---|---|
|
|
29
|
+
| `new <id>` | scaffold an Uplink: contract slice, plugin, tests, one widget and its fixture, then generate its client types, install the client and write its page. In a repo with an `uplinks/` folder it goes to `uplinks/<id>/`; anywhere else the current directory becomes the Uplink |
|
|
30
|
+
| `codegen` | generate `client/src/__generated__/` from the C# contract slice; `codegen --check` fails on drift |
|
|
31
|
+
| `bundle` | build the client bundle the app loads, and the `gonogo-uplink.json` beside it |
|
|
32
|
+
| `bake` | write what the plugin tells the app about its client into C#: where the bundle lives, who wrote it, and the hash the mod vouches for |
|
|
33
|
+
| `package` | lay the built plugin out as `GameData/<name>/` and zip it |
|
|
34
|
+
| `release` | `bundle`, `bake`, compile the plugin, check the DLL carries what was baked, and `package`, in that order |
|
|
35
|
+
| `page` | write `README.md`, `gonogo-uplink.json` and `docs/widgets.json` from what the client registers, with no browser |
|
|
36
|
+
| `render` | render every scene to `renders/` |
|
|
37
|
+
| `docs` | write `README.md`, `gonogo-uplink.json`, `docs/widgets.json` and `docs/assets/`; `docs --check` fails on drift |
|
|
38
|
+
|
|
39
|
+
The order inside `release` is the point of it. The app loads an installed
|
|
40
|
+
Uplink's client only when the plugin says where the bundle lives and vouches for
|
|
41
|
+
its hash, so the bundle has to be built and hashed before the plugin is
|
|
42
|
+
compiled. A plugin baked without its bundle builds, tests green, and shows no
|
|
43
|
+
widget.
|
|
44
|
+
|
|
45
|
+
Every command takes `--help`, and refuses a flag it does not read.
|
|
46
|
+
|
|
47
|
+
## What is in it
|
|
48
|
+
|
|
49
|
+
| entry | what it is |
|
|
50
|
+
|---|---|
|
|
51
|
+
| `@ksp-gonogo/uplink-tools` | the harness API and the `uplink-tools` command's `run`. Node: esbuild, Playwright, the filesystem |
|
|
52
|
+
| `@ksp-gonogo/uplink-tools/render-probe` | the browser half, which mounts a widget in the page the harness builds |
|
|
53
|
+
| `@ksp-gonogo/uplink-tools/page-check` | the assertion an Uplink's own suite runs to keep its committed page honest. Deliberately free of Playwright, so an author with no browser can still run it |
|
|
54
|
+
| `@ksp-gonogo/uplink-tools/widgets` | the app's own widgets, registered, so a scene can name one as its `_scene.hostWidget` |
|
|
55
|
+
|
|
56
|
+
You will not usually import the first of these: the command line runs it.
|
|
57
|
+
|
|
58
|
+
`uplink-tools docs` writes `README.md`, `gonogo-uplink.json` and
|
|
59
|
+
`docs/widgets.json`, the record of each widget you register. The README's widget
|
|
60
|
+
sections are rendered from those records, and `docs --check` and
|
|
61
|
+
`expectUplinkPageCurrent` fail when any of the three no longer matches your
|
|
62
|
+
registrations. Commit all three.
|
|
63
|
+
|
|
64
|
+
## What a fixture puts on the stream
|
|
65
|
+
|
|
66
|
+
A fixture's `_stream` block is the wire its scene is fed from:
|
|
67
|
+
|
|
68
|
+
```json
|
|
69
|
+
{
|
|
70
|
+
"_scene": { "widget": "reactor" },
|
|
71
|
+
"_stream": {
|
|
72
|
+
"pinnedUt": 1000,
|
|
73
|
+
"delaySeconds": 60,
|
|
74
|
+
"emits": [
|
|
75
|
+
{ "topic": "example.reactor", "payload": {}, "validAt": 940 },
|
|
76
|
+
{ "topic": "example.reactor", "payload": {} }
|
|
77
|
+
]
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
| field | what it does |
|
|
83
|
+
|---|---|
|
|
84
|
+
| `emits` | replayed once the scene has subscribed, in the order written, or in the order sent under `delaySeconds`. An entry's `validAt` is the instant it was sent; with none it was sent at `pinnedUt` |
|
|
85
|
+
| `pinnedUt` | the operator's view time, which the scene is drawn at when it has no `delaySeconds`. Defaults to `1000000` |
|
|
86
|
+
| `stopsArriving` | drop the link once every emit has landed, so the picture is of figures that are held |
|
|
87
|
+
| `delaySeconds` | a one-way light time between the craft and the screen, in seconds |
|
|
88
|
+
|
|
89
|
+
**`delaySeconds`** stages what an operator sees across a light time. Each
|
|
90
|
+
reading sent at `validAt` is delivered `delaySeconds` later, the view time is
|
|
91
|
+
the newest `validAt` delivered (an emit naming none counts as `pinnedUt`), and
|
|
92
|
+
the craft's present runs one light time ahead of it.
|
|
93
|
+
Every reading is reckoned to that present exactly as it is in the app, so a
|
|
94
|
+
scene can show a modelled figure beside the observed one, drawn with the kit's
|
|
95
|
+
modelled mark. Without it, or at `0`, the view time and the craft's present are
|
|
96
|
+
one instant and nothing is carried across. A reckoner that fits a trend needs
|
|
97
|
+
more than one reading, so give those emits a history of `validAt`s. If your
|
|
98
|
+
widget reads the light time off `comms.delay`, emit that too: the delay stages
|
|
99
|
+
the clock, not the topic.
|
|
100
|
+
|
|
101
|
+
Under a delay an `advanceUt` step moves the craft's present and leaves the view
|
|
102
|
+
time where it is until something newer is delivered, so a negative `advanceUt`
|
|
103
|
+
is refused.
|
|
104
|
+
|
|
105
|
+
## Using the host widgets
|
|
106
|
+
|
|
107
|
+
An Uplink's docs page shows its widgets, and some of them are an AUGMENT or a
|
|
108
|
+
CONTRIBUTION into a widget that ships with the app. To draw one honestly you
|
|
109
|
+
need the widget around it:
|
|
110
|
+
|
|
111
|
+
```json
|
|
112
|
+
{
|
|
113
|
+
"devDependencies": {
|
|
114
|
+
"@ksp-gonogo/uplink-tools": "^0.1.0"
|
|
115
|
+
},
|
|
116
|
+
"gonogo": {
|
|
117
|
+
"renderWith": ["@ksp-gonogo/uplink-tools/widgets"]
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
A fixture can then name the widget it extends:
|
|
123
|
+
|
|
124
|
+
```json
|
|
125
|
+
{ "_scene": { "hostWidget": "strategies" } }
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
There is nothing to `import` from `/widgets`. It exports no symbols: importing it
|
|
129
|
+
runs the app widgets' own registrations, which is all the harness needs to
|
|
130
|
+
resolve a scene's `hostWidget`.
|
|
131
|
+
|
|
132
|
+
**`/widgets` is for the docs page only.** Name it in `devDependencies` and in
|
|
133
|
+
`gonogo.renderWith`, and nowhere else: never put `@ksp-gonogo/uplink-tools` in
|
|
134
|
+
`dependencies`, and never import `/widgets` from your client. If you want one
|
|
135
|
+
of its components for real use, ask for that component in `@ksp-gonogo/ui-kit`.
|
|
136
|
+
|
|
137
|
+
## Why a stand-in is not enough
|
|
138
|
+
|
|
139
|
+
The harness already synthesises a stand-in for a scene that names none, and it
|
|
140
|
+
covers more than you would expect: an augment mounts in that stand-in's `Panel`,
|
|
141
|
+
and `Panel` draws every widget's `<id>.badges` itself, so a badge contribution
|
|
142
|
+
lands there exactly as it lands in the real widget.
|
|
143
|
+
|
|
144
|
+
Every **other** contribution slot is drawn by the host widget's own body, and a
|
|
145
|
+
stand-in's body draws nothing. `strategies.screens`,
|
|
146
|
+
`space-center-status.facilities` and `astronaut-complex.readouts` are each read
|
|
147
|
+
by a `useContributions(...)` inside the widget. Standing in for those produces a
|
|
148
|
+
blank frame that reports success. A real widget's own body is the only thing that draws
|
|
149
|
+
them.
|
|
150
|
+
|
|
151
|
+
## Its relation to `@ksp-gonogo/ui-kit`
|
|
152
|
+
|
|
153
|
+
`@ksp-gonogo/ui-kit` is a peer dependency: install the two at matching
|
|
154
|
+
versions. The harness draws with the kit and its `/grid` and `/testing`
|
|
155
|
+
entries, and the app widgets behind `/widgets` are built on it.
|