@tideworthy/tidysites 0.1.2 → 0.1.3

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
@@ -22,7 +22,7 @@ nothing else; it lives in `.tidysites/key`, which is kept out of git.
22
22
  | `tidysites status` | what changed here since the pull |
23
23
  | `tidysites validate` | every file against the content model, with the file and the field in each message |
24
24
  | `tidysites push [--prune] [--force] [--dry] [--only pages]` | validate, then write the created and updated entries back (with `--prune`, delete the entries whose files are gone), then pull |
25
- | `tidysites shot <path or url> [--mobile] [--desktop] [--first-screen] [--live]` | a screenshot of a page of the preview site, the live site, or any address, saved under `.tidysites/shots/` |
25
+ | `tidysites shot <path or url> [--mobile] [--tablet] [--desktop] [--wide] [--all] [--first-screen] [--live]` | a screenshot of a page of the preview site, the live site, or any address, saved under `.tidysites/shots/`; none of the width flags means desktop and mobile; a port compares all four |
26
26
  | `tidysites pages` | every address the website renders |
27
27
  | `tidysites page <path> [--html]` | the rendered page, section by section, with the key each section carries |
28
28
  | `tidysites schema [type or collection]` | the section types and layouts, or one type's or collection's fields |
@@ -82,4 +82,4 @@ names its own in `header_row`.
82
82
  3. `frame/frame.json` for the top bar, the call bar, the footer headings, the wording; `menus/primary.json` and `menus/footer.json` for the menus (an item with `children` is a dropdown).
83
83
  4. Pages as sections: `pages/<slug>.json`, each a list in `data.sections`. Columns is the section for a band with no record behind it.
84
84
  5. The look: brand colours and fonts on the Business record, `business/business.css` for what the tokens cannot say. The theme's own rules are written as `.ts.ts-accent` and `.ts.ts-ink .ts-prose a`, so a rule of yours needs the same weight (`.ts.ts-accent …`) to win.
85
- 6. `tidysites validate`, `tidysites push`, `tidysites shot /` and `tidysites shot / --mobile`, and look.
85
+ 6. `tidysites validate`, `tidysites push`, `tidysites shot / --all`, and look at every width: a design often shows a different header above 1440px.
package/bin/tidysites.mjs CHANGED
@@ -7,7 +7,7 @@
7
7
  * status what changed here since the pull
8
8
  * validate check the files against the content model
9
9
  * push [--prune] [--force] [--dry] write the changes back, then pull
10
- * shot <path|url> [--mobile|--desktop] [--first-screen] screenshot to .tidysites/shots
10
+ * shot <path|url> [--mobile] [--tablet] [--desktop] [--wide] [--all] [--first-screen] screenshot to .tidysites/shots (none = desktop and mobile)
11
11
  * pages every address the website renders
12
12
  * page <path> [--html] the rendered page, section by section
13
13
  * schema [name] section types and layouts, or one type's or collection's fields
@@ -357,7 +357,9 @@ async function push(ctx) {
357
357
 
358
358
  async function shot(ctx, target = positional[0] ?? '/', opts = {}) {
359
359
  const isUrl = /^https?:\/\//.test(target);
360
- const view = flags.mobile ? 'mobile' : flags.desktop ? 'desktop' : (opts.view ?? 'both');
360
+ // --desktop, --mobile, --tablet, --wide, any of them together; --all for every width; none = desktop and mobile.
361
+ const picked = ['desktop', 'mobile', 'tablet', 'wide'].filter((v) => flags[v]);
362
+ const view = flags.all ? 'all' : picked.length ? picked.join(',') : (opts.view ?? 'both');
361
363
  const args = { site_id: ctx.cfg.site, view, full_page: !(flags['first-screen'] || opts.firstScreen), ...(isUrl ? { url: target } : { path: target, site: flags.live ? 'live' : 'preview' }) };
362
364
  const { json, images } = await tool(ctx.cfg, 'screenshot_website', args);
363
365
  const outDir = join(ctx.dir, META, 'shots');
@@ -366,7 +368,7 @@ async function shot(ctx, target = positional[0] ?? '/', opts = {}) {
366
368
  const base = (opts.name ?? (isUrl ? new URL(target).hostname + new URL(target).pathname : target)).replace(/[^a-z0-9]+/gi, '-').replace(/^-|-$/g, '') || 'home';
367
369
  const named = Array.isArray(json?.captures) ? json.captures : [];
368
370
  images.forEach((img, i) => {
369
- const v = named[i]?.view ?? (view === 'both' ? ['desktop', 'mobile'][i] : view);
371
+ const v = named[i]?.view ?? (view === 'both' ? ['desktop', 'mobile'][i] : view === 'all' ? ['desktop', 'mobile', 'tablet', 'wide'][i] : view.split(',')[i] ?? view);
370
372
  const p = join(outDir, `${base}-${v}-${stamp}.${img.mimeType.includes('png') ? 'png' : 'jpg'}`);
371
373
  writeFileSync(p, Buffer.from(img.base64, 'base64'));
372
374
  say(relative(process.cwd(), p));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tideworthy/tidysites",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
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": {