@norskvideo/ctl-dev-kit 0.2.1 → 0.2.2

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.
@@ -59,7 +59,11 @@
59
59
  `deployment/iterate.sh` (`bun run iterate`); model new ones on it. Two gotchas it
60
60
  encodes: (1) the **built image name must satisfy the license's imageRef** — the
61
61
  licensed repo (e.g. `norskvideo/norsk-<x>-product`), not a throwaway `:dev` name;
62
- `product add` 400s on a mismatch, so build UNDER that repo. (2) the **license must
62
+ `product add` 400s on a mismatch, so build UNDER that repo. `licenseTemplate.json`
63
+ records that entry (this product at the image this repo builds) and is what a
64
+ license gets minted from; CI's licence-template step fails if it is missing or
65
+ names another image, so change its `imageRef` whenever `PUBLISH_IMAGE` or the
66
+ build script's `IMAGE_TAG` default changes. (2) the **license must
63
67
  entitle both `norsk-studio` and the product** (the runtime does the
64
68
  studio<->media handshake as `norsk-studio`). Needs a running daemon
65
69
  (`norsk-ctl serve`) + `norsk-ctl` on PATH (the nix shell) + `NORSK_LICENSE_FILE`.
@@ -215,6 +215,7 @@ function conventionFiles(ctx: ShapeContext, shape: ShapeModule): GeneratedFile[]
215
215
  { path: ".github/workflows/build-image.yml", content: fillProduct(canon.buildImage) },
216
216
  { path: ".github/actions/ci-status-dispatch/action.yml", content: loadAsset("ci-status-dispatch.yml") },
217
217
  { path: "manifest.seed.json", content: seedJson(ctx) },
218
+ { path: "licenseTemplate.json", content: licenseTemplateJson(ctx) },
218
219
  { path: "deployment/build-image.sh", content: buildImageWrapper(ctx), executable: true },
219
220
  ];
220
221
  }
@@ -233,6 +234,17 @@ function seedJson(ctx: ShapeContext): string {
233
234
  )}\n`;
234
235
  }
235
236
 
237
+ // The licence this product needs, as CI's licence-template step checks it: this
238
+ // product at the image the repo builds. Until PUBLISH_IMAGE is set that is the
239
+ // build script's IMAGE_TAG default, `<name>:dev`, whose repo part is the name.
240
+ function licenseTemplateJson(ctx: ShapeContext): string {
241
+ return `${JSON.stringify(
242
+ { products: [{ product: ctx.name, imageRef: ctx.name, versionConstraint: "*", mode: "designer" }] },
243
+ null,
244
+ 2,
245
+ )}\n`;
246
+ }
247
+
236
248
  function buildImageWrapper(ctx: ShapeContext): string {
237
249
  // The gate requires the find_dev_kit function verbatim and a `source` of a
238
250
  // dev-kit build/ script; the surrounding wrapper (tag, port) is per-product.
@@ -102,11 +102,10 @@ if (import.meta.main) {
102
102
  try {
103
103
  contents = readFileSync(file, "utf8");
104
104
  } catch {
105
- // Absence is not yet an error: the turnkeys' templates wait on their
106
- // customer-facing image names being settled. Flipping this to a failure is
107
- // a one-line change once every repo carries one.
108
- console.log(`licence-template: no ${file} — not yet required in this repo`);
109
- process.exit(0);
105
+ // Every fleet repo carries one and create-product emits one, so absence is
106
+ // a repo that has stopped saying which licence it needs.
107
+ console.error(`licence-template: no ${file} — declare the product and image this repo's licence must entitle`);
108
+ process.exit(1);
110
109
  }
111
110
  const problems = templateProblems(contents, { product, image });
112
111
  if (problems.length) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@norskvideo/ctl-dev-kit",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  "./create-product": "./create-product/create-product.ts",