@norskvideo/ctl-dev-kit 0.2.49 → 0.2.51
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.
|
@@ -716,7 +716,7 @@ jobs:
|
|
|
716
716
|
# the pony/emoji from the dispatched result. always() so a red or manual run
|
|
717
717
|
# still reports.
|
|
718
718
|
notify:
|
|
719
|
-
needs: [build, gate-checks, gate-guides, publish, record]
|
|
719
|
+
needs: [label, build, gate-checks, gate-guides, publish, record]
|
|
720
720
|
if: ${{ !cancelled() }}
|
|
721
721
|
runs-on: x64
|
|
722
722
|
steps:
|
|
@@ -792,7 +792,9 @@ jobs:
|
|
|
792
792
|
product: __PRODUCT__
|
|
793
793
|
pipeline: build-image
|
|
794
794
|
status: ${{ steps.meta.outputs.state }}
|
|
795
|
-
|
|
795
|
+
# Only where something is published: on a build-only repo the gate has
|
|
796
|
+
# nothing to gate, and saying so on every build is noise.
|
|
797
|
+
detail: "${{ needs.label.outputs.publish == 'true' && needs.gate-guides.outputs.guides == 'skip' && format('guides not gating: {0}', needs.gate-guides.outputs.reason) || '' }}"
|
|
796
798
|
- name: Reap the containers this job launched
|
|
797
799
|
# Whatever the tests did. A teardown cut short by a test timeout leaves
|
|
798
800
|
# its instance running on the shared Docker daemon (see JOB_REAP_STEP in
|
|
@@ -33,7 +33,9 @@ function packageJson(ctx: ShapeContext): string {
|
|
|
33
33
|
type: "commonjs",
|
|
34
34
|
main: "lib/index.js",
|
|
35
35
|
scripts: {
|
|
36
|
-
|
|
36
|
+
// clean first: tsc never deletes output, so a removed component would
|
|
37
|
+
// otherwise still ship from lib/.
|
|
38
|
+
build: "bun run clean && bun run scripts/codegen.ts && bunx tsc && bun run scripts/copy-yamls.ts",
|
|
37
39
|
codegen: "bun run scripts/codegen.ts",
|
|
38
40
|
clean: "rm -rf lib",
|
|
39
41
|
test: "bun test src/",
|
|
@@ -155,6 +155,13 @@ export type ExampleState = { ticks: number };
|
|
|
155
155
|
|
|
156
156
|
export const getStatus = (env: Env) => apiGet<ExampleState>(env, "/status");
|
|
157
157
|
|
|
158
|
+
/** Studio wraps the state in every message that carries one; events and alerts carry none. */
|
|
159
|
+
export function stateFromMessage(msg: unknown): unknown {
|
|
160
|
+
const m = msg as { type?: string; state?: unknown } | null;
|
|
161
|
+
if (m && typeof m === "object" && (m.type === "initial-state" || m.type === "state-update")) return m.state;
|
|
162
|
+
return undefined;
|
|
163
|
+
}
|
|
164
|
+
|
|
158
165
|
/**
|
|
159
166
|
* The component's state feed: Studio broadcasts every updates.update() here.
|
|
160
167
|
*
|
|
@@ -165,7 +172,8 @@ export const getStatus = (env: Env) => apiGet<ExampleState>(env, "/status");
|
|
|
165
172
|
export function openStateSocket(env: Env, onState: (state: ExampleState) => void): WebSocket {
|
|
166
173
|
const socket = new WebSocket(\`\${env.wsBasePath}/\${COMPONENT_ID}/ws\`);
|
|
167
174
|
socket.onmessage = (event) => {
|
|
168
|
-
|
|
175
|
+
const state = stateFromMessage(JSON.parse(event.data as string));
|
|
176
|
+
if (state !== undefined) onState(state as ExampleState);
|
|
169
177
|
};
|
|
170
178
|
return socket;
|
|
171
179
|
}
|
|
@@ -336,10 +336,16 @@ function rootPackageJson(ctx: ShapeContext): string {
|
|
|
336
336
|
...(hasFrontend ? { "build:frontend": "bun run --cwd frontend build" } : {}),
|
|
337
337
|
"build:backend": "bun run --cwd backend build",
|
|
338
338
|
"build:image": "bash deployment/build-image.sh",
|
|
339
|
-
// The backend SERVES frontend/dist
|
|
340
|
-
// hands the daemon
|
|
341
|
-
//
|
|
342
|
-
dev:
|
|
339
|
+
// The backend SERVES frontend/dist and PACKS components/lib and
|
|
340
|
+
// dashboards/, so a dev loop that skips a build hands the daemon a 404
|
|
341
|
+
// configure screen, a stale component or a dashboard that 404s.
|
|
342
|
+
// `dev:frontend` is vite's own server, for iterating on the screen with HMR.
|
|
343
|
+
dev: [
|
|
344
|
+
...(hasComponents ? ["bun run build:components"] : []),
|
|
345
|
+
...(hasDashboard ? ["bun run build:dashboard"] : []),
|
|
346
|
+
...(hasFrontend ? ["bun run build:frontend"] : []),
|
|
347
|
+
"bun run --cwd backend dev",
|
|
348
|
+
].join(" && "),
|
|
343
349
|
...(hasFrontend ? { "dev:frontend": "bun run --cwd frontend dev" } : {}),
|
|
344
350
|
start: "bun run --cwd backend start",
|
|
345
351
|
iterate: "bash deployment/iterate.sh",
|