@popcraft/kit 0.2.0 → 0.4.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 +19 -0
- package/dist/index.js +49754 -559
- package/package.json +1 -1
- package/types/lib/templates/upload.d.ts +14 -0
- package/types/packages/kit/src/index.d.ts +18 -0
package/README.md
CHANGED
|
@@ -40,6 +40,24 @@ const k = new Kit('Landing', preset('web-desktop'))
|
|
|
40
40
|
const document = k.finish()
|
|
41
41
|
```
|
|
42
42
|
|
|
43
|
+
## Templates for your account
|
|
44
|
+
|
|
45
|
+
`toTemplate` turns a built design into a template: what a `template.json` file holds, which
|
|
46
|
+
`popcraft publish <folder>` uploads to your account (private until you list it). Every frame is one of the template's
|
|
47
|
+
sizes, and keeping the same `id` updates the template instead of adding another.
|
|
48
|
+
|
|
49
|
+
```ts
|
|
50
|
+
import { runDesign, toTemplate } from '@popcraft/kit'
|
|
51
|
+
import { writeFileSync } from 'node:fs'
|
|
52
|
+
|
|
53
|
+
const { document, issues } = await runDesign(script, { size: 'ig-story', name: 'Launch reel' })
|
|
54
|
+
if (issues.length) throw new Error(issues.map(i => i.message).join('\n'))
|
|
55
|
+
writeFileSync('launch-reel/template.json', JSON.stringify(toTemplate(document!, { id: 'launch-reel', name: 'Launch reel', category: 'promo', tags: ['launch', 'reel'] })))
|
|
56
|
+
// then: POPCRAFT_TOKEN=pop_… npx popcraft publish . (a token with marketplace:publish)
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Complete templates to start from: [getpopcraft/examples/templates](https://github.com/getpopcraft/examples/tree/main/templates).
|
|
60
|
+
|
|
43
61
|
## Types for scripts
|
|
44
62
|
|
|
45
63
|
A design script runs with `k`, `W`, `H`, `NAME`, `TRACKS` and the helpers as globals. Start one with
|
|
@@ -63,6 +81,7 @@ for completion and checking in your editor.
|
|
|
63
81
|
| `social`, `video`, `effects` | Post and feed variants; reel sheets, cuts and camera moves; shader backdrops |
|
|
64
82
|
| `runDesign`, `checkDesign`, `tracks` | Run a script in a sandbox; the design checks; every music track's tempo |
|
|
65
83
|
| `toPopcraft`, `fromPopcraft` | A document as a `.popcraft` file's text, and back |
|
|
84
|
+
| `toTemplate` | A built design as a template for your account (`template.json`, for `popcraft publish`) |
|
|
66
85
|
|
|
67
86
|
## Examples
|
|
68
87
|
|