@tideworthy/tidysites 0.1.20 → 0.1.21

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 CHANGED
@@ -63,7 +63,7 @@ shows in `status`.
63
63
  Styling: a row's `.css` file is scoped to that row (every rule is prefixed with the row's own selector), so it cannot style the rest of the page; rules for the whole page, the sections and the theme's classes go in `business/business.css`.
64
64
 
65
65
  Images: an image field, a hero's image or a Columns image slot takes
66
- `{ "$media": { "url": "https://...", "alt": "what it shows" } }` (or `{ "$media": { "file": "assets/x.png", "alt": "..." } }` for a picture that exists only as a file in the folder, say an illustration drawn from the old page's inline SVG; the push carries its bytes; a `file` field, such as a row's `media` list or the Business font files, takes a video (mp4, webm, up to 40 MB), a font (woff2) or a pdf the same way) and the
66
+ `{ "$media": { "url": "https://...", "alt": "what it shows" } }` (or `{ "$media": { "file": "assets/x.png", "alt": "..." } }` for a picture that exists only as a file in the folder, say an illustration drawn from the old page's inline SVG; the push carries its bytes; a `file` field, such as a row's `media` list or the Business font files, takes a video (mp4, webm, up to 25 MB, the most one file of a published site may weigh), a font (woff2) or a pdf the same way) and the
67
67
  push fetches the file into the website's library; a file the library already
68
68
  holds (the same bytes) is reused, not added again. An image already in the
69
69
  library keeps the value the pull gave it.
package/bin/tidysites.mjs CHANGED
@@ -399,8 +399,8 @@ async function push(ctx) {
399
399
  }
400
400
 
401
401
  const MEDIA_TYPES = { png: 'image/png', jpg: 'image/jpeg', jpeg: 'image/jpeg', gif: 'image/gif', webp: 'image/webp', avif: 'image/avif', svg: 'image/svg+xml', ico: 'image/x-icon', mp4: 'video/mp4', m4v: 'video/mp4', webm: 'video/webm', mov: 'video/quicktime', woff2: 'font/woff2', woff: 'font/woff', ttf: 'font/ttf', otf: 'font/otf', pdf: 'application/pdf' };
402
- /** Pictures travel up to 15 MB; a video (a row's media list) up to 40 MB. */
403
- const mediaCap = (type) => (type.startsWith('video/') ? 40 : 15);
402
+ /** Pictures travel up to 15 MB; a video up to 25 MB, the most one file of a published site may weigh. */
403
+ const mediaCap = (type) => (type.startsWith('video/') ? 25 : 15);
404
404
  /** Every { "$media": { "file": ... } } in the document becomes { "$media": { "data", "type", "filename", "alt" } }, read from the folder. */
405
405
  function inlineMediaFiles(doc, dir) {
406
406
  const walk = (v) => {
@@ -414,7 +414,7 @@ function inlineMediaFiles(doc, dir) {
414
414
  const bytes = readFileSync(path);
415
415
  const ext = m.file.split('.').pop().toLowerCase();
416
416
  const type = MEDIA_TYPES[ext] ?? 'application/octet-stream';
417
- if (bytes.length > mediaCap(type) * 1024 * 1024) fail(`$media.file ${m.file}: ${(bytes.length / 1048576).toFixed(1)} MB; ${type.startsWith('video/') ? 'videos up to 40 MB' : 'pictures up to 15 MB'}`);
417
+ if (bytes.length > mediaCap(type) * 1024 * 1024) fail(`$media.file ${m.file}: ${(bytes.length / 1048576).toFixed(1)} MB; ${type.startsWith('video/') ? 'videos up to 25 MB (the most one file of a published site may weigh; re-encode it smaller)' : 'pictures up to 15 MB'}`);
418
418
  return { $media: { data: bytes.toString('base64'), type, filename: m.file.split('/').pop(), alt: typeof m.alt === 'string' ? m.alt : '' } };
419
419
  }
420
420
  return Object.fromEntries(Object.entries(v).map(([k, x]) => [k, walk(x)]));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tideworthy/tidysites",
3
- "version": "0.1.20",
3
+ "version": "0.1.21",
4
4
  "description": "Pull a Tidysites website to files, edit, validate against its content model, push it back, screenshot the result.",
5
5
  "type": "module",
6
6
  "bin": {