@bridge-ds/visual 0.3.3 → 0.3.5

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.
Files changed (2) hide show
  1. package/dist/index.js +11 -0
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -118,6 +118,8 @@ function productProblems(raw) {
118
118
 
119
119
  // ../core/src/config.ts
120
120
  var CONFIG_FILE = "bridge.config.json";
121
+ var CHANGES_MODES = ["suggest", "direct"];
122
+ var DEFAULT_CHANGES_MODE = "suggest";
121
123
  var DEFAULT_OVERRIDE = { allowed: [], requireReason: true, minReasonLength: 20 };
122
124
  var DEFAULT_TOKEN_PATHS = {
123
125
  root: "tokens",
@@ -257,6 +259,8 @@ function defineConfig(input) {
257
259
  ...g.rights ? { rights: normalizeRights(g.rights) } : {}
258
260
  },
259
261
  products: input.products?.length ? input.products.map((p) => ({ ...p })) : DEFAULT_PRODUCTS.map((p) => ({ ...p })),
262
+ changes: input.changes === "direct" ? "direct" : DEFAULT_CHANGES_MODE,
263
+ ...input.storybook?.url ? { storybook: { url: input.storybook.url.trim().replace(/\/+$/, "") } } : {},
260
264
  ...input.audit ? { audit: { ...input.audit } } : {},
261
265
  ...input.visualImpact ? { visualImpact: { mode: input.visualImpact.mode === "on-demand" ? "on-demand" : "auto" } } : {},
262
266
  ...input.integrations ? { integrations: { ...input.integrations } } : {},
@@ -379,6 +383,13 @@ function loadConfig(source) {
379
383
  }
380
384
  }
381
385
  problems.push(...visualImpactProblems(d.visualImpact));
386
+ if (d.changes !== void 0 && !CHANGES_MODES.includes(d.changes)) problems.push(`"changes" must be "suggest" or "direct" (got ${JSON.stringify(d.changes)})`);
387
+ const sb = d.storybook;
388
+ if (sb !== void 0) {
389
+ if (!isObj(sb) || !isStr(sb.url)) problems.push('"storybook" must be { "url" } with the deployed Storybook address');
390
+ else if (!/^https:\/\/[^\s/]+/.test(sb.url.trim())) problems.push('"storybook.url" must start with https://, for example https://storybook.example.com');
391
+ else for (const k of Object.keys(sb)) if (k !== "url") problems.push(`"storybook.${k}" is not a known key`);
392
+ }
382
393
  problems.push(...productProblems(d.products));
383
394
  const audit = d.audit;
384
395
  if (audit !== void 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bridge-ds/visual",
3
- "version": "0.3.3",
3
+ "version": "0.3.5",
4
4
  "type": "module",
5
5
  "description": "Bridge visual impact analysis: screenshots the stories and app screens a design system change touches, at the base and head refs, and pixel-diffs them into before/after/diff images and a JSON manifest.",
6
6
  "license": "MIT",
@@ -47,7 +47,7 @@
47
47
  "build:package": "node ../../scripts/build-packages.mjs visual"
48
48
  },
49
49
  "dependencies": {
50
- "@bridge-ds/core": "^0.9.0",
50
+ "@bridge-ds/core": "^0.11.0",
51
51
  "pixelmatch": "7.1.0",
52
52
  "playwright-core": "1.63.0",
53
53
  "pngjs": "7.0.0"