Home
About
Blog
Products
Forum
Support
Contact
Sunbelt Computer Software
PL/B Language Development and Support
Home
About
Blog
Products
Forum
Support
Contact
hyperframes/scripts/creator-editing-recipes.test.mjs at main · heygen-com/hyperframes · GitHub
Skip to content
Navigation Menu
Sign in
Products
Platform
GitHub
Repository hosting, code review, and collaboration
Copilot
AI coding agent for tasks, projects and automated work
Build & Ship
Actions
CI/CD and automation
Code Quality
Quality analysis, fixes, and enforcement
Codespaces
Cloud development environments
Secure
Code Security
Vulnerability detection and remediation
Secret Protection
Secret scanning and leak prevention
All Features
Developers
Learn
Documentation
Training
Certifications
Build
Build with Copilot
Customize Copilot
Integrations
Explore
Trending repos
GitHub Sponsors
Events
Changelog
Changelog
Your source for the latest features, improvements, and fixes across GitHub products, all in one place.
Businesses
By Stage
Enterprises
Team
Startups
Nonprofits
By Industry
Healthcare
Financial services
Manufacturing
Government
See all industries
Evaluate GitHub
Why GitHub
Customer Stories
Business insights
Trust Center
Add-ons
GitHub Advanced Security
Enterprise-grade code security
Copilot for business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Resources
Learn & Connect
Documentation
Resource center
Blog
Events & webinars
Community Forum
Customer Stories
Integrations
Support
Customer support
Training
GitHub Status
Company
About
Partners
Changelog
GitHub Universe
GitHub Universe
The event for developers, by developers — talks, workshops, and what’s next for GitHub.
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
heygen-com
hyperframes
Repository navigation
Code
Issues
73
(73)
Pull requests
122
(122)
Discussions
Actions
Projects
Security and quality
Insights
More
items
Files
Expand file tree
main
Breadcrumbs
hyperframes
/
scripts
/
creator-editing-recipes.test.mjs
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
121 lines (107 loc) · 5.28 KB
main
Breadcrumbs
hyperframes
/
scripts
/
creator-editing-recipes.test.mjs
Copy path
Top
File metadata and controls
Code
Blame
121 lines (107 loc) · 5.28 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
import
assert
from
"node:assert/strict"
;
import
{
readFile
}
from
"node:fs/promises"
;
import
test
from
"node:test"
;
import
{
lintHyperframeHtml
}
from
"../packages/lint/src/index.ts"
;
const
MIXING
=
"skills/media-use/references/mixing.md"
;
const
FORMAT
=
"skills/hyperframes/references/format.md"
;
const
ENTRY_SKILL
=
"skills/hyperframes/SKILL.md"
;
const
VOLUME_TWEEN
=
/
\.
(?:
t
o
|
f
r
o
m
|
f
r
o
m
T
o
|
s
e
t
)
\(
\s
*
[
"
'
`
]
#
[
\w
-
]
+
[
"
'
`
]
\s
*
,
\s
*
\{
[
^
}
]
*
\b
v
o
l
u
m
e
\s
*
:
/
;
const
TWEEN_SCANNED
=
[
ENTRY_SKILL
,
FORMAT
,
"skills/hyperframes/references/runtimes.md"
,
"skills/hyperframes/references/motion.md"
,
"skills/hyperframes/references/film.md"
,
"skills/media-use/references/operations.md"
,
"packages/cli/src/docs/data-attributes.md"
,
]
;
const
read
=
(
path
)
=>
readFile
(
new
URL
(
`../
${
path
}
`
,
import
.
meta
.
url
)
,
"utf8"
)
;
const
htmlBlocks
=
(
md
)
=>
[
...
md
.
matchAll
(
/
`
`
`
h
t
m
l
\n
(
[
\s
\S
]
*
?
)
`
`
`
/
g
)
]
.
map
(
(
m
)
=>
m
[
1
]
)
;
const
wrap
=
(
fragment
)
=>
fragment
.
includes
(
"<html"
)
?
fragment
:
`<html><body><div id="root" data-composition-id="main" data-start="0" data-duration="120" data-width="1920" data-height="1080">
${
fragment
}
</div><script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script><script>window.__timelines = window.__timelines || {};</script></body></html>`
;
test
(
"every html example in the mixing doc lints with no errors and no volume double-automation"
,
async
(
)
=>
{
const
blocks
=
htmlBlocks
(
await
read
(
MIXING
)
)
;
assert
.
ok
(
blocks
.
length
>=
1
,
"expected the mixing doc to keep its worked example"
)
;
for
(
const
[
i
,
block
]
of
blocks
.
entries
(
)
)
{
const
{
findings
}
=
await
lintHyperframeHtml
(
wrap
(
block
)
,
{
filePath
:
"index.html"
}
)
;
const
bad
=
findings
.
filter
(
(
f
)
=>
f
.
severity
===
"error"
||
f
.
code
.
startsWith
(
"audio_volume_"
)
,
)
;
assert
.
deepEqual
(
bad
.
map
(
(
f
)
=>
`
${
f
.
code
}
:
${
f
.
message
}
`
)
,
[
]
,
`example
${
i
+
1
}
in
${
MIXING
}
`
,
)
;
}
}
)
;
test
(
"no other doc teaches a timeline tween as the way to fade volume"
,
async
(
)
=>
{
for
(
const
path
of
TWEEN_SCANNED
)
{
const
lines
=
(
await
read
(
path
)
)
.
split
(
"\n"
)
;
const
hit
=
lines
.
findIndex
(
(
l
)
=>
VOLUME_TWEEN
.
test
(
l
)
)
;
assert
.
equal
(
hit
,
-
1
,
`
${
path
}
:
${
hit
+
1
}
teaches a volume tween; point at
${
MIXING
}
`
)
;
}
}
)
;
test
(
"the Remotion translation docs do not claim volume ramps are unsupported"
,
async
(
)
=>
{
for
(
const
path
of
[
"skills/remotion-to-hyperframes/references/limitations.md"
,
"skills/remotion-to-hyperframes/references/media.md"
,
]
)
{
assert
.
doesNotMatch
(
await
read
(
path
)
,
/
s
t
a
t
i
c
`
d
a
t
a
-
v
o
l
u
m
e
`
o
n
l
y
/
,
path
)
;
}
}
)
;
test
(
"the entry skill's safe boxes equal the preview's"
,
async
(
)
=>
{
const
src
=
await
read
(
"packages/studio/src/utils/previewSafeMargins.ts"
)
;
const
action
=
src
.
match
(
/
A
C
T
I
O
N
_
S
A
F
E
_
P
E
R
C
E
N
T
=
(
\d
+
)
/
)
?.
[
1
]
;
const
title
=
src
.
match
(
/
T
I
T
L
E
_
S
A
F
E
_
P
E
R
C
E
N
T
=
(
\d
+
)
/
)
?.
[
1
]
;
const
skill
=
await
read
(
ENTRY_SKILL
)
;
assert
.
match
(
skill
,
new
RegExp
(
`
${
action
}
% action-safe`
)
)
;
assert
.
match
(
skill
,
new
RegExp
(
`
${
title
}
% title-safe`
)
)
;
}
)
;
async
function
studioDefaultSeconds
(
kind
)
{
const
helpers
=
await
read
(
"packages/studio/src/utils/studioHelpers.ts"
)
;
const
block
=
helpers
.
match
(
/
D
E
F
A
U
L
T
_
T
I
M
E
L
I
N
E
_
A
S
S
E
T
_
D
U
R
A
T
I
O
N
[
^
=
]
*
=
\s
*
\{
(
[
^
}
]
*
)
\}
/
)
;
const
defaults
=
block
?
block
[
1
]
:
""
;
const
value
=
defaults
.
match
(
new
RegExp
(
`
${
kind
}
:\\s*(\\d+(?:\\.\\d+)?)`
)
)
;
return
value
?
value
[
1
]
:
undefined
;
}
async
function
addMediaSection
(
)
{
const
doc
=
await
read
(
FORMAT
)
;
const
afterHeading
=
doc
.
split
(
"## Adding media"
)
[
1
]
??
""
;
return
afterHeading
.
split
(
"\n## "
)
[
0
]
;
}
test
(
"an image without a duration lasts Studio's default image duration"
,
async
(
)
=>
{
const
imageSecs
=
await
studioDefaultSeconds
(
"image"
)
;
assert
.
ok
(
imageSecs
,
"could not read Studio's image default"
)
;
assert
.
match
(
await
read
(
FORMAT
)
,
new
RegExp
(
`an \`<img>\` without one lasts
${
imageSecs
}
s`
)
)
;
}
)
;
test
(
"the add-media recipe raises the root's duration and never probes the file"
,
async
(
)
=>
{
const
section
=
await
addMediaSection
(
)
;
assert
.
match
(
section
,
/
R
a
i
s
e
t
h
e
r
o
o
t
'
s
`
d
a
t
a
-
d
u
r
a
t
i
o
n
`
t
o
c
o
v
e
r
t
h
e
n
e
w
c
l
i
p
'
s
e
n
d
/
)
;
assert
.
doesNotMatch
(
section
,
/
f
f
p
r
o
b
e
/
)
;
}
)
;
test
(
"the add-media recipe uses Studio's full-frame geometry"
,
async
(
)
=>
{
const
section
=
await
addMediaSection
(
)
;
const
dropOps
=
await
read
(
"packages/studio/src/hooks/useTimelineAssetDropOps.ts"
)
;
assert
.
match
(
dropOps
,
/
f
i
t
T
i
m
e
l
i
n
e
A
s
s
e
t
G
e
o
m
e
t
r
y
\(
\s
*
n
u
l
l
,
/
,
"Studio centres by natural size now; update the doc"
,
)
;
assert
.
match
(
section
,
/
f
i
l
l
t
h
e
f
r
a
m
e
/
)
;
assert
.
match
(
section
,
/
l
e
f
t
:
0
;
t
o
p
:
0
/
)
;
assert
.
match
(
section
,
/
w
i
d
t
h
a
n
d
h
e
i
g
h
t
e
q
u
a
l
t
o
t
h
e
c
a
n
v
a
s
/
)
;
}
)
;
test
(
"the add-media recipe names every attribute Studio's drop writes, and no media duration"
,
async
(
)
=>
{
const
section
=
await
addMediaSection
(
)
;
const
drop
=
await
read
(
"packages/studio/src/utils/timelineAssetDrop.ts"
)
;
for
(
const
attr
of
[
'class="clip"'
,
"data-start"
,
"data-duration"
,
"data-track-index"
]
)
{
assert
.
ok
(
drop
.
includes
(
attr
)
,
`Studio no longer writes
${
attr
}
`
)
;
}
const
attributes
=
section
.
split
(
"\n"
)
.
find
(
(
line
)
=>
line
.
startsWith
(
"- `id`"
)
)
??
""
;
for
(
const
attr
of
[
"`id`"
,
'class="clip"'
,
"data-start"
,
"data-track-index"
]
)
{
assert
.
ok
(
attributes
.
includes
(
attr
)
,
`the add-media attributes lack
${
attr
}
`
)
;
}
assert
.
doesNotMatch
(
attributes
,
/
d
a
t
a
-
d
u
r
a
t
i
o
n
/
,
"media must not author a duration"
)
;
}
)
;
You can’t perform that action at this time.