@bridge-ds/visual 0.3.6 → 0.3.9
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/dist/index.js +15 -4
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -139,7 +139,7 @@ var DEFAULT_GOVERNANCE = {
|
|
|
139
139
|
owners: { design: [], tech: [] }
|
|
140
140
|
};
|
|
141
141
|
var FLAT_TOKEN_KEYS = ["primitives", "brands", "semantic", "base", "density", "components", "contrastChecks"];
|
|
142
|
-
var CANONICAL_TOKEN_KEYS = ["root", "include", "exclude", "tiers", "layers"];
|
|
142
|
+
var CANONICAL_TOKEN_KEYS = ["root", "include", "exclude", "tiers", "layers", "usage"];
|
|
143
143
|
var FLAT_MODE_KEYS = ["brands", "themes", "densities", "defaults"];
|
|
144
144
|
var AXIS_OF = { brands: "brand", themes: "theme", densities: "density" };
|
|
145
145
|
var ConfigError = class extends Error {
|
|
@@ -227,7 +227,7 @@ function defineConfig(input) {
|
|
|
227
227
|
const contrastFile = contrastPath ?? [root === "." ? "" : root, paths.contrastChecks].filter(Boolean).join("/");
|
|
228
228
|
return {
|
|
229
229
|
repo: parseRepoInput(input.repo, input.branch),
|
|
230
|
-
tokens: { ...paths, include: input.tokens?.include ?? ["**/*.tokens.json"], exclude: input.tokens?.exclude ?? [], tiers, layers },
|
|
230
|
+
tokens: { ...paths, include: input.tokens?.include ?? ["**/*.tokens.json"], exclude: input.tokens?.exclude ?? [], tiers, layers, ...t.usage ? { usage: trimSlashes(t.usage) } : {} },
|
|
231
231
|
axes,
|
|
232
232
|
modes,
|
|
233
233
|
contrast: { path: contrastFile, modes: input.contrast?.modes },
|
|
@@ -256,11 +256,13 @@ function defineConfig(input) {
|
|
|
256
256
|
minReasonLength: g.override.minReasonLength ?? DEFAULT_OVERRIDE.minReasonLength
|
|
257
257
|
}
|
|
258
258
|
} : {},
|
|
259
|
-
...g.rights ? { rights: normalizeRights(g.rights) } : {}
|
|
259
|
+
...g.rights ? { rights: normalizeRights(g.rights) } : {},
|
|
260
|
+
...g.soloOwnerCanApproveBoth === true ? { soloOwnerCanApproveBoth: true } : {}
|
|
260
261
|
},
|
|
261
262
|
products: input.products?.length ? input.products.map((p) => ({ ...p })) : DEFAULT_PRODUCTS.map((p) => ({ ...p })),
|
|
262
263
|
changes: input.changes === "direct" ? "direct" : DEFAULT_CHANGES_MODE,
|
|
263
264
|
...input.storybook?.url ? { storybook: { url: input.storybook.url.trim().replace(/\/+$/, "") } } : {},
|
|
265
|
+
...input.library?.public === true ? { library: { public: true } } : {},
|
|
264
266
|
...input.audit ? { audit: { ...input.audit } } : {},
|
|
265
267
|
...input.visualImpact ? { visualImpact: { mode: input.visualImpact.mode === "on-demand" ? "on-demand" : "auto" } } : {},
|
|
266
268
|
...input.integrations ? { integrations: { ...input.integrations } } : {},
|
|
@@ -305,7 +307,7 @@ function loadConfig(source) {
|
|
|
305
307
|
if (!isObj(tokens)) problems.push('"tokens" must be an object');
|
|
306
308
|
else
|
|
307
309
|
for (const [k, v] of Object.entries(tokens)) {
|
|
308
|
-
if (FLAT_TOKEN_KEYS.includes(k) || k === "root") {
|
|
310
|
+
if (FLAT_TOKEN_KEYS.includes(k) || k === "root" || k === "usage") {
|
|
309
311
|
if (!isStr(v)) problems.push(`"tokens.${k}" must be a non-empty string`);
|
|
310
312
|
} else if (k === "include" || k === "exclude") {
|
|
311
313
|
if (!isStrList(v)) problems.push(`"tokens.${k}" must be a list of globs`);
|
|
@@ -380,6 +382,7 @@ function loadConfig(source) {
|
|
|
380
382
|
}
|
|
381
383
|
}
|
|
382
384
|
problems.push(...rightsProblems(gov.rights));
|
|
385
|
+
if (gov.soloOwnerCanApproveBoth !== void 0 && typeof gov.soloOwnerCanApproveBoth !== "boolean") problems.push('"governance.soloOwnerCanApproveBoth" must be true or false');
|
|
383
386
|
}
|
|
384
387
|
}
|
|
385
388
|
problems.push(...visualImpactProblems(d.visualImpact));
|
|
@@ -390,6 +393,14 @@ function loadConfig(source) {
|
|
|
390
393
|
else if (!/^https:\/\/[^\s/]+/.test(sb.url.trim())) problems.push('"storybook.url" must start with https://, for example https://storybook.example.com');
|
|
391
394
|
else for (const k of Object.keys(sb)) if (k !== "url") problems.push(`"storybook.${k}" is not a known key`);
|
|
392
395
|
}
|
|
396
|
+
const lib = d.library;
|
|
397
|
+
if (lib !== void 0) {
|
|
398
|
+
if (!isObj(lib)) problems.push('"library" must be an object, for example { "public": true }');
|
|
399
|
+
else {
|
|
400
|
+
if (lib.public !== void 0 && typeof lib.public !== "boolean") problems.push('"library.public" must be true or false');
|
|
401
|
+
for (const k of Object.keys(lib)) if (k !== "public") problems.push(`"library.${k}" is not a known key`);
|
|
402
|
+
}
|
|
403
|
+
}
|
|
393
404
|
problems.push(...productProblems(d.products));
|
|
394
405
|
const audit = d.audit;
|
|
395
406
|
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
|
+
"version": "0.3.9",
|
|
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.
|
|
50
|
+
"@bridge-ds/core": "^0.15.0",
|
|
51
51
|
"pixelmatch": "7.1.0",
|
|
52
52
|
"playwright-core": "1.63.0",
|
|
53
53
|
"pngjs": "7.0.0"
|