@vdaluz/astro-og-cards 1.1.2 → 1.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
@@ -63,7 +63,7 @@ import { generateCard } from '@vdaluz/astro-og-cards';
63
63
  const png = await generateCard(inlineStyledHtml); // Buffer, 1200x630 PNG
64
64
  ```
65
65
 
66
- `markup` must use **inline styles, not `<style>` blocks or CSS classes** - `satori-html` (the HTML-to-Satori adapter) only reads inline styles. A hand-designed card with `<style>` + classes needs manual translation to inline styles first; see `src/assets/fixtures/imperfectSystemsCard.ts` for a worked example (imperfectsystems.com's real default card, translated).
66
+ `markup` must use **inline styles, not `<style>` blocks or CSS classes** - `satori-html` (the HTML-to-Satori adapter) only reads inline styles. A hand-designed card with `<style>` + classes needs manual translation to inline styles first; see `fixtures/imperfectSystemsCard.ts` for a worked example (imperfectsystems.com's real default card, translated).
67
67
 
68
68
  ### Example
69
69
 
@@ -77,7 +77,7 @@ Bundles a default static (non-variable) font, [Space Mono](https://github.com/go
77
77
 
78
78
  - **Use `sharp` for SVG->PNG, not `@resvg/resvg-js`.** resvg-js 2.6.2 (latest stable as of writing) native-panics (uncatchable Rust abort, not a JS exception) on Satori's `feDropShadow`/`feGaussianBlur` filter output - i.e. any `box-shadow` or `text-shadow` in the source markup. Confirmed via binary search against a real shadow-bearing design; independent of shadow color format (hex vs `rgba()`).
79
79
  - **Variable fonts fail to parse.** Satori's bundled font parser (`@shuding/opentype.js`) can't read variable-font files (e.g. macOS's system SF Mono, which has an `fvar` table). Always pass a static font weight, never a system font reference.
80
- - **The bundled default font is embedded as base64 in `src/lib/spaceMonoData.ts`, not read from a sibling `.ttf` file at runtime.** Confirmed via a real `astro build`: Vite/Rollup bundles this package's source into a new chunk file at a different physical location in the consumer's build output, so any `import.meta.url`-relative disk read breaks there (regardless of whether it's written as `new URL(...)` or a plain `path.join` - both are equally broken, since the problem is the module's *code* being relocated, not a specific path-construction pattern Vite's static analyzer happens to intercept). The raw `.ttf` files still live in `src/assets/fonts/` for provenance/license visibility and to regenerate the base64 if the font is ever updated; they aren't imported by any code path.
80
+ - **The bundled default font is embedded as base64 in `src/lib/spaceMonoData.ts`, not read from a sibling `.ttf` file at runtime.** Confirmed via a real `astro build`: Vite/Rollup bundles this package's source into a new chunk file at a different physical location in the consumer's build output, so any `import.meta.url`-relative disk read breaks there (regardless of whether it's written as `new URL(...)` or a plain `path.join` - both are equally broken, since the problem is the module's *code* being relocated, not a specific path-construction pattern Vite's static analyzer happens to intercept). The raw `.ttf` files live in the repo's root-level `assets/fonts/` (kept for provenance/license visibility and to regenerate the base64 if the font is ever updated, but outside `src/` so the npm package doesn't publish them - they aren't imported by any code path). The OFL license text ships alongside the base64 module itself at `src/lib/OFL.txt`, since that module is the actual redistribution of the font data.
81
81
  - `satori-html` is stale (last published Dec 2022) but works correctly against the current Satori API as of this writing - the smoke test (`npm test`) is the tripwire for a future break.
82
82
  - **`satori-html` unconditionally trims every text node's value**, so a literal space in a text node right before an inline-styled `<span>` is silently dropped (and a non-breaking space doesn't survive either - JS `trim()` treats it as whitespace too). Give the following span an explicit `margin-left` (or the preceding element a `margin-right`) instead of relying on a whitespace character between elements.
83
83
 
@@ -85,6 +85,20 @@ Bundles a default static (non-variable) font, [Space Mono](https://github.com/go
85
85
 
86
86
  Issues welcome. PRs by discussion - open an issue first for anything beyond a typo or docs fix.
87
87
 
88
+ ### Releasing
89
+
90
+ Maintainer-only. Releases are tag-triggered and published to npm via GitHub Actions (Trusted
91
+ Publishing / OIDC, no token secret):
92
+
93
+ 1. Test before tagging: `npm pack`, install the tarball into a scratch Astro app (or a consumer
94
+ locally), `astro check && astro build`.
95
+ 2. Bump `version` in `package.json`, commit.
96
+ 3. Tag `vX.Y.Z` and push the tag. Pushing the tag runs `.github/workflows/publish.yml`, which
97
+ type-checks, tests, verifies the tag matches `package.json`'s version, and only then runs
98
+ `npm publish`.
99
+ 4. Confirm the version is live: `npm view @vdaluz/astro-og-cards version`. Consumers bump their
100
+ own semver pin once it's confirmed live - see this package's CHANGELOG.md for what changed.
101
+
88
102
  ## Consumers
89
103
 
90
104
  - [vdaluz.com](https://vdaluz.com)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vdaluz/astro-og-cards",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
4
4
  "description": "Build-time OG/social-card generation (satori + sharp) and meta-tag emission for Astro - proven in production on vdaluz.com and imperfectsystems.com.",
5
5
  "keywords": [
6
6
  "astro",
@@ -44,9 +44,9 @@
44
44
  "sharp": "^0.35.0"
45
45
  },
46
46
  "devDependencies": {
47
- "@astrojs/check": "^0.9.9",
47
+ "@astrojs/check": "^0.9.10",
48
48
  "@types/node": "^26.1.1",
49
- "astro": "^7.1.3",
49
+ "astro": "^7.2.4",
50
50
  "typescript": "^6.0.3"
51
51
  }
52
52
  }
@@ -1,4 +1,4 @@
1
- // Base64-encoded Space Mono (OFL-licensed, see ../assets/fonts/OFL.txt), embedded directly
1
+ // Base64-encoded Space Mono (OFL-licensed, see ./OFL.txt), embedded directly
2
2
  // rather than read from a sibling file: Vite/Rollup bundles this module into a
3
3
  // different physical chunk location in the consumer's build output, so any
4
4
  // import.meta.url-relative disk read breaks regardless of how the path is
@@ -1,33 +0,0 @@
1
- /**
2
- * Inlined equivalent of imperfectsystems.com's real og-default.html
3
- * (src/assets/og/og-default.html in that repo) - satori-html requires inline
4
- * styles, not <style> blocks/classes, so this is hand-translated from the
5
- * original class-based design. Used as the smoke-test fixture because it's the
6
- * realistic worst case: nested flex, gradients, border-radius, and - critically -
7
- * both box-shadow and text-shadow, which is what caught the resvg-js crash during
8
- * this package's toolchain spike (see README's Known gotchas).
9
- */
10
- export const imperfectSystemsCard = `
11
- <div style="width:1200px;height:630px;display:flex;align-items:center;justify-content:center;background:#0a0a0a;font-family:'Space Mono';position:relative;">
12
- <div style="position:absolute;inset:0;display:flex;background-image:radial-gradient(circle at 50% 40%, rgba(0,255,0,0.06), transparent 60%);"></div>
13
- <div style="position:relative;width:960px;display:flex;flex-direction:column;background:#141414;border:1px solid #3a3a3a;border-radius:14px;box-shadow:0 30px 80px -20px rgba(0,0,0,0.8), 0 0 60px -20px rgba(0,255,0,0.25);overflow:hidden;">
14
- <div style="display:flex;align-items:center;gap:9px;padding:16px 20px;border-bottom:1px solid #2a2a2a;background:#1a1a1a;">
15
- <span style="display:flex;width:13px;height:13px;border-radius:50%;background:#ff5f56;"></span>
16
- <span style="display:flex;width:13px;height:13px;border-radius:50%;background:#ffbd2e;"></span>
17
- <span style="display:flex;width:13px;height:13px;border-radius:50%;background:#27c93f;"></span>
18
- <span style="margin-left:12px;color:#9ca3af;font-size:17px;letter-spacing:0.02em;">imperfect-systems — zsh</span>
19
- </div>
20
- <div style="display:flex;flex-direction:column;padding:44px 48px 52px;">
21
- <div style="color:#9ca3af;font-size:26px;line-height:1.9;letter-spacing:0.01em;">imperfect-systems ~ %</div>
22
- <div style="display:flex;font-size:34px;line-height:1.8;color:#00ff00;text-shadow:0 0 10px rgba(0,255,0,0.55), 0 0 24px rgba(0,255,0,0.3);letter-spacing:0.005em;">
23
- <span style="color:#80ff80;margin-right:14px;">$</span><span style="margin-right:14px;">./run</span><span style="color:#80ff80;">--software --games --music</span>
24
- </div>
25
- <div style="display:flex;margin-top:40px;justify-content:space-between;align-items:baseline;">
26
- <div style="display:flex;font-size:28px;font-weight:700;color:#ededed;letter-spacing:0.04em;">
27
- <span style="color:#00ff00;text-shadow:0 0 10px rgba(0,255,0,0.4);">Imperfect</span> Systems
28
- </div>
29
- <div style="color:#6b7280;font-size:20px;letter-spacing:0.04em;">imperfectsystems.com</div>
30
- </div>
31
- </div>
32
- </div>
33
- </div>`;
Binary file
File without changes