@taprootio/site-authoring 0.39.0 → 0.41.0
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 +62 -22
- package/examples/riverbend-wellness/manifest.fixture.json +1 -1
- package/examples/riverbend-wellness/settings/site-publishing-preferences.json +0 -10
- package/package.json +2 -2
- package/src/api.js +4 -5
- package/src/appearance-contract.js +64 -55
- package/src/changelog.json +33 -0
- package/src/cli.js +2 -2
- package/src/content/components.js +36 -2
- package/src/content/free-form-sections.js +2 -3
- package/src/content/testimonial-google-reviews.js +140 -10
- package/src/footer-brand-inputs.js +12 -5
- package/src/footer-branding.js +11 -5
- package/src/footer-content.js +10 -0
- package/src/footer-contract.js +52 -42
- package/src/footer-draft-hash.js +8 -27
- package/src/footer-workspace.js +4 -6
- package/src/header-presentation.js +13 -0
- package/src/logo-inputs.js +38 -0
- package/src/logo-surface-checks.js +67 -0
- package/src/presentation-reference.js +70 -62
- package/src/reference-help.js +3 -3
- package/src/setting-reference.js +15 -4
- package/src/settings-catalog.js +10 -3
- package/src/site-check-findings.js +31 -1
- package/src/site-check-rules.json +2 -1
- package/src/theme-contexts.js +82 -0
- package/src/theme-resolve.js +2 -2
- package/src/theme-validation.js +30 -13
- package/src/verbs/footer-push.js +9 -9
- package/src/verbs/plan.js +2 -2
- package/src/verbs/theme-push.js +46 -41
- package/src/verbs/validate.js +20 -10
- package/src/workspace-check.js +1 -1
- package/src/workspace.js +1 -1
package/src/theme-validation.js
CHANGED
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
|
|
12
12
|
import { hasControlCharacter, sanitizeDiagnostic, SiteAuthoringError } from "./errors.js";
|
|
13
13
|
import { loadEspalierShared } from "./espalier-shared.js";
|
|
14
|
+
import { sharedDeclaredThemeContextNames, sharedEncodedThemeContextNames } from "./theme-contexts.js";
|
|
14
15
|
import { proposePassingValues, refuseUnavailableFontWeights } from "./theme-proposals.js";
|
|
15
16
|
|
|
16
17
|
export const MAXIMUM_THEME_WARNINGS = 32;
|
|
@@ -99,19 +100,35 @@ export const HEADER_BRAND_COLOR_TOKENS = Object.freeze(
|
|
|
99
100
|
]),
|
|
100
101
|
);
|
|
101
102
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
103
|
+
/** Validate the complete post-save state, including an atomic repoint and context removal. */
|
|
104
|
+
export function requireSurfaceContexts({ lightTheme, darkTheme, headerContext = "", footerContext = "" }, current) {
|
|
105
|
+
const declared = new Set(sharedDeclaredThemeContextNames(lightTheme, darkTheme));
|
|
106
|
+
const previous = current === undefined ? new Set() : new Set(sharedEncodedThemeContextNames(
|
|
107
|
+
current.styleSettings?.lightTheme,
|
|
108
|
+
current.styleSettings?.darkTheme,
|
|
109
|
+
));
|
|
110
|
+
for (
|
|
111
|
+
const [surface, field, context, stored] of [
|
|
112
|
+
["header", "site-header.context", headerContext, current?.headerSettings?.context ?? ""],
|
|
113
|
+
[
|
|
114
|
+
"footer",
|
|
115
|
+
"footerSettings.context",
|
|
116
|
+
footerContext,
|
|
117
|
+
current?.sitePublishingPreferences?.footerSettings?.context ?? "",
|
|
118
|
+
],
|
|
119
|
+
]
|
|
120
|
+
) {
|
|
121
|
+
if (context === "" || declared.has(context)) continue;
|
|
122
|
+
const removingUsedContext = context === stored && previous.has(context);
|
|
123
|
+
fail(
|
|
124
|
+
removingUsedContext ? "theme.context_in_use" : "settings.context_unknown",
|
|
125
|
+
removingUsedContext
|
|
126
|
+
? `The ${surface} still uses context '${context}'. Keep it in both themes, or repoint the ${surface} in this same theme push.`
|
|
127
|
+
: `${field} must be empty or name a context declared by both lightTheme and darkTheme.`,
|
|
128
|
+
field,
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
115
132
|
|
|
116
133
|
export const APPEARANCE_COLOR_CONSTRAINT = Object.freeze({
|
|
117
134
|
maximumLength: 128,
|
package/src/verbs/footer-push.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { PRESENTATION_REVISION, saveSiteFooterSettings, withRefusalGuidance } from "../api.js";
|
|
2
2
|
import { VERB_FOOTER_PUSH } from "../constants.js";
|
|
3
3
|
import { SiteAuthoringError } from "../errors.js";
|
|
4
|
+
import { FOOTER_PRESENTATION_FIELDS, projectFooterContent } from "../footer-content.js";
|
|
4
5
|
import { projectFooterSettingsForWorkspace, validateFooterDocument } from "../footer-contract.js";
|
|
5
6
|
import { computeFooterDraftHash } from "../footer-draft-hash.js";
|
|
6
7
|
import { readFooterBrandInputs } from "../footer-brand-inputs.js";
|
|
@@ -94,7 +95,7 @@ export async function footerPush(invocation) {
|
|
|
94
95
|
await saveSiteFooterSettings(
|
|
95
96
|
client,
|
|
96
97
|
siteId,
|
|
97
|
-
footerSettings,
|
|
98
|
+
projectFooterContent(footerSettings),
|
|
98
99
|
context.footer.expectedDraftHash,
|
|
99
100
|
));
|
|
100
101
|
} catch (error) {
|
|
@@ -113,6 +114,10 @@ export async function footerPush(invocation) {
|
|
|
113
114
|
let footerDraftHash;
|
|
114
115
|
try {
|
|
115
116
|
saved = projectFooterSettingsForWorkspace(response.footerSettings);
|
|
117
|
+
for (const field of FOOTER_PRESENTATION_FIELDS) {
|
|
118
|
+
if (Object.hasOwn(footerSettings, field)) saved[field] = footerSettings[field];
|
|
119
|
+
else delete saved[field];
|
|
120
|
+
}
|
|
116
121
|
footerDraftHash = computeFooterDraftHash(saved);
|
|
117
122
|
const nextDocument = structuredClone(document_);
|
|
118
123
|
nextDocument.settings.footerSettings = saved;
|
|
@@ -120,14 +125,9 @@ export async function footerPush(invocation) {
|
|
|
120
125
|
// fails, a stale token prevents the next push from overwriting the saved
|
|
121
126
|
// remote footer and the completed-write report tells the caller to pull.
|
|
122
127
|
await writeWorkspaceJson(config.workspaceDir, FOOTER_SETTINGS_FILE, nextDocument);
|
|
123
|
-
//
|
|
124
|
-
//
|
|
125
|
-
//
|
|
126
|
-
// revision is the one this workspace was pulled at: otherwise the site's
|
|
127
|
-
// appearance moved since the pull, the workspace's appearance files do not
|
|
128
|
-
// reflect it, and a baseline taken from this save would let the next
|
|
129
|
-
// theme push overwrite those edits unseen. A Taproot that predates the
|
|
130
|
-
// fields leaves the recorded baseline alone.
|
|
128
|
+
// Content saves report the stored presentation revision in both fields.
|
|
129
|
+
// An equal revision is a no-op; it cannot adopt newer appearance edits
|
|
130
|
+
// that this workspace has never read. Older servers may omit the fields.
|
|
131
131
|
const baseline = readPresentationBaseline(context.manifest);
|
|
132
132
|
const reported = PRESENTATION_REVISION.test(response.presentationRevision ?? "")
|
|
133
133
|
&& PRESENTATION_REVISION.test(response.previousPresentationRevision ?? "");
|
package/src/verbs/plan.js
CHANGED
|
@@ -100,7 +100,7 @@ const STEP_REASONS = Object.freeze({
|
|
|
100
100
|
[PLAN_STEP.media]: "Pages resolve their media references against the uploads this step records.",
|
|
101
101
|
[PLAN_STEP.pages]: "Navigation and the footer can point only at pages the site already holds.",
|
|
102
102
|
[PLAN_STEP.footer]: "theme push refuses while the footer document carries unsaved content.",
|
|
103
|
-
[PLAN_STEP.theme]: "The theme saves the footer
|
|
103
|
+
[PLAN_STEP.theme]: "The theme saves the footer context with the rest of the presentation.",
|
|
104
104
|
[PLAN_STEP.navigation]: "Navigation replaces the whole tree, so it goes last, once its targets exist.",
|
|
105
105
|
});
|
|
106
106
|
const READY = "ready";
|
|
@@ -468,7 +468,7 @@ function planReport(planned) {
|
|
|
468
468
|
checked: [
|
|
469
469
|
"every page source, against the live site's pages, revisions, video library, and the forms it places",
|
|
470
470
|
"media under media/ that pages reference and media upload has not sent",
|
|
471
|
-
"the theme, appearance, and
|
|
471
|
+
"the theme, appearance, and surface contexts, against the site's presentation revision",
|
|
472
472
|
"the footer document, against the site's footer draft and the pages it still holds",
|
|
473
473
|
"every image the theme and footer name, and every recorded upload, against the site's images",
|
|
474
474
|
"navigation shape and page targets, against the live page list and navigation",
|
package/src/verbs/theme-push.js
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { getSitePresentation, saveSitePresentation, withRefusalGuidance } from "../api.js";
|
|
2
2
|
import {
|
|
3
|
-
|
|
3
|
+
APPEARANCE_FOOTER_FIELDS,
|
|
4
4
|
APPEARANCE_SCALAR_FIELDS,
|
|
5
5
|
appearanceScalarInput,
|
|
6
6
|
buildAppearanceScalarOperations,
|
|
7
|
-
|
|
7
|
+
footerPresentationOverlay,
|
|
8
8
|
} from "../appearance-contract.js";
|
|
9
9
|
import { REFUSAL_UNCLASSIFIED, VERB_THEME_PUSH } from "../constants.js";
|
|
10
10
|
import { MISSING_SETTING_MESSAGE, SiteAuthoringError } from "../errors.js";
|
|
11
11
|
import { projectFooterSettingsForWorkspace } from "../footer-contract.js";
|
|
12
|
-
import { computeFooterDraftHash } from "../footer-draft-hash.js";
|
|
13
12
|
import {
|
|
14
13
|
advanceFooterManifest,
|
|
15
14
|
clearPendingPresentationSave,
|
|
@@ -30,7 +29,7 @@ import {
|
|
|
30
29
|
SETTINGS_TYPE_SITE_PUBLISHING_PREFERENCES,
|
|
31
30
|
SETTINGS_TYPE_TAPROOT_STYLES,
|
|
32
31
|
} from "../settings-catalog.js";
|
|
33
|
-
import { missingThemeFields, validateAndLintThemePair } from "../theme-validation.js";
|
|
32
|
+
import { missingThemeFields, requireSurfaceContexts, validateAndLintThemePair } from "../theme-validation.js";
|
|
34
33
|
import { ApiError } from "../transport.js";
|
|
35
34
|
import {
|
|
36
35
|
readWorkspaceJson,
|
|
@@ -112,8 +111,14 @@ export function requireNoMissingSettings(missing) {
|
|
|
112
111
|
);
|
|
113
112
|
}
|
|
114
113
|
|
|
115
|
-
/**
|
|
116
|
-
export async function validateThemeWorkspace(
|
|
114
|
+
/** Offline callers validate context names here; push waits for the current state to classify removals. */
|
|
115
|
+
export async function validateThemeWorkspace(
|
|
116
|
+
workspaceDir,
|
|
117
|
+
siteId,
|
|
118
|
+
knownImageIds,
|
|
119
|
+
expectedEntityIds,
|
|
120
|
+
{ deferContextValidation = false } = {},
|
|
121
|
+
) {
|
|
117
122
|
const [style, brand, header, publishing] = await Promise.all([
|
|
118
123
|
readSettingsDocument(
|
|
119
124
|
workspaceDir,
|
|
@@ -146,8 +151,8 @@ export async function validateThemeWorkspace(workspaceDir, siteId, knownImageIds
|
|
|
146
151
|
[SETTINGS_TYPE_SITE_HEADER]: header,
|
|
147
152
|
};
|
|
148
153
|
// Preflight the complete required-key inventory before any value validator
|
|
149
|
-
// can stop at a malformed value in an earlier group. Optional
|
|
150
|
-
//
|
|
154
|
+
// can stop at a malformed value in an earlier group. Optional presentation
|
|
155
|
+
// fields retain their empty default.
|
|
151
156
|
const missing = missingThemeSettings(style);
|
|
152
157
|
for (const definition of APPEARANCE_SCALAR_FIELDS) {
|
|
153
158
|
if (!definition.optional && !Object.hasOwn(documents[definition.settingsType], definition.name)) {
|
|
@@ -162,18 +167,26 @@ export async function validateThemeWorkspace(workspaceDir, siteId, knownImageIds
|
|
|
162
167
|
}
|
|
163
168
|
}
|
|
164
169
|
requireNoMissingSettings(missing);
|
|
170
|
+
const footerPresentation = footerPresentationOverlay(publishing.footerSettings);
|
|
171
|
+
if (!deferContextValidation) {
|
|
172
|
+
requireSurfaceContexts({
|
|
173
|
+
lightTheme: style.lightTheme,
|
|
174
|
+
darkTheme: style.darkTheme,
|
|
175
|
+
headerContext: header.context,
|
|
176
|
+
footerContext: footerPresentation.context,
|
|
177
|
+
});
|
|
178
|
+
}
|
|
165
179
|
const themes = await validateAndLintThemePair(style.lightTheme, style.darkTheme);
|
|
166
180
|
const scalarOperations = buildAppearanceScalarOperations(
|
|
167
181
|
documents,
|
|
168
182
|
knownImageIds,
|
|
169
183
|
);
|
|
170
|
-
|
|
171
|
-
return { style, brand, header, publishing, themes, scalarOperations, footerColors };
|
|
184
|
+
return { style, brand, header, publishing, themes, scalarOperations, footerPresentation };
|
|
172
185
|
}
|
|
173
186
|
|
|
174
187
|
/**
|
|
175
188
|
* The change set the atomic save receives: every appearance scalar in
|
|
176
|
-
* registry order, then the two encoded themes, plus the
|
|
189
|
+
* registry order, then the two encoded themes, plus the footer presentation fields.
|
|
177
190
|
*/
|
|
178
191
|
function buildChangeSet(validated) {
|
|
179
192
|
return {
|
|
@@ -189,7 +202,8 @@ function buildChangeSet(validated) {
|
|
|
189
202
|
value: setting === "lightTheme" ? validated.themes.light : validated.themes.dark,
|
|
190
203
|
})),
|
|
191
204
|
],
|
|
192
|
-
|
|
205
|
+
footerContext: validated.footerPresentation.context,
|
|
206
|
+
footerLogoVariant: validated.footerPresentation.logoVariant,
|
|
193
207
|
};
|
|
194
208
|
}
|
|
195
209
|
|
|
@@ -226,14 +240,6 @@ function translateSaveRefusal(error) {
|
|
|
226
240
|
{ field: "revision", status: error.status },
|
|
227
241
|
);
|
|
228
242
|
}
|
|
229
|
-
if (error instanceof ApiError && error.hasField("ExpectedFooterDraftHash")) {
|
|
230
|
-
return new SiteAuthoringError(
|
|
231
|
-
"theme.footer_concurrent_modification",
|
|
232
|
-
"The footer document changed between this push's read and its save, so the push was refused and nothing was "
|
|
233
|
-
+ "written. Run 'taproot-site theme push' again; it re-reads the footer before saving.",
|
|
234
|
-
{ field: "expectedFooterDraftHash", status: error.status },
|
|
235
|
-
);
|
|
236
|
-
}
|
|
237
243
|
return translateServerSupport(error, "save");
|
|
238
244
|
}
|
|
239
245
|
|
|
@@ -261,15 +267,11 @@ function ownedDocuments(validated, presentation) {
|
|
|
261
267
|
});
|
|
262
268
|
const scalarNames = (settingsType) =>
|
|
263
269
|
APPEARANCE_SCALAR_FIELDS.filter((field) => field.settingsType === settingsType).map((field) => field.name);
|
|
264
|
-
const
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
colors[definition.scheme][definition.name] = scheme[definition.name] ?? "";
|
|
270
|
-
}
|
|
271
|
-
return { footerSettings: colors };
|
|
272
|
-
};
|
|
270
|
+
const footerPresentation = footer => ({
|
|
271
|
+
footerSettings: Object.fromEntries(
|
|
272
|
+
APPEARANCE_FOOTER_FIELDS.map(field => [field.name, footer?.[field.name] ?? field.default]),
|
|
273
|
+
),
|
|
274
|
+
});
|
|
273
275
|
return [
|
|
274
276
|
owned(
|
|
275
277
|
SETTINGS_TYPE_TAPROOT_STYLES,
|
|
@@ -286,8 +288,8 @@ function ownedDocuments(validated, presentation) {
|
|
|
286
288
|
),
|
|
287
289
|
{
|
|
288
290
|
file: `${SETTINGS_DIRECTORY}/${SETTINGS_FILES[SETTINGS_TYPE_SITE_PUBLISHING_PREFERENCES]}`,
|
|
289
|
-
local:
|
|
290
|
-
remote:
|
|
291
|
+
local: footerPresentation(validated.publishing.footerSettings),
|
|
292
|
+
remote: footerPresentation(projected[SETTINGS_TYPE_SITE_PUBLISHING_PREFERENCES].footerSettings),
|
|
291
293
|
},
|
|
292
294
|
];
|
|
293
295
|
}
|
|
@@ -343,6 +345,12 @@ export async function comparePresentation(client, siteId, validated, manifest) {
|
|
|
343
345
|
} catch (error) {
|
|
344
346
|
throw translateServerSupport(error, "read");
|
|
345
347
|
}
|
|
348
|
+
requireSurfaceContexts({
|
|
349
|
+
lightTheme: validated.style.lightTheme,
|
|
350
|
+
darkTheme: validated.style.darkTheme,
|
|
351
|
+
headerContext: validated.header.context,
|
|
352
|
+
footerContext: validated.footerPresentation.context,
|
|
353
|
+
}, current);
|
|
346
354
|
const stale = baseline !== undefined && baseline.revision !== current.revision;
|
|
347
355
|
// A save this workspace sent and never heard back from (TR00807). When the
|
|
348
356
|
// change set about to go is the same one, a moved revision is not evidence
|
|
@@ -383,11 +391,13 @@ export async function themePush(invocation) {
|
|
|
383
391
|
config.workspaceDir,
|
|
384
392
|
siteId,
|
|
385
393
|
appearanceContext.knownImageIds,
|
|
394
|
+
undefined,
|
|
395
|
+
{ deferContextValidation: true },
|
|
386
396
|
);
|
|
387
397
|
const { publishing, themes, scalarOperations } = validated;
|
|
388
398
|
// The save's response replaces the workspace footer document, so refuse
|
|
389
399
|
// while it still carries footer-content edits that footer push has not
|
|
390
|
-
// saved.
|
|
400
|
+
// saved. Context-only differences are theme push's own to write.
|
|
391
401
|
requireFooterContentPushed(appearanceContext.footer, publishing.footerSettings);
|
|
392
402
|
const baseline = readPresentationBaseline(appearanceContext.manifest);
|
|
393
403
|
if (!dryRun && baseline === undefined) {
|
|
@@ -408,7 +418,7 @@ export async function themePush(invocation) {
|
|
|
408
418
|
};
|
|
409
419
|
|
|
410
420
|
// The fresh read serves both modes: the dry run compares against it, and
|
|
411
|
-
// the push
|
|
421
|
+
// the push checks the complete post-save context state. Nothing before
|
|
412
422
|
// this point, and nothing in a dry run after it, writes to the site.
|
|
413
423
|
const comparison = await withRefusalGuidance(
|
|
414
424
|
onProgress,
|
|
@@ -490,16 +500,11 @@ export async function themePush(invocation) {
|
|
|
490
500
|
});
|
|
491
501
|
}
|
|
492
502
|
|
|
493
|
-
// The footer token comes from the read just made: the server overlays the
|
|
494
|
-
// colours onto the document it holds now. On a replay of a committed save
|
|
495
|
-
// the site is already current and the token is not consulted.
|
|
496
|
-
const currentFooter = current.sitePublishingPreferences?.footerSettings ?? {};
|
|
497
503
|
let saved;
|
|
498
504
|
try {
|
|
499
505
|
saved = await withRefusalGuidance(onProgress, "theme push", async () =>
|
|
500
506
|
await saveSitePresentation(client, siteId, {
|
|
501
507
|
expectedRevision,
|
|
502
|
-
expectedFooterDraftHash: computeFooterDraftHash(currentFooter),
|
|
503
508
|
...changeSet,
|
|
504
509
|
}));
|
|
505
510
|
} catch (error) {
|
|
@@ -519,7 +524,7 @@ export async function themePush(invocation) {
|
|
|
519
524
|
// record is what lets the next run of the same change set be answered as
|
|
520
525
|
// already current instead of refused as someone else's edit.
|
|
521
526
|
if (
|
|
522
|
-
error instanceof ApiError &&
|
|
527
|
+
error instanceof ApiError && error.hasField("ExpectedRevision")
|
|
523
528
|
) {
|
|
524
529
|
await clearPendingPresentationSave(config.workspaceDir, siteId);
|
|
525
530
|
} else {
|
|
@@ -560,13 +565,13 @@ export async function themePush(invocation) {
|
|
|
560
565
|
});
|
|
561
566
|
onProgress(
|
|
562
567
|
applied
|
|
563
|
-
? "Saved the complete presentation in one transaction:
|
|
568
|
+
? "Saved the complete presentation in one transaction: surface contexts and logo choices, appearance settings, and both "
|
|
564
569
|
+ "themes; Brand & Style now treats the color model as externally managed."
|
|
565
570
|
: "The site already held this presentation; nothing was written and the baseline was refreshed.",
|
|
566
571
|
);
|
|
567
572
|
|
|
568
573
|
const written = [
|
|
569
|
-
|
|
574
|
+
...APPEARANCE_FOOTER_FIELDS.map(field => `footerSettings.${field.name}`),
|
|
570
575
|
...scalarOperations.map((operation) => `${operation.settingsType}.${operation.setting}`),
|
|
571
576
|
...THEME_SETTINGS.map((setting) => `${SETTINGS_TYPE_TAPROOT_STYLES}.${setting}`),
|
|
572
577
|
];
|
package/src/verbs/validate.js
CHANGED
|
@@ -16,6 +16,8 @@ import {
|
|
|
16
16
|
FIXTURE_ROOT_FIELDS,
|
|
17
17
|
} from "../fixture-contract.js";
|
|
18
18
|
import { initializeFixture } from "../fixture-init.js";
|
|
19
|
+
import { evaluateLogoSurfaceChecks } from "../logo-surface-checks.js";
|
|
20
|
+
import { loadThemeEngines } from "../theme-resolve.js";
|
|
19
21
|
import { readFooterBrandInputs } from "../footer-brand-inputs.js";
|
|
20
22
|
import { buildFooterFitInput } from "../footer-fit.js";
|
|
21
23
|
import { appearanceManifestEntry, footerManifestEntry } from "../footer-workspace.js";
|
|
@@ -26,6 +28,7 @@ import { isRedirectMapRevision, REDIRECT_KIND_GONE, REDIRECTS_FILE_NAME } from "
|
|
|
26
28
|
import { boundedList, openSession, successResult } from "../session.js";
|
|
27
29
|
import {
|
|
28
30
|
evaluateOfflineSiteChecks,
|
|
31
|
+
mergeOfflineSiteChecks,
|
|
29
32
|
IMAGE_CHECK_DIRECTORY_ARGUMENT,
|
|
30
33
|
IMAGE_CHECK_DOCS_SITE,
|
|
31
34
|
IMAGE_CHECK_NOT_REQUESTED,
|
|
@@ -684,11 +687,11 @@ function pageHints(checked, onProgress) {
|
|
|
684
687
|
* The offline site checks (TR01085) over the planned pages: the rules the shared
|
|
685
688
|
* catalogue lists for `validate`, with the rest named as checked by the site.
|
|
686
689
|
*/
|
|
687
|
-
async function offlineSiteChecks(checked, manifest, onProgress, imageCheck, workspaceDir) {
|
|
690
|
+
async function offlineSiteChecks(checked, manifest, onProgress, imageCheck, workspaceDir, loadLogoEngines) {
|
|
688
691
|
const footerInput = checked.footer === undefined
|
|
689
692
|
? undefined
|
|
690
693
|
: buildFooterFitInput(checked.footer.footerSettings, await readFooterBrandInputs(workspaceDir, checked.footer.footerSettings));
|
|
691
|
-
|
|
694
|
+
const evaluated = evaluateOfflineSiteChecks({
|
|
692
695
|
planned: checked.settingsOnly ? [] : checked.pages?.planned,
|
|
693
696
|
footerInput,
|
|
694
697
|
footerOnly: checked.settingsOnly,
|
|
@@ -698,6 +701,13 @@ async function offlineSiteChecks(checked, manifest, onProgress, imageCheck, work
|
|
|
698
701
|
imageCheck,
|
|
699
702
|
onProgress,
|
|
700
703
|
});
|
|
704
|
+
const logos = await evaluateLogoSurfaceChecks({
|
|
705
|
+
styles: checked.presentation?.style,
|
|
706
|
+
header: checked.presentation?.header,
|
|
707
|
+
footer: checked.footer?.footerSettings,
|
|
708
|
+
onProgress,
|
|
709
|
+
}, { loadEngines: loadLogoEngines });
|
|
710
|
+
return mergeOfflineSiteChecks(evaluated, logos);
|
|
701
711
|
}
|
|
702
712
|
|
|
703
713
|
/**
|
|
@@ -742,12 +752,12 @@ function emptyBlock(pages) {
|
|
|
742
752
|
};
|
|
743
753
|
}
|
|
744
754
|
|
|
745
|
-
export async function validateFixture(invocation = {}) {
|
|
755
|
+
export async function validateFixture(invocation = {}, { loadLogoEngines = loadThemeEngines } = {}) {
|
|
746
756
|
// Refused before any file is read: a directory, or a fixture to export, has no site to read.
|
|
747
757
|
if (invocation.fromSite === true && (invocation.init || invocation.fixturePath !== undefined)) {
|
|
748
758
|
throw siteNeedsWorkspaceError(Boolean(invocation.init));
|
|
749
759
|
}
|
|
750
|
-
if (invocation.init) return await initializeFixture(invocation, validateFixture);
|
|
760
|
+
if (invocation.init) return await initializeFixture(invocation, next => validateFixture(next, { loadLogoEngines }));
|
|
751
761
|
const onProgress = typeof invocation.onProgress === "function" ? invocation.onProgress : () => {};
|
|
752
762
|
const cwd = invocation.cwd ?? process.cwd();
|
|
753
763
|
if (invocation.fixturePath === undefined) {
|
|
@@ -759,7 +769,7 @@ export async function validateFixture(invocation = {}) {
|
|
|
759
769
|
"siteId",
|
|
760
770
|
);
|
|
761
771
|
}
|
|
762
|
-
return await validatePulledWorkspace(config.workspaceDir, config.siteId, invocation, onProgress, { config });
|
|
772
|
+
return await validatePulledWorkspace(config.workspaceDir, config.siteId, invocation, onProgress, { config, loadLogoEngines });
|
|
763
773
|
}
|
|
764
774
|
const fixtureRoot = await resolveFixtureRoot(cwd, invocation.fixturePath);
|
|
765
775
|
if (
|
|
@@ -770,7 +780,7 @@ export async function validateFixture(invocation = {}) {
|
|
|
770
780
|
if (!isCanonicalUuid(siteId)) {
|
|
771
781
|
fail("workspace.manifest_invalid", `${MANIFEST_FILE_NAME} does not record a canonical site id.`, "siteId");
|
|
772
782
|
}
|
|
773
|
-
return await validatePulledWorkspace(fixtureRoot, siteId, invocation, onProgress, { directoryArgument: true });
|
|
783
|
+
return await validatePulledWorkspace(fixtureRoot, siteId, invocation, onProgress, { directoryArgument: true, loadLogoEngines });
|
|
774
784
|
}
|
|
775
785
|
|
|
776
786
|
onProgress(`Reading ${FIXTURE_MANIFEST_FILE_NAME}.`);
|
|
@@ -834,7 +844,7 @@ export async function validateFixture(invocation = {}) {
|
|
|
834
844
|
...autolinkWarnings(checked.pages?.planned, onProgress),
|
|
835
845
|
...descriptionWarnings(checked.pages?.planned, onProgress),
|
|
836
846
|
...authorWarnings(checked.pages?.planned, onProgress),
|
|
837
|
-
...await offlineSiteChecks(checked, manifest, onProgress, imageCheckSkipped(IMAGE_CHECK_DIRECTORY_ARGUMENT), fixtureRoot),
|
|
847
|
+
...await offlineSiteChecks(checked, manifest, onProgress, imageCheckSkipped(IMAGE_CHECK_DIRECTORY_ARGUMENT), fixtureRoot, loadLogoEngines),
|
|
838
848
|
};
|
|
839
849
|
onProgress(
|
|
840
850
|
`Validated ${validatedPages.length} page(s), ${checked.navigation.items} navigation item(s), two themes, appearance, and footer without credentials or mutation.`,
|
|
@@ -876,7 +886,7 @@ export async function validateFixture(invocation = {}) {
|
|
|
876
886
|
* runs before it sends anything, for every page and setting at once, against
|
|
877
887
|
* what the manifests recorded at the pull — no credential and no request.
|
|
878
888
|
*/
|
|
879
|
-
async function validatePulledWorkspace(workspaceDir, siteId, invocation, onProgress, { config, directoryArgument = false }) {
|
|
889
|
+
async function validatePulledWorkspace(workspaceDir, siteId, invocation, onProgress, { config, directoryArgument = false, loadLogoEngines }) {
|
|
880
890
|
onProgress(`Reading ${MANIFEST_FILE_NAME}.`);
|
|
881
891
|
const manifest = await readManifest(workspaceDir, siteId);
|
|
882
892
|
const mediaManifest = await readMediaManifest(workspaceDir, siteId);
|
|
@@ -905,9 +915,9 @@ async function validatePulledWorkspace(workspaceDir, siteId, invocation, onProgr
|
|
|
905
915
|
...descriptionWarnings(checked.pages.planned, onProgress),
|
|
906
916
|
...authorWarnings(checked.pages.planned, onProgress),
|
|
907
917
|
}),
|
|
908
|
-
...await offlineSiteChecks(checked, manifest, onProgress, site.imageCheck, workspaceDir),
|
|
918
|
+
...await offlineSiteChecks(checked, manifest, onProgress, site.imageCheck, workspaceDir, loadLogoEngines),
|
|
909
919
|
};
|
|
910
|
-
// Docs
|
|
920
|
+
// The Docs settings checks do not own the skipped image reason reported by --site.
|
|
911
921
|
const docsReason = checked.settingsOnly && invocation.fromSite === true
|
|
912
922
|
? {
|
|
913
923
|
imageCheckReason: {
|
package/src/workspace-check.js
CHANGED
|
@@ -68,7 +68,7 @@ export async function checkWorkspace({
|
|
|
68
68
|
?? await collectProblems(problems, { area: CHECK_AREA.presentation }, async () =>
|
|
69
69
|
(await readAppearanceWorkspaceContext(workspaceDir, siteId)).knownImageIds);
|
|
70
70
|
|
|
71
|
-
onProgress("Validating the complete light/dark theme, appearance, header, brand, and
|
|
71
|
+
onProgress("Validating the complete light/dark theme, appearance, header, brand, and surface contexts.");
|
|
72
72
|
const presentation = knownImageIds === undefined
|
|
73
73
|
? undefined
|
|
74
74
|
: await collectProblems(problems, { area: CHECK_AREA.presentation }, async () =>
|
package/src/workspace.js
CHANGED
|
@@ -156,7 +156,7 @@ export function internalPageObservedRevisionFile(pageId) {
|
|
|
156
156
|
// classified pulled files but recorded no registry. The package is in-repo and
|
|
157
157
|
// its manifests are workspace state, so an older one is re-pulled rather than
|
|
158
158
|
// migrated.
|
|
159
|
-
export const MANIFEST_VERSION =
|
|
159
|
+
export const MANIFEST_VERSION = 8;
|
|
160
160
|
|
|
161
161
|
/**
|
|
162
162
|
* The shape of a page body revision as the site reports it: a scheme name and
|