@softure-ai/marketing-kit 0.1.6 → 0.1.8
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 +100 -17
- package/dist/cli/main.js +93 -33
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/og.d.ts +4 -1
- package/dist/cli/og.d.ts.map +1 -1
- package/dist/cli/og.js +15 -7
- package/dist/cli/og.js.map +1 -1
- package/dist/cli/options.d.ts +29 -2
- package/dist/cli/options.d.ts.map +1 -1
- package/dist/cli/options.js +106 -14
- package/dist/cli/options.js.map +1 -1
- package/dist/cli/voice.d.ts +19 -0
- package/dist/cli/voice.d.ts.map +1 -1
- package/dist/cli/voice.js +37 -5
- package/dist/cli/voice.js.map +1 -1
- package/dist/config/actions-schema.d.ts +14 -14
- package/dist/config/config.d.ts +5 -0
- package/dist/config/config.d.ts.map +1 -1
- package/dist/config/config.js +2 -1
- package/dist/config/config.js.map +1 -1
- package/dist/config/og-image-names.d.ts +7 -0
- package/dist/config/og-image-names.d.ts.map +1 -0
- package/dist/config/og-image-names.js +9 -0
- package/dist/config/og-image-names.js.map +1 -0
- package/dist/config/schema.d.ts +106 -15
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/config/schema.js +74 -7
- package/dist/config/schema.js.map +1 -1
- package/dist/index.d.ts +8 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -4
- package/dist/index.js.map +1 -1
- package/dist/og/index.d.ts +3 -3
- package/dist/og/index.d.ts.map +1 -1
- package/dist/og/index.js +3 -2
- package/dist/og/index.js.map +1 -1
- package/dist/og/render.d.ts +13 -0
- package/dist/og/render.d.ts.map +1 -1
- package/dist/og/render.js +31 -6
- package/dist/og/render.js.map +1 -1
- package/dist/og/templates/big-number.d.ts +7 -0
- package/dist/og/templates/big-number.d.ts.map +1 -0
- package/dist/og/templates/big-number.js +41 -0
- package/dist/og/templates/big-number.js.map +1 -0
- package/dist/og/templates/carousel.d.ts +5 -0
- package/dist/og/templates/carousel.d.ts.map +1 -0
- package/dist/og/templates/carousel.js +26 -0
- package/dist/og/templates/carousel.js.map +1 -0
- package/dist/og/templates/context.d.ts +11 -3
- package/dist/og/templates/context.d.ts.map +1 -1
- package/dist/og/templates/context.js +6 -0
- package/dist/og/templates/context.js.map +1 -1
- package/dist/og/templates/frame.d.ts +2 -2
- package/dist/og/templates/frame.d.ts.map +1 -1
- package/dist/og/templates/frame.js +2 -2
- package/dist/og/templates/frame.js.map +1 -1
- package/dist/og/templates/index.d.ts +8 -3
- package/dist/og/templates/index.d.ts.map +1 -1
- package/dist/og/templates/index.js +18 -5
- package/dist/og/templates/index.js.map +1 -1
- package/dist/og/templates/portrait.d.ts +22 -0
- package/dist/og/templates/portrait.d.ts.map +1 -0
- package/dist/og/templates/portrait.js +75 -0
- package/dist/og/templates/portrait.js.map +1 -0
- package/dist/og/templates/schemas.d.ts +28 -0
- package/dist/og/templates/schemas.d.ts.map +1 -1
- package/dist/og/templates/schemas.js +26 -0
- package/dist/og/templates/schemas.js.map +1 -1
- package/dist/posts/posts.d.ts +2 -1
- package/dist/posts/posts.d.ts.map +1 -1
- package/dist/posts/posts.js +1 -1
- package/dist/posts/posts.js.map +1 -1
- package/dist/screenshot/gates.d.ts +6 -3
- package/dist/screenshot/gates.d.ts.map +1 -1
- package/dist/screenshot/gates.js +12 -3
- package/dist/screenshot/gates.js.map +1 -1
- package/dist/screenshot/screenshot.d.ts +17 -0
- package/dist/screenshot/screenshot.d.ts.map +1 -1
- package/dist/screenshot/screenshot.js +37 -6
- package/dist/screenshot/screenshot.js.map +1 -1
- package/dist/screenshot/storage-state.d.ts +9 -0
- package/dist/screenshot/storage-state.d.ts.map +1 -0
- package/dist/screenshot/storage-state.js +25 -0
- package/dist/screenshot/storage-state.js.map +1 -0
- package/dist/voice/batch.d.ts +28 -0
- package/dist/voice/batch.d.ts.map +1 -0
- package/dist/voice/batch.js +46 -0
- package/dist/voice/batch.js.map +1 -0
- package/dist/voice/elevenlabs.d.ts.map +1 -1
- package/dist/voice/elevenlabs.js +11 -1
- package/dist/voice/elevenlabs.js.map +1 -1
- package/dist/voice/pace.d.ts +22 -0
- package/dist/voice/pace.d.ts.map +1 -0
- package/dist/voice/pace.js +39 -0
- package/dist/voice/pace.js.map +1 -0
- package/dist/voice/placeholder.d.ts +35 -0
- package/dist/voice/placeholder.d.ts.map +1 -0
- package/dist/voice/placeholder.js +53 -0
- package/dist/voice/placeholder.js.map +1 -0
- package/dist/voice/produce.d.ts +6 -0
- package/dist/voice/produce.d.ts.map +1 -1
- package/dist/voice/produce.js +13 -2
- package/dist/voice/produce.js.map +1 -1
- package/dist/voice/provider.d.ts +2 -0
- package/dist/voice/provider.d.ts.map +1 -1
- package/dist/voice/provider.js.map +1 -1
- package/package.json +1 -1
- package/schema/marketing.schema.json +359 -37
- package/src/cli/main.ts +88 -31
- package/src/cli/og.ts +14 -6
- package/src/cli/options.ts +118 -13
- package/src/cli/voice.ts +44 -6
- package/src/config/config.ts +7 -2
- package/src/config/og-image-names.ts +7 -0
- package/src/config/schema.ts +82 -8
- package/src/index.ts +10 -2
- package/src/og/index.ts +16 -2
- package/src/og/render.ts +36 -6
- package/src/og/templates/big-number.ts +44 -0
- package/src/og/templates/carousel.ts +27 -0
- package/src/og/templates/context.ts +16 -3
- package/src/og/templates/frame.ts +2 -2
- package/src/og/templates/index.ts +31 -9
- package/src/og/templates/portrait.ts +126 -0
- package/src/og/templates/schemas.ts +35 -0
- package/src/posts/posts.ts +3 -2
- package/src/screenshot/gates.ts +13 -3
- package/src/screenshot/screenshot.ts +51 -11
- package/src/screenshot/storage-state.ts +24 -0
- package/src/voice/batch.ts +65 -0
- package/src/voice/elevenlabs.ts +11 -1
- package/src/voice/pace.ts +55 -0
- package/src/voice/placeholder.ts +83 -0
- package/src/voice/produce.ts +15 -3
- package/src/voice/provider.ts +2 -0
|
@@ -470,11 +470,40 @@
|
|
|
470
470
|
"minimum": 0.8,
|
|
471
471
|
"maximum": 1.3
|
|
472
472
|
},
|
|
473
|
+
"minIntervalSeconds": {
|
|
474
|
+
"default": 60,
|
|
475
|
+
"description": "Least seconds between two paid recordings (0-3600, default 60; 0 turns it off), counted from the newest file in cacheDir, so separate runs are spaced too.",
|
|
476
|
+
"type": "number",
|
|
477
|
+
"minimum": 0,
|
|
478
|
+
"maximum": 3600
|
|
479
|
+
},
|
|
473
480
|
"cacheDir": {
|
|
474
481
|
"default": "marketing/voiceover",
|
|
475
482
|
"description": "The paid voiceover cache (<key>.mp3 and <key>.json), relative to the folder of marketing.json; commit it.",
|
|
476
483
|
"type": "string",
|
|
477
484
|
"minLength": 1
|
|
485
|
+
},
|
|
486
|
+
"placeholder": {
|
|
487
|
+
"description": "The free placeholder voiceover of --placeholder (a quiet tone, words at a fixed pace), to record and render a film before paying for its voiceover.",
|
|
488
|
+
"default": {},
|
|
489
|
+
"type": "object",
|
|
490
|
+
"properties": {
|
|
491
|
+
"wordsPerSecond": {
|
|
492
|
+
"default": 2.5,
|
|
493
|
+
"description": "Words per second of the placeholder voiceover (0.5-6, default 2.5); match the real voice to rehearse the film's length.",
|
|
494
|
+
"type": "number",
|
|
495
|
+
"minimum": 0.5,
|
|
496
|
+
"maximum": 6
|
|
497
|
+
},
|
|
498
|
+
"sentencePauseSeconds": {
|
|
499
|
+
"default": 0.5,
|
|
500
|
+
"description": "Silence after every sentence of the placeholder voiceover but the last (0-3 s, default 0.5).",
|
|
501
|
+
"type": "number",
|
|
502
|
+
"minimum": 0,
|
|
503
|
+
"maximum": 3
|
|
504
|
+
}
|
|
505
|
+
},
|
|
506
|
+
"additionalProperties": false
|
|
478
507
|
}
|
|
479
508
|
},
|
|
480
509
|
"required": [
|
|
@@ -2519,6 +2548,11 @@
|
|
|
2519
2548
|
"type": "string"
|
|
2520
2549
|
}
|
|
2521
2550
|
},
|
|
2551
|
+
"disclosure": {
|
|
2552
|
+
"default": true,
|
|
2553
|
+
"description": "Whether social.disclosure follows this post's caption (default true).",
|
|
2554
|
+
"type": "boolean"
|
|
2555
|
+
},
|
|
2522
2556
|
"codes": {
|
|
2523
2557
|
"description": "Channel codes for this film only, per platform; each falls back to platforms.<platform>.code.",
|
|
2524
2558
|
"type": "object",
|
|
@@ -2547,6 +2581,10 @@
|
|
|
2547
2581
|
],
|
|
2548
2582
|
"additionalProperties": false
|
|
2549
2583
|
}
|
|
2584
|
+
},
|
|
2585
|
+
"disclosure": {
|
|
2586
|
+
"description": "A paragraph after every post's caption, e.g. that the persona is an example and the voice is AI-generated; {persona} becomes the film's persona name. A post opts out with disclosure: false.",
|
|
2587
|
+
"type": "string"
|
|
2550
2588
|
}
|
|
2551
2589
|
},
|
|
2552
2590
|
"required": [
|
|
@@ -2628,6 +2666,24 @@
|
|
|
2628
2666
|
"dark"
|
|
2629
2667
|
]
|
|
2630
2668
|
}
|
|
2669
|
+
},
|
|
2670
|
+
"scrollTo": {
|
|
2671
|
+
"description": "Capture one viewport frame scrolled to this many CSS pixels from the top (e.g. to check scroll-driven motion, with motion: \"no-preference\"); refused when the page cannot scroll that far. Not with full.",
|
|
2672
|
+
"type": "integer",
|
|
2673
|
+
"minimum": 0,
|
|
2674
|
+
"maximum": 9007199254740991
|
|
2675
|
+
},
|
|
2676
|
+
"waitMs": {
|
|
2677
|
+
"default": 0,
|
|
2678
|
+
"description": "Milliseconds to wait after the page loaded (and scrolled) before the phrase gate reads it, for animations to settle (0-60000, default 0).",
|
|
2679
|
+
"type": "integer",
|
|
2680
|
+
"minimum": 0,
|
|
2681
|
+
"maximum": 60000
|
|
2682
|
+
},
|
|
2683
|
+
"storageState": {
|
|
2684
|
+
"description": "A Playwright storage state (cookies and localStorage as JSON), relative to the folder of marketing.json, to capture a signed-in screen. It holds a session: keep it out of git.",
|
|
2685
|
+
"type": "string",
|
|
2686
|
+
"minLength": 1
|
|
2631
2687
|
}
|
|
2632
2688
|
},
|
|
2633
2689
|
"required": [
|
|
@@ -2641,7 +2697,6 @@
|
|
|
2641
2697
|
}
|
|
2642
2698
|
},
|
|
2643
2699
|
"ogImages": {
|
|
2644
|
-
"default": [],
|
|
2645
2700
|
"description": "Open Graph images rendered by softure-marketing og.",
|
|
2646
2701
|
"type": "array",
|
|
2647
2702
|
"items": {
|
|
@@ -2652,30 +2707,39 @@
|
|
|
2652
2707
|
"id": {
|
|
2653
2708
|
"type": "string",
|
|
2654
2709
|
"pattern": "^[a-z0-9]+(-[a-z0-9]+)*$",
|
|
2655
|
-
"description": "The image's id: the file <output.dir>/og/<id>.png."
|
|
2710
|
+
"description": "The image's id: the file <output.dir>/og/<id>.png (a carousel writes <id>-1.png, <id>-2.png and so on)."
|
|
2656
2711
|
},
|
|
2657
2712
|
"size": {
|
|
2658
|
-
"
|
|
2659
|
-
|
|
2660
|
-
630
|
|
2661
|
-
],
|
|
2662
|
-
"description": "The image size in pixels, [width, height].",
|
|
2663
|
-
"type": "array",
|
|
2664
|
-
"prefixItems": [
|
|
2713
|
+
"description": "The image size: \"landscape\" (1200×630), \"portrait\" (1080×1350), \"square\" (1080×1080), \"story\" (1080×1920) or [width, height] in pixels; \"landscape\" by default.",
|
|
2714
|
+
"anyOf": [
|
|
2665
2715
|
{
|
|
2666
|
-
"type": "
|
|
2667
|
-
"
|
|
2668
|
-
|
|
2716
|
+
"type": "array",
|
|
2717
|
+
"prefixItems": [
|
|
2718
|
+
{
|
|
2719
|
+
"type": "integer",
|
|
2720
|
+
"minimum": 1,
|
|
2721
|
+
"maximum": 4000
|
|
2722
|
+
},
|
|
2723
|
+
{
|
|
2724
|
+
"type": "integer",
|
|
2725
|
+
"minimum": 1,
|
|
2726
|
+
"maximum": 4000
|
|
2727
|
+
}
|
|
2728
|
+
],
|
|
2729
|
+
"items": false,
|
|
2730
|
+
"minItems": 2,
|
|
2731
|
+
"maxItems": 2
|
|
2669
2732
|
},
|
|
2670
2733
|
{
|
|
2671
|
-
"type": "
|
|
2672
|
-
"
|
|
2673
|
-
|
|
2734
|
+
"type": "string",
|
|
2735
|
+
"enum": [
|
|
2736
|
+
"landscape",
|
|
2737
|
+
"portrait",
|
|
2738
|
+
"square",
|
|
2739
|
+
"story"
|
|
2740
|
+
]
|
|
2674
2741
|
}
|
|
2675
|
-
]
|
|
2676
|
-
"items": false,
|
|
2677
|
-
"minItems": 2,
|
|
2678
|
-
"maxItems": 2
|
|
2742
|
+
]
|
|
2679
2743
|
},
|
|
2680
2744
|
"template": {
|
|
2681
2745
|
"type": "string",
|
|
@@ -2747,30 +2811,39 @@
|
|
|
2747
2811
|
"id": {
|
|
2748
2812
|
"type": "string",
|
|
2749
2813
|
"pattern": "^[a-z0-9]+(-[a-z0-9]+)*$",
|
|
2750
|
-
"description": "The image's id: the file <output.dir>/og/<id>.png."
|
|
2814
|
+
"description": "The image's id: the file <output.dir>/og/<id>.png (a carousel writes <id>-1.png, <id>-2.png and so on)."
|
|
2751
2815
|
},
|
|
2752
2816
|
"size": {
|
|
2753
|
-
"
|
|
2754
|
-
|
|
2755
|
-
630
|
|
2756
|
-
],
|
|
2757
|
-
"description": "The image size in pixels, [width, height].",
|
|
2758
|
-
"type": "array",
|
|
2759
|
-
"prefixItems": [
|
|
2817
|
+
"description": "The image size: \"landscape\" (1200×630), \"portrait\" (1080×1350), \"square\" (1080×1080), \"story\" (1080×1920) or [width, height] in pixels; \"landscape\" by default.",
|
|
2818
|
+
"anyOf": [
|
|
2760
2819
|
{
|
|
2761
|
-
"type": "
|
|
2762
|
-
"
|
|
2763
|
-
|
|
2820
|
+
"type": "array",
|
|
2821
|
+
"prefixItems": [
|
|
2822
|
+
{
|
|
2823
|
+
"type": "integer",
|
|
2824
|
+
"minimum": 1,
|
|
2825
|
+
"maximum": 4000
|
|
2826
|
+
},
|
|
2827
|
+
{
|
|
2828
|
+
"type": "integer",
|
|
2829
|
+
"minimum": 1,
|
|
2830
|
+
"maximum": 4000
|
|
2831
|
+
}
|
|
2832
|
+
],
|
|
2833
|
+
"items": false,
|
|
2834
|
+
"minItems": 2,
|
|
2835
|
+
"maxItems": 2
|
|
2764
2836
|
},
|
|
2765
2837
|
{
|
|
2766
|
-
"type": "
|
|
2767
|
-
"
|
|
2768
|
-
|
|
2838
|
+
"type": "string",
|
|
2839
|
+
"enum": [
|
|
2840
|
+
"landscape",
|
|
2841
|
+
"portrait",
|
|
2842
|
+
"square",
|
|
2843
|
+
"story"
|
|
2844
|
+
]
|
|
2769
2845
|
}
|
|
2770
|
-
]
|
|
2771
|
-
"items": false,
|
|
2772
|
-
"minItems": 2,
|
|
2773
|
-
"maxItems": 2
|
|
2846
|
+
]
|
|
2774
2847
|
},
|
|
2775
2848
|
"template": {
|
|
2776
2849
|
"type": "string",
|
|
@@ -2902,6 +2975,255 @@
|
|
|
2902
2975
|
"data"
|
|
2903
2976
|
],
|
|
2904
2977
|
"additionalProperties": false
|
|
2978
|
+
},
|
|
2979
|
+
{
|
|
2980
|
+
"type": "object",
|
|
2981
|
+
"properties": {
|
|
2982
|
+
"id": {
|
|
2983
|
+
"type": "string",
|
|
2984
|
+
"pattern": "^[a-z0-9]+(-[a-z0-9]+)*$",
|
|
2985
|
+
"description": "The image's id: the file <output.dir>/og/<id>.png (a carousel writes <id>-1.png, <id>-2.png and so on)."
|
|
2986
|
+
},
|
|
2987
|
+
"size": {
|
|
2988
|
+
"description": "The image size: \"landscape\" (1200×630), \"portrait\" (1080×1350), \"square\" (1080×1080), \"story\" (1080×1920) or [width, height] in pixels; \"portrait\" by default.",
|
|
2989
|
+
"anyOf": [
|
|
2990
|
+
{
|
|
2991
|
+
"type": "array",
|
|
2992
|
+
"prefixItems": [
|
|
2993
|
+
{
|
|
2994
|
+
"type": "integer",
|
|
2995
|
+
"minimum": 1,
|
|
2996
|
+
"maximum": 4000
|
|
2997
|
+
},
|
|
2998
|
+
{
|
|
2999
|
+
"type": "integer",
|
|
3000
|
+
"minimum": 1,
|
|
3001
|
+
"maximum": 4000
|
|
3002
|
+
}
|
|
3003
|
+
],
|
|
3004
|
+
"items": false,
|
|
3005
|
+
"minItems": 2,
|
|
3006
|
+
"maxItems": 2
|
|
3007
|
+
},
|
|
3008
|
+
{
|
|
3009
|
+
"type": "string",
|
|
3010
|
+
"enum": [
|
|
3011
|
+
"landscape",
|
|
3012
|
+
"portrait",
|
|
3013
|
+
"square",
|
|
3014
|
+
"story"
|
|
3015
|
+
]
|
|
3016
|
+
}
|
|
3017
|
+
]
|
|
3018
|
+
},
|
|
3019
|
+
"template": {
|
|
3020
|
+
"type": "string",
|
|
3021
|
+
"const": "big-number",
|
|
3022
|
+
"description": "A portrait post whose number fills the frame, with the sentence that explains it, tiles, a call to action and a source line."
|
|
3023
|
+
},
|
|
3024
|
+
"data": {
|
|
3025
|
+
"type": "object",
|
|
3026
|
+
"properties": {
|
|
3027
|
+
"eyebrow": {
|
|
3028
|
+
"description": "A short line above the headline, at most 40 characters.",
|
|
3029
|
+
"type": "string",
|
|
3030
|
+
"maxLength": 40
|
|
3031
|
+
},
|
|
3032
|
+
"number": {
|
|
3033
|
+
"type": "string",
|
|
3034
|
+
"maxLength": 12,
|
|
3035
|
+
"description": "The figure that fills the post, unit included, e.g. \"898 PLN\"; at most 12 characters. Shorter numbers get bigger type."
|
|
3036
|
+
},
|
|
3037
|
+
"caption": {
|
|
3038
|
+
"type": "string",
|
|
3039
|
+
"maxLength": 90,
|
|
3040
|
+
"description": "The sentence that says what the number is, under it; at most 90 characters."
|
|
3041
|
+
},
|
|
3042
|
+
"tiles": {
|
|
3043
|
+
"default": [],
|
|
3044
|
+
"description": "Up to two label and value tiles under the caption, e.g. a second figure.",
|
|
3045
|
+
"maxItems": 2,
|
|
3046
|
+
"type": "array",
|
|
3047
|
+
"items": {
|
|
3048
|
+
"type": "object",
|
|
3049
|
+
"properties": {
|
|
3050
|
+
"label": {
|
|
3051
|
+
"type": "string",
|
|
3052
|
+
"maxLength": 24,
|
|
3053
|
+
"description": "The tile's caption, at most 24 characters."
|
|
3054
|
+
},
|
|
3055
|
+
"value": {
|
|
3056
|
+
"type": "string",
|
|
3057
|
+
"maxLength": 16,
|
|
3058
|
+
"description": "The tile's value, at most 16 characters."
|
|
3059
|
+
}
|
|
3060
|
+
},
|
|
3061
|
+
"required": [
|
|
3062
|
+
"label",
|
|
3063
|
+
"value"
|
|
3064
|
+
],
|
|
3065
|
+
"additionalProperties": false
|
|
3066
|
+
}
|
|
3067
|
+
},
|
|
3068
|
+
"cta": {
|
|
3069
|
+
"description": "A call to action, drawn as a pill in the cta colours at the bottom; at most 32 characters.",
|
|
3070
|
+
"type": "string",
|
|
3071
|
+
"maxLength": 32
|
|
3072
|
+
},
|
|
3073
|
+
"source": {
|
|
3074
|
+
"description": "Where the figures come from, drawn small at the bottom, e.g. \"Source: ZUS, 2026\"; at most 80 characters.",
|
|
3075
|
+
"type": "string",
|
|
3076
|
+
"maxLength": 80
|
|
3077
|
+
}
|
|
3078
|
+
},
|
|
3079
|
+
"required": [
|
|
3080
|
+
"number",
|
|
3081
|
+
"caption"
|
|
3082
|
+
],
|
|
3083
|
+
"additionalProperties": false,
|
|
3084
|
+
"description": "The big-number template's input."
|
|
3085
|
+
}
|
|
3086
|
+
},
|
|
3087
|
+
"required": [
|
|
3088
|
+
"id",
|
|
3089
|
+
"template",
|
|
3090
|
+
"data"
|
|
3091
|
+
],
|
|
3092
|
+
"additionalProperties": false
|
|
3093
|
+
},
|
|
3094
|
+
{
|
|
3095
|
+
"type": "object",
|
|
3096
|
+
"properties": {
|
|
3097
|
+
"id": {
|
|
3098
|
+
"type": "string",
|
|
3099
|
+
"pattern": "^[a-z0-9]+(-[a-z0-9]+)*$",
|
|
3100
|
+
"description": "The image's id: the file <output.dir>/og/<id>.png (a carousel writes <id>-1.png, <id>-2.png and so on)."
|
|
3101
|
+
},
|
|
3102
|
+
"size": {
|
|
3103
|
+
"description": "The image size: \"landscape\" (1200×630), \"portrait\" (1080×1350), \"square\" (1080×1080), \"story\" (1080×1920) or [width, height] in pixels; \"portrait\" by default.",
|
|
3104
|
+
"anyOf": [
|
|
3105
|
+
{
|
|
3106
|
+
"type": "array",
|
|
3107
|
+
"prefixItems": [
|
|
3108
|
+
{
|
|
3109
|
+
"type": "integer",
|
|
3110
|
+
"minimum": 1,
|
|
3111
|
+
"maximum": 4000
|
|
3112
|
+
},
|
|
3113
|
+
{
|
|
3114
|
+
"type": "integer",
|
|
3115
|
+
"minimum": 1,
|
|
3116
|
+
"maximum": 4000
|
|
3117
|
+
}
|
|
3118
|
+
],
|
|
3119
|
+
"items": false,
|
|
3120
|
+
"minItems": 2,
|
|
3121
|
+
"maxItems": 2
|
|
3122
|
+
},
|
|
3123
|
+
{
|
|
3124
|
+
"type": "string",
|
|
3125
|
+
"enum": [
|
|
3126
|
+
"landscape",
|
|
3127
|
+
"portrait",
|
|
3128
|
+
"square",
|
|
3129
|
+
"story"
|
|
3130
|
+
]
|
|
3131
|
+
}
|
|
3132
|
+
]
|
|
3133
|
+
},
|
|
3134
|
+
"template": {
|
|
3135
|
+
"type": "string",
|
|
3136
|
+
"const": "carousel",
|
|
3137
|
+
"description": "A numbered run of portrait slides sharing one look; each slide is its own file <id>-<n>.png."
|
|
3138
|
+
},
|
|
3139
|
+
"data": {
|
|
3140
|
+
"type": "object",
|
|
3141
|
+
"properties": {
|
|
3142
|
+
"slides": {
|
|
3143
|
+
"minItems": 2,
|
|
3144
|
+
"maxItems": 10,
|
|
3145
|
+
"type": "array",
|
|
3146
|
+
"items": {
|
|
3147
|
+
"type": "object",
|
|
3148
|
+
"properties": {
|
|
3149
|
+
"eyebrow": {
|
|
3150
|
+
"description": "A short line above the headline, at most 40 characters.",
|
|
3151
|
+
"type": "string",
|
|
3152
|
+
"maxLength": 40
|
|
3153
|
+
},
|
|
3154
|
+
"headline": {
|
|
3155
|
+
"type": "string",
|
|
3156
|
+
"maxLength": 90,
|
|
3157
|
+
"description": "The slide's headline, at most 90 characters."
|
|
3158
|
+
},
|
|
3159
|
+
"body": {
|
|
3160
|
+
"description": "A paragraph under the headline, at most 200 characters.",
|
|
3161
|
+
"type": "string",
|
|
3162
|
+
"maxLength": 200
|
|
3163
|
+
},
|
|
3164
|
+
"tiles": {
|
|
3165
|
+
"default": [],
|
|
3166
|
+
"description": "Up to two label and value tiles side by side.",
|
|
3167
|
+
"maxItems": 2,
|
|
3168
|
+
"type": "array",
|
|
3169
|
+
"items": {
|
|
3170
|
+
"type": "object",
|
|
3171
|
+
"properties": {
|
|
3172
|
+
"label": {
|
|
3173
|
+
"type": "string",
|
|
3174
|
+
"maxLength": 24,
|
|
3175
|
+
"description": "The tile's caption, at most 24 characters."
|
|
3176
|
+
},
|
|
3177
|
+
"value": {
|
|
3178
|
+
"type": "string",
|
|
3179
|
+
"maxLength": 16,
|
|
3180
|
+
"description": "The tile's value, at most 16 characters."
|
|
3181
|
+
}
|
|
3182
|
+
},
|
|
3183
|
+
"required": [
|
|
3184
|
+
"label",
|
|
3185
|
+
"value"
|
|
3186
|
+
],
|
|
3187
|
+
"additionalProperties": false
|
|
3188
|
+
}
|
|
3189
|
+
},
|
|
3190
|
+
"cta": {
|
|
3191
|
+
"description": "A call to action, drawn as a pill in the cta colours at the bottom; at most 32 characters.",
|
|
3192
|
+
"type": "string",
|
|
3193
|
+
"maxLength": 32
|
|
3194
|
+
},
|
|
3195
|
+
"source": {
|
|
3196
|
+
"description": "Where the figures come from, drawn small at the bottom, e.g. \"Source: ZUS, 2026\"; at most 80 characters.",
|
|
3197
|
+
"type": "string",
|
|
3198
|
+
"maxLength": 80
|
|
3199
|
+
}
|
|
3200
|
+
},
|
|
3201
|
+
"required": [
|
|
3202
|
+
"headline"
|
|
3203
|
+
],
|
|
3204
|
+
"additionalProperties": false
|
|
3205
|
+
},
|
|
3206
|
+
"description": "The slides in order, two to ten; each renders to its own file <id>-<n>.png."
|
|
3207
|
+
},
|
|
3208
|
+
"counter": {
|
|
3209
|
+
"default": true,
|
|
3210
|
+
"description": "Draws \"n/N\" in the top corner of every slide.",
|
|
3211
|
+
"type": "boolean"
|
|
3212
|
+
}
|
|
3213
|
+
},
|
|
3214
|
+
"required": [
|
|
3215
|
+
"slides"
|
|
3216
|
+
],
|
|
3217
|
+
"additionalProperties": false,
|
|
3218
|
+
"description": "The carousel template's input."
|
|
3219
|
+
}
|
|
3220
|
+
},
|
|
3221
|
+
"required": [
|
|
3222
|
+
"id",
|
|
3223
|
+
"template",
|
|
3224
|
+
"data"
|
|
3225
|
+
],
|
|
3226
|
+
"additionalProperties": false
|
|
2905
3227
|
}
|
|
2906
3228
|
]
|
|
2907
3229
|
}
|
package/src/cli/main.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { existsSync, mkdirSync, writeFileSync } from "node:fs";
|
|
3
|
-
import { join } from "node:path";
|
|
3
|
+
import { join, resolve } from "node:path";
|
|
4
4
|
|
|
5
5
|
import { findMissingFiles, formatConfigIssues, loadMarketingConfig, type MarketingConfig } from "../config/config.js";
|
|
6
6
|
import { getGeometry, getLayoutName } from "../compose/timeline.js";
|
|
@@ -11,26 +11,29 @@ import { recordFilm, ScreenGuardError, type RecordingLog } from "../record/recor
|
|
|
11
11
|
import { findMachineProblem } from "../render/preflight.js";
|
|
12
12
|
import { runHyperframes } from "../render/hyperframes.js";
|
|
13
13
|
import { renderFilm } from "../render/render.js";
|
|
14
|
-
import { takeScreenshots, type ScreenshotEntry } from "../screenshot/screenshot.js";
|
|
14
|
+
import { takePageScreenshot, takeScreenshots, type ScreenshotBrowser, type ScreenshotEntry, type ScreenshotResult } from "../screenshot/screenshot.js";
|
|
15
|
+
import { findStorageStateProblem } from "../screenshot/storage-state.js";
|
|
16
|
+
import { isPlaceholderKey } from "../voice/placeholder.js";
|
|
15
17
|
import { splitIntoBeats } from "../voice/voiceover.js";
|
|
16
18
|
import { CliFailure, fail } from "./failure.js";
|
|
17
19
|
import { loadFilm, type LoadedFilm } from "./films.js";
|
|
18
20
|
import { writeOgImages } from "./og.js";
|
|
19
|
-
import { getRecordingDay, readOptions, type FilmOptions, type
|
|
21
|
+
import { getRecordingDay, readOptions, type EntryShotsOptions, type FilmOptions, type PageShotsOptions } from "./options.js";
|
|
20
22
|
import { ensureServer } from "./server.js";
|
|
21
|
-
import {
|
|
23
|
+
import { getFilmVoiceover, produceVoiceover, produceVoiceovers, readJson } from "./voice.js";
|
|
22
24
|
|
|
23
25
|
/**
|
|
24
26
|
* `softure-marketing`: the only way into the films.
|
|
25
27
|
*
|
|
26
|
-
* all <film>
|
|
27
|
-
* voice <film
|
|
28
|
+
* all <film> [--placeholder] voiceover from the cache (or the free placeholder) -> recording -> render -> post copy
|
|
29
|
+
* voice <film>... [--commit] voiceovers in order (paid only with --commit), spaced and stopped at the first error
|
|
28
30
|
* record <film> [--today=YYYY-MM-DD] [--url=...] (--today overrides the video's today)
|
|
29
31
|
* render <film> [--quality=draft|standard|high]
|
|
30
32
|
* preview <film>
|
|
31
33
|
* posts <film>
|
|
32
34
|
* og [image]
|
|
33
35
|
* shots [<id>] [--url=...]
|
|
36
|
+
* shots --page=<url> --out=<file.png> --expect=<phrase> [...]
|
|
34
37
|
*/
|
|
35
38
|
|
|
36
39
|
const getBuildDir = (config: MarketingConfig, film: LoadedFilm) => join(config.output.buildDir, film.id);
|
|
@@ -44,7 +47,8 @@ function preflight(config: MarketingConfig, film: LoadedFilm, needsRender: boole
|
|
|
44
47
|
}
|
|
45
48
|
|
|
46
49
|
async function record(config: MarketingConfig, film: LoadedFilm, options: FilmOptions): Promise<RecordingLog> {
|
|
47
|
-
const voiceover =
|
|
50
|
+
const { voiceover, key, isPlaceholder } = getFilmVoiceover(config, film, { isPlaceholder: options.isPlaceholder, buildDir: getBuildDir(config, film) });
|
|
51
|
+
if (isPlaceholder) console.log(`voiceover: the placeholder (a tone, ${config.voice.placeholder.wordsPerSecond} words a second); nothing paid, render it with --placeholder.`);
|
|
48
52
|
const voices = splitIntoBeats(voiceover.words, film.beats, film.voice.tempo);
|
|
49
53
|
const server = await ensureServer(config, film, options.url);
|
|
50
54
|
mkdirSync(getBuildDir(config, film), { recursive: true });
|
|
@@ -57,7 +61,7 @@ async function record(config: MarketingConfig, film: LoadedFilm, options: FilmOp
|
|
|
57
61
|
url: server.url,
|
|
58
62
|
outDir: getBuildDir(config, film),
|
|
59
63
|
voices,
|
|
60
|
-
voiceoverKey:
|
|
64
|
+
voiceoverKey: key,
|
|
61
65
|
today: recordingDay.day ?? undefined,
|
|
62
66
|
filmPath: film.scenePath,
|
|
63
67
|
executablePath: process.env.PLAYWRIGHT_CHROMIUM_PATH || undefined,
|
|
@@ -103,14 +107,21 @@ function render(config: MarketingConfig, film: LoadedFilm, options: FilmOptions)
|
|
|
103
107
|
if (!existsSync(logPath)) fail(`no recording: run softure-marketing record ${film.id} first.`);
|
|
104
108
|
// Our own file, written by `recordFilm`; the two fields that tie it to the script are checked below.
|
|
105
109
|
const log = readJson(logPath) as RecordingLog;
|
|
106
|
-
|
|
110
|
+
// A recording follows the timings of the voiceover it was made on, so a placeholder recording never renders
|
|
111
|
+
// with the paid voiceover, nor the reverse.
|
|
112
|
+
if (isPlaceholderKey(log.voiceoverKey) !== options.isPlaceholder) {
|
|
113
|
+
if (options.isPlaceholder) fail(`the recording was made on the paid voiceover: run softure-marketing record ${film.id} --placeholder, or render without --placeholder.`);
|
|
114
|
+
fail(`the recording was made on the placeholder voiceover: run softure-marketing record ${film.id} for the paid one, or render with --placeholder.`);
|
|
115
|
+
}
|
|
116
|
+
const { voiceover, key } = getFilmVoiceover(config, film, { isPlaceholder: options.isPlaceholder, buildDir: dir });
|
|
107
117
|
// The recording must match the script; otherwise the action times belong to another voiceover or
|
|
108
118
|
// other sentences, and the film would come out silently out of sync.
|
|
109
119
|
const beatIds = sceneBeats(film).map((beat) => beat.id);
|
|
110
|
-
if (log.voiceoverKey !==
|
|
111
|
-
fail(`the recording does not match the current script (the sentences or the voiceover changed): run softure-marketing record ${film.id}.`);
|
|
120
|
+
if (log.voiceoverKey !== key || log.beatIds?.join(",") !== beatIds.join(",")) {
|
|
121
|
+
fail(`the recording does not match the current script (the sentences or the voiceover changed): run softure-marketing record ${film.id}${options.isPlaceholder ? " --placeholder" : ""}.`);
|
|
112
122
|
}
|
|
113
|
-
|
|
123
|
+
// A rehearsal never takes the place of the real film.
|
|
124
|
+
const output = join(getOutDir(config, film), options.isPlaceholder ? `${film.id}.placeholder.mp4` : `${film.id}.mp4`);
|
|
114
125
|
const seconds = renderFilm({
|
|
115
126
|
film,
|
|
116
127
|
log,
|
|
@@ -146,8 +157,57 @@ function selectScreenshots(config: MarketingConfig, shotId: string | undefined):
|
|
|
146
157
|
fail(`no screenshot "${shotId}" in ${config.file}; known: ${config.screenshots.map((entry) => entry.id).join(", ") || "none"}.`);
|
|
147
158
|
}
|
|
148
159
|
|
|
149
|
-
|
|
150
|
-
|
|
160
|
+
/** The entries with their storage state as an absolute path, each checked before the browser starts. */
|
|
161
|
+
function resolveStorageStates(config: MarketingConfig, entries: [ScreenshotEntry, ...ScreenshotEntry[]]): [ScreenshotEntry, ...ScreenshotEntry[]] {
|
|
162
|
+
const [first, ...rest] = entries.map((entry) => {
|
|
163
|
+
if (entry.storageState === undefined) return entry;
|
|
164
|
+
const path = resolve(config.root, entry.storageState);
|
|
165
|
+
const problem = findStorageStateProblem(path);
|
|
166
|
+
if (problem !== null) fail(`screenshot "${entry.id}": ${problem}.`);
|
|
167
|
+
return { ...entry, storageState: path };
|
|
168
|
+
});
|
|
169
|
+
// The map keeps the length of a non-empty tuple.
|
|
170
|
+
return [first as ScreenshotEntry, ...rest];
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
function getScreenshotBrowser(config: MarketingConfig): ScreenshotBrowser {
|
|
174
|
+
return { colorScheme: config.app.colorScheme, locale: config.brand.locale, timezone: config.brand.timezone, hideSelectors: config.app.hideSelectors };
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/** Prints each result and fails when any shot was refused. */
|
|
178
|
+
function reportScreenshots(results: ScreenshotResult[]): void {
|
|
179
|
+
for (const result of results) {
|
|
180
|
+
if (result.ok) console.log(`✓ ${result.file} (${(result.bytes / 1000).toFixed(0)} kB)`);
|
|
181
|
+
else console.error(`✗ ${result.name}: ${result.message}`);
|
|
182
|
+
}
|
|
183
|
+
const failed = results.filter((result) => !result.ok).length;
|
|
184
|
+
if (failed > 0) fail(`${failed} of ${results.length} screenshots failed their gates; see above.`);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/** `shots --page`: one page anywhere; the app is not started, and the storage state resolves from the current directory. */
|
|
188
|
+
async function pageShot(config: MarketingConfig, options: PageShotsOptions): Promise<void> {
|
|
189
|
+
let { entry } = options;
|
|
190
|
+
if (entry.storageState !== undefined) {
|
|
191
|
+
const path = resolve(entry.storageState);
|
|
192
|
+
const problem = findStorageStateProblem(path);
|
|
193
|
+
if (problem !== null) fail(`--auth: ${problem}.`);
|
|
194
|
+
entry = { ...entry, storageState: path };
|
|
195
|
+
}
|
|
196
|
+
const file = resolve(options.out);
|
|
197
|
+
console.log(`screenshot: ${options.page}.`);
|
|
198
|
+
const result = await takePageScreenshot({
|
|
199
|
+
entry,
|
|
200
|
+
url: options.page,
|
|
201
|
+
file,
|
|
202
|
+
scheme: options.scheme,
|
|
203
|
+
browser: getScreenshotBrowser(config),
|
|
204
|
+
executablePath: process.env.PLAYWRIGHT_CHROMIUM_PATH || undefined,
|
|
205
|
+
});
|
|
206
|
+
reportScreenshots([result]);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
async function shots(config: MarketingConfig, options: EntryShotsOptions): Promise<void> {
|
|
210
|
+
const entries = resolveStorageStates(config, selectScreenshots(config, options.shotId));
|
|
151
211
|
const [first] = entries;
|
|
152
212
|
const target = { url: new URL(first.path, config.app.baseUrl).href, ownUrl: `http://localhost:${config.app.port}${first.path}` };
|
|
153
213
|
const server = await ensureServer(config, target, options.url === undefined ? undefined : new URL(first.path, options.url).href);
|
|
@@ -160,22 +220,12 @@ async function shots(config: MarketingConfig, options: ShotsOptions): Promise<vo
|
|
|
160
220
|
baseUrl: server.url,
|
|
161
221
|
outDir,
|
|
162
222
|
executablePath: process.env.PLAYWRIGHT_CHROMIUM_PATH || undefined,
|
|
163
|
-
browser:
|
|
164
|
-
colorScheme: config.app.colorScheme,
|
|
165
|
-
locale: config.brand.locale,
|
|
166
|
-
timezone: config.brand.timezone,
|
|
167
|
-
hideSelectors: config.app.hideSelectors,
|
|
168
|
-
},
|
|
223
|
+
browser: getScreenshotBrowser(config),
|
|
169
224
|
});
|
|
170
225
|
} finally {
|
|
171
226
|
server.stop();
|
|
172
227
|
}
|
|
173
|
-
|
|
174
|
-
if (result.ok) console.log(`✓ ${result.file} (${(result.bytes / 1000).toFixed(0)} kB)`);
|
|
175
|
-
else console.error(`✗ ${result.name}: ${result.message}`);
|
|
176
|
-
}
|
|
177
|
-
const failed = results.filter((result) => !result.ok).length;
|
|
178
|
-
if (failed > 0) fail(`${failed} of ${results.length} screenshots failed their gates; see above.`);
|
|
228
|
+
reportScreenshots(results);
|
|
179
229
|
}
|
|
180
230
|
|
|
181
231
|
async function main(argv: string[]): Promise<void> {
|
|
@@ -190,15 +240,20 @@ async function main(argv: string[]): Promise<void> {
|
|
|
190
240
|
return;
|
|
191
241
|
}
|
|
192
242
|
if (options.command === "shots") {
|
|
193
|
-
await
|
|
243
|
+
if (options.mode === "page") await pageShot(config, options);
|
|
244
|
+
else await shots(config, options);
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
if (options.command === "voice") {
|
|
248
|
+
// Every film is loaded before the first paid call, so a typo in the fifth id costs nothing.
|
|
249
|
+
const films: LoadedFilm[] = [];
|
|
250
|
+
for (const id of options.filmIds) films.push(await loadFilm(config, id));
|
|
251
|
+
await produceVoiceovers(config, films, options.isCommit);
|
|
194
252
|
return;
|
|
195
253
|
}
|
|
196
254
|
const film = await loadFilm(config, options.filmId);
|
|
197
255
|
|
|
198
256
|
switch (options.command) {
|
|
199
|
-
case "voice":
|
|
200
|
-
await produceVoiceover(config, film, options.isCommit);
|
|
201
|
-
return;
|
|
202
257
|
case "record":
|
|
203
258
|
preflight(config, film, false);
|
|
204
259
|
await record(config, film, options);
|
|
@@ -219,7 +274,9 @@ async function main(argv: string[]): Promise<void> {
|
|
|
219
274
|
}
|
|
220
275
|
case "all": {
|
|
221
276
|
preflight(config, film, true);
|
|
222
|
-
if ((await produceVoiceover(config, film, false)) === null)
|
|
277
|
+
if (!options.isPlaceholder && (await produceVoiceover(config, film, false)) === null) {
|
|
278
|
+
fail(`no voiceover; see the message above. To rehearse the film for free: softure-marketing all ${film.id} --placeholder.`);
|
|
279
|
+
}
|
|
223
280
|
await record(config, film, options);
|
|
224
281
|
render(config, film, options);
|
|
225
282
|
return;
|