@open-assets/open-assets 0.1.11 → 0.1.12
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 +73 -88
- package/bin/open-assets.mjs +113 -320
- package/lib/add.mjs +476 -0
- package/lib/init.mjs +215 -107
- package/lib/list.mjs +66 -0
- package/lib/lockfile.mjs +1 -1
- package/lib/manifest.mjs +125 -0
- package/lib/render.mjs +206 -0
- package/lib/renderer.mjs +19 -5
- package/lib/server.mjs +14 -4
- package/lib/validate.mjs +90 -0
- package/package.json +7 -2
- package/public/img/banner/1280/banner.png +0 -0
- package/public/img/icon/16/icon.png +0 -0
- package/public/img/icon/180/icon.png +0 -0
- package/public/img/icon/192/icon.png +0 -0
- package/public/img/icon/32/icon.png +0 -0
- package/public/img/icon/512/icon.png +0 -0
- package/public/viewer.html +28 -25
- package/skills/open-assets/SKILL.md +99 -52
|
@@ -22,7 +22,6 @@ open-assets render --collection screenshots --size iphone-6.9
|
|
|
22
22
|
open-assets render --collection icon --all
|
|
23
23
|
open-assets render --all
|
|
24
24
|
open-assets render --template 01-hero --all
|
|
25
|
-
open-assets render --platform "App Store"
|
|
26
25
|
open-assets render --force # ignore cache, re-render everything
|
|
27
26
|
```
|
|
28
27
|
|
|
@@ -33,13 +32,12 @@ open-assets render --force # ignore cache, re-render everything
|
|
|
33
32
|
| **Collection** | A named group of related assets sharing the same source size and export sizes. One tab in the dev UI. |
|
|
34
33
|
| **Template** | A single source file (HTML or SVG) that produces one image per export size. |
|
|
35
34
|
| **Export Size** | A named output dimension that templates are rendered at (e.g., "iPhone 6.9" → 1320×2868). |
|
|
36
|
-
| **Platform** | Optional grouping label for related export sizes (e.g., "App Store", "Play Store"). |
|
|
37
35
|
| **Source Size** | The dimensions the HTML template is authored at. Puppeteer scales from source → export size. |
|
|
38
36
|
| **Output** | An optional post-render action (e.g., write to Xcode `.appiconset`, copy SVG source). |
|
|
39
37
|
|
|
40
|
-
##
|
|
38
|
+
## assets.json
|
|
41
39
|
|
|
42
|
-
The `
|
|
40
|
+
The `assets.json` at the project root defines all asset collections. All collections follow the same unified schema — no `type` field needed.
|
|
43
41
|
|
|
44
42
|
```json
|
|
45
43
|
{
|
|
@@ -56,13 +54,8 @@ The `manifest.json` at the project root defines all asset collections. All colle
|
|
|
56
54
|
"templates": [
|
|
57
55
|
{ "src": "src/screenshots/01-hero.html", "name": "01-hero", "label": "Hero" }
|
|
58
56
|
],
|
|
59
|
-
"
|
|
60
|
-
{
|
|
61
|
-
"platform": "App Store",
|
|
62
|
-
"sizes": [
|
|
63
|
-
{ "name": "iphone-6.9", "label": "iPhone 6.9\"", "width": 1320, "height": 2868 }
|
|
64
|
-
]
|
|
65
|
-
}
|
|
57
|
+
"export": [
|
|
58
|
+
{ "name": "iphone-6.9", "label": "iPhone 6.9\"", "size": { "width": 1320, "height": 2868 } }
|
|
66
59
|
],
|
|
67
60
|
"outputs": [],
|
|
68
61
|
"customExport": { "defaultWidth": 1320, "defaultHeight": 2868 }
|
|
@@ -80,7 +73,7 @@ The `manifest.json` at the project root defines all asset collections. All colle
|
|
|
80
73
|
| `sourceSize` | object | `{ width, height }` — dimensions templates are authored at |
|
|
81
74
|
| `borderRadius` | number | Border radius for preview frames (px) |
|
|
82
75
|
| `templates` | array | Source files: `{ src, name, label }` |
|
|
83
|
-
| `
|
|
76
|
+
| `export` | array | Export sizes: `[{ name, label, size: { width, height }, outFile? }]` |
|
|
84
77
|
| `outputs` | array | Post-render actions (optional) |
|
|
85
78
|
| `customExport` | object | Custom size defaults for UI (optional) |
|
|
86
79
|
|
|
@@ -104,14 +97,9 @@ The `manifest.json` at the project root defines all asset collections. All colle
|
|
|
104
97
|
{ "src": "src/screenshots/01-hero.html", "name": "01-hero", "label": "Hero" },
|
|
105
98
|
{ "src": "src/screenshots/02-features.html", "name": "02-features", "label": "Features" }
|
|
106
99
|
],
|
|
107
|
-
"
|
|
108
|
-
{
|
|
109
|
-
|
|
110
|
-
"sizes": [
|
|
111
|
-
{ "name": "iphone-6.9", "label": "iPhone 6.9\"", "width": 1320, "height": 2868 },
|
|
112
|
-
{ "name": "iphone-6.7", "label": "iPhone 6.7\"", "width": 1290, "height": 2796 }
|
|
113
|
-
]
|
|
114
|
-
}
|
|
100
|
+
"export": [
|
|
101
|
+
{ "name": "iphone-6.9", "label": "iPhone 6.9\"", "size": { "width": 1320, "height": 2868 } },
|
|
102
|
+
{ "name": "iphone-6.7", "label": "iPhone 6.7\"", "size": { "width": 1290, "height": 2796 } }
|
|
115
103
|
]
|
|
116
104
|
}
|
|
117
105
|
```
|
|
@@ -126,14 +114,9 @@ The `manifest.json` at the project root defines all asset collections. All colle
|
|
|
126
114
|
"templates": [
|
|
127
115
|
{ "src": "src/icon.html", "name": "icon", "label": "App Icon" }
|
|
128
116
|
],
|
|
129
|
-
"
|
|
130
|
-
{
|
|
131
|
-
|
|
132
|
-
"sizes": [
|
|
133
|
-
{ "name": "1024", "label": "1024px", "width": 1024, "height": 1024 },
|
|
134
|
-
{ "name": "180", "label": "180px", "width": 180, "height": 180 }
|
|
135
|
-
]
|
|
136
|
-
}
|
|
117
|
+
"export": [
|
|
118
|
+
{ "name": "1024", "label": "1024px", "size": { "width": 1024, "height": 1024 } },
|
|
119
|
+
{ "name": "180", "label": "180px", "size": { "width": 180, "height": 180 } }
|
|
137
120
|
],
|
|
138
121
|
"outputs": [{ "type": "xcode", "path": "../MyApp/Assets.xcassets/AppIcon.appiconset" }]
|
|
139
122
|
}
|
|
@@ -150,8 +133,8 @@ The `manifest.json` at the project root defines all asset collections. All colle
|
|
|
150
133
|
{ "src": "src/icons/concept-a.html", "name": "concept-a", "label": "Concept A" },
|
|
151
134
|
{ "src": "src/icons/concept-b.html", "name": "concept-b", "label": "Concept B" }
|
|
152
135
|
],
|
|
153
|
-
"
|
|
154
|
-
{ "
|
|
136
|
+
"export": [
|
|
137
|
+
{ "name": "1024", "label": "1024px", "size": { "width": 1024, "height": 1024 } }
|
|
155
138
|
]
|
|
156
139
|
}
|
|
157
140
|
```
|
|
@@ -166,11 +149,9 @@ The `manifest.json` at the project root defines all asset collections. All colle
|
|
|
166
149
|
{ "src": "src/logo.svg", "name": "logo", "label": "Logo" },
|
|
167
150
|
{ "src": "src/logo-dark.svg", "name": "logo-dark", "label": "Dark" }
|
|
168
151
|
],
|
|
169
|
-
"
|
|
170
|
-
{ "
|
|
171
|
-
|
|
172
|
-
{ "name": "512", "label": "512px", "width": 512, "height": 512 }
|
|
173
|
-
] }
|
|
152
|
+
"export": [
|
|
153
|
+
{ "name": "1024", "label": "1024px", "size": { "width": 1024, "height": 1024 } },
|
|
154
|
+
{ "name": "512", "label": "512px", "size": { "width": 512, "height": 512 } }
|
|
174
155
|
],
|
|
175
156
|
"outputs": [{ "type": "copy-source", "format": "svg" }]
|
|
176
157
|
}
|
|
@@ -185,23 +166,36 @@ The `manifest.json` at the project root defines all asset collections. All colle
|
|
|
185
166
|
"templates": [
|
|
186
167
|
{ "src": "src/og/default.html", "name": "default", "label": "Default OG" }
|
|
187
168
|
],
|
|
188
|
-
"
|
|
189
|
-
{ "
|
|
169
|
+
"export": [
|
|
170
|
+
{ "name": "og", "label": "OG Image", "size": { "width": 1200, "height": 630 } }
|
|
190
171
|
]
|
|
191
172
|
}
|
|
192
173
|
```
|
|
193
174
|
|
|
194
175
|
## CLI Reference
|
|
195
176
|
|
|
177
|
+
### All commands
|
|
178
|
+
|
|
179
|
+
| Command | Description |
|
|
180
|
+
|---------|-------------|
|
|
181
|
+
| `open-assets dev [dir]` | Start dev server with live preview and export UI |
|
|
182
|
+
| `open-assets render [dir]` | Render assets headlessly via CLI |
|
|
183
|
+
| `open-assets list [dir]` | List all collections and templates in the config |
|
|
184
|
+
| `open-assets validate [dir]` | Validate assets.json and check referenced files exist |
|
|
185
|
+
| `open-assets init [dir]` | Scaffold a new assets.json and example assets |
|
|
186
|
+
| `open-assets add collection [dir]` | Add a new collection (from presets or custom) |
|
|
187
|
+
| `open-assets add template [dir]` | Add a new template to an existing collection |
|
|
188
|
+
| `open-assets add size [dir]` | Add an export size to a collection |
|
|
189
|
+
| `open-assets skills [dir]` | Install Claude Code skills into a project |
|
|
190
|
+
|
|
196
191
|
### render command flags
|
|
197
192
|
|
|
198
193
|
| Flag | Description |
|
|
199
194
|
|------|-------------|
|
|
200
195
|
| `--collection <id>` | Render only the collection with this ID |
|
|
201
196
|
| `--template <name>` | Render only the template with this name |
|
|
202
|
-
| `--size <name>` | Use a named export size from
|
|
203
|
-
| `--
|
|
204
|
-
| `--all` | Export at every size defined in the manifest |
|
|
197
|
+
| `--size <name>` | Use a named export size from config |
|
|
198
|
+
| `--all` | Export at every size defined in the config |
|
|
205
199
|
| `--force` | Re-render all assets even if unchanged |
|
|
206
200
|
| `-o, --output <dir>` | Output directory (default: `./exports`) |
|
|
207
201
|
| `--json` | Output results as JSON |
|
|
@@ -211,7 +205,56 @@ Flags compose naturally:
|
|
|
211
205
|
- `--collection screenshots --template 01-hero --size iphone-6.9` → single template, single size
|
|
212
206
|
- `--collection screenshots --template 01-hero --all` → one template, all sizes
|
|
213
207
|
- `--collection screenshots --size iphone-6.9` → all templates, one size
|
|
214
|
-
|
|
208
|
+
|
|
209
|
+
### add commands
|
|
210
|
+
|
|
211
|
+
Interactive commands for managing the config without editing JSON by hand. All support `--config <path>` for custom config filenames.
|
|
212
|
+
|
|
213
|
+
#### `open-assets add collection`
|
|
214
|
+
|
|
215
|
+
Add a new asset collection. Choose from presets or configure custom dimensions and format.
|
|
216
|
+
|
|
217
|
+
**Presets:**
|
|
218
|
+
| Preset | Source Size | Format |
|
|
219
|
+
|--------|-----------|--------|
|
|
220
|
+
| App Store Screenshots | 440x956 | HTML |
|
|
221
|
+
| App Icon | 1024x1024 | HTML |
|
|
222
|
+
| Logo | 800x800 | SVG |
|
|
223
|
+
| Wordmark | 1200x400 | SVG |
|
|
224
|
+
| Feature Graphic (Google Play) | 1024x500 | HTML |
|
|
225
|
+
| OG Image / Social | 1200x630 | HTML |
|
|
226
|
+
| Custom | user-defined | HTML or SVG |
|
|
227
|
+
|
|
228
|
+
Creates a starter template file and adds the collection to `assets.json` with appropriate export sizes.
|
|
229
|
+
|
|
230
|
+
```bash
|
|
231
|
+
open-assets add collection # interactive preset picker
|
|
232
|
+
open-assets add collection ./my-assets # in a specific directory
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
#### `open-assets add template`
|
|
236
|
+
|
|
237
|
+
Add a new template (HTML or SVG) to an existing collection. Prompts for which collection, template name/label, and format. Creates the source file in the same directory as the collection's existing templates.
|
|
238
|
+
|
|
239
|
+
```bash
|
|
240
|
+
open-assets add template # interactive
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
#### `open-assets add size`
|
|
244
|
+
|
|
245
|
+
Add an export size to a collection. Choose from common device/platform presets or enter custom dimensions.
|
|
246
|
+
|
|
247
|
+
**Size presets include:**
|
|
248
|
+
- iPhone 6.9", 6.7", 6.5", 6.1"
|
|
249
|
+
- iPad 13", 12.9"
|
|
250
|
+
- Google Play Phone, 7" Tablet
|
|
251
|
+
- Mac App Store Retina
|
|
252
|
+
- OG Image, Twitter Card, Product Hunt Gallery
|
|
253
|
+
- Custom dimensions
|
|
254
|
+
|
|
255
|
+
```bash
|
|
256
|
+
open-assets add size # interactive
|
|
257
|
+
```
|
|
215
258
|
|
|
216
259
|
### Output structure
|
|
217
260
|
|
|
@@ -237,9 +280,11 @@ exports/
|
|
|
237
280
|
|
|
238
281
|
## Creating New Screenshot HTML Files
|
|
239
282
|
|
|
240
|
-
Each screenshot is a standalone HTML file at fixed dimensions.
|
|
283
|
+
Each screenshot is a standalone HTML file at fixed dimensions. You can create them manually or use `open-assets add template` to scaffold one.
|
|
284
|
+
|
|
285
|
+
Key rules:
|
|
241
286
|
|
|
242
|
-
1. Set `width` and `height` on the body to match `sourceSize` in the
|
|
287
|
+
1. Set `width` and `height` on the body to match `sourceSize` in the config
|
|
243
288
|
2. Set `overflow: hidden` on the body
|
|
244
289
|
3. Reference compiled Tailwind CSS via `<link rel="stylesheet" href="../dist/styles.css" />`
|
|
245
290
|
4. All paths are relative to the project root
|
|
@@ -263,11 +308,13 @@ Example template:
|
|
|
263
308
|
</html>
|
|
264
309
|
```
|
|
265
310
|
|
|
266
|
-
After creating the file, add it to the `templates` array in the relevant collection in `
|
|
311
|
+
After creating the file manually, add it to the `templates` array in the relevant collection in `assets.json`. Or use `open-assets add template` to do both steps at once.
|
|
267
312
|
|
|
268
313
|
## Adding a New Collection
|
|
269
314
|
|
|
270
|
-
|
|
315
|
+
Use `open-assets add collection` to interactively add a collection from presets or with custom dimensions and format (HTML/SVG). This creates the starter template file and updates `assets.json` automatically.
|
|
316
|
+
|
|
317
|
+
Alternatively, add a new object to the `collections` array in `assets.json` manually. Each collection needs a unique `id`, a `sourceSize`, `templates`, and `export`.
|
|
271
318
|
|
|
272
319
|
## Common Export Sizes
|
|
273
320
|
|
|
@@ -284,9 +331,9 @@ Add a new object to the `collections` array in `manifest.json`. Each collection
|
|
|
284
331
|
| Web | OG Image | 1200 | 630 |
|
|
285
332
|
| Mac App Store | Retina | 2880 | 1800 |
|
|
286
333
|
|
|
287
|
-
## Incremental Builds (
|
|
334
|
+
## Incremental Builds (assets.lock)
|
|
288
335
|
|
|
289
|
-
The `render` command maintains a `
|
|
336
|
+
The `render` command maintains a `assets.lock` file with SHA256 checksums of source files. On subsequent renders, unchanged assets are skipped automatically. Use `--force` to re-render everything.
|
|
290
337
|
|
|
291
338
|
Note: only source HTML/SVG files are checksummed. Changes to referenced assets (images in publicDir, compiled CSS) will not trigger re-renders — use `--force` when those change.
|
|
292
339
|
|
|
@@ -294,8 +341,8 @@ Note: only source HTML/SVG files are checksummed. Changes to referenced assets (
|
|
|
294
341
|
|
|
295
342
|
```
|
|
296
343
|
project/
|
|
297
|
-
|
|
298
|
-
|
|
344
|
+
assets.json
|
|
345
|
+
assets.lock # Auto-generated, add to .gitignore
|
|
299
346
|
public/ # Shared assets (images, logos, icons, photos)
|
|
300
347
|
logo-round.png
|
|
301
348
|
social/
|
|
@@ -490,8 +537,8 @@ colored background on the key word. Add the app rating below the logo. Make the
|
|
|
490
537
|
background food photo bleed off the bottom-right edge for visual impact.
|
|
491
538
|
```
|
|
492
539
|
|
|
493
|
-
**Adding a new
|
|
540
|
+
**Adding a new export size:**
|
|
494
541
|
```
|
|
495
|
-
Add Play Store screenshot sizes to the
|
|
496
|
-
|
|
542
|
+
Add Play Store screenshot sizes to the config. Use 1080x2400 as the export size.
|
|
543
|
+
The screenshots can share the same templates.
|
|
497
544
|
```
|