@devmotion/cli 0.0.1
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 +195 -0
- package/dist/index.js +1002 -0
- package/package.json +59 -0
- package/scripts/postinstall.mjs +60 -0
- package/templates/bare.html +9 -0
- package/templates/default.html +27 -0
- package/templates/gsap.html +24 -0
- package/templates/lottie.html +26 -0
package/package.json
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@devmotion/cli",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "HTML-first, agent-friendly video tooling. Write HTML. Render video.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"bin": {
|
|
8
|
+
"devmotion": "./dist/index.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist",
|
|
12
|
+
"templates",
|
|
13
|
+
"scripts",
|
|
14
|
+
"README.md"
|
|
15
|
+
],
|
|
16
|
+
"scripts": {
|
|
17
|
+
"build": "tsup",
|
|
18
|
+
"postinstall": "node ./scripts/postinstall.mjs",
|
|
19
|
+
"prepublishOnly": "pnpm build",
|
|
20
|
+
"test": "vitest --run",
|
|
21
|
+
"test:watch": "vitest"
|
|
22
|
+
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"@devmotion/studio": "workspace:*",
|
|
25
|
+
"@ffmpeg-installer/ffmpeg": "^1.1.0",
|
|
26
|
+
"citty": "^0.1.6",
|
|
27
|
+
"nanoid": "^5.1.5",
|
|
28
|
+
"playwright": "1.50.0"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@types/node": "^22.10.0",
|
|
32
|
+
"tsup": "^8.3.5",
|
|
33
|
+
"vitest": "^3.2.4"
|
|
34
|
+
},
|
|
35
|
+
"engines": {
|
|
36
|
+
"node": ">=20"
|
|
37
|
+
},
|
|
38
|
+
"keywords": [
|
|
39
|
+
"video",
|
|
40
|
+
"animation",
|
|
41
|
+
"html",
|
|
42
|
+
"agent",
|
|
43
|
+
"mcp",
|
|
44
|
+
"ffmpeg",
|
|
45
|
+
"playwright",
|
|
46
|
+
"lottie",
|
|
47
|
+
"gsap"
|
|
48
|
+
],
|
|
49
|
+
"license": "Apache-2.0",
|
|
50
|
+
"repository": {
|
|
51
|
+
"type": "git",
|
|
52
|
+
"url": "https://github.com/devmotion/devmotion",
|
|
53
|
+
"directory": "packages/cli"
|
|
54
|
+
},
|
|
55
|
+
"homepage": "https://devmotion.com",
|
|
56
|
+
"publishConfig": {
|
|
57
|
+
"access": "public"
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* postinstall — download the Chromium browser Playwright needs for rendering.
|
|
4
|
+
*
|
|
5
|
+
* Best-effort: if the install fails (CI, restricted network, etc.) we log a
|
|
6
|
+
* notice and keep going. The user can re-run it manually via
|
|
7
|
+
* npx playwright install chromium
|
|
8
|
+
* `devmotion doctor` will surface the missing browser if it ever happens.
|
|
9
|
+
*
|
|
10
|
+
* Skipped automatically when:
|
|
11
|
+
* - DEVMOTION_SKIP_POSTINSTALL=1 is set
|
|
12
|
+
* - CI=true (most CIs cache browsers separately or don't need them)
|
|
13
|
+
* - PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD is set (Playwright's own convention)
|
|
14
|
+
*/
|
|
15
|
+
import { spawnSync } from 'node:child_process';
|
|
16
|
+
import { existsSync } from 'node:fs';
|
|
17
|
+
import { dirname, join } from 'node:path';
|
|
18
|
+
import { createRequire } from 'node:module';
|
|
19
|
+
const require = createRequire(import.meta.url);
|
|
20
|
+
|
|
21
|
+
if (
|
|
22
|
+
process.env.DEVMOTION_SKIP_POSTINSTALL === '1' ||
|
|
23
|
+
process.env.PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD === '1' ||
|
|
24
|
+
process.env.CI === 'true'
|
|
25
|
+
) {
|
|
26
|
+
console.log('[devmotion] postinstall skipped (env flag set)');
|
|
27
|
+
process.exit(0);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Playwright doesn't export a `playwright/cli` subpath, so resolve the package
|
|
31
|
+
// root and run its `cli.js` binary directly.
|
|
32
|
+
let playwrightCli;
|
|
33
|
+
try {
|
|
34
|
+
playwrightCli = join(dirname(require.resolve('playwright/package.json')), 'cli.js');
|
|
35
|
+
} catch {
|
|
36
|
+
playwrightCli = undefined;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (!playwrightCli || !existsSync(playwrightCli)) {
|
|
40
|
+
console.warn(
|
|
41
|
+
'\n[devmotion] Playwright not found — skipping Chromium download.\n' +
|
|
42
|
+
' Run manually before `devmotion render`: npx playwright install chromium\n'
|
|
43
|
+
);
|
|
44
|
+
process.exit(0);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
console.log('[devmotion] downloading Playwright Chromium (~150 MB, one-time)...');
|
|
48
|
+
const res = spawnSync(process.execPath, [playwrightCli, 'install', 'chromium'], {
|
|
49
|
+
stdio: 'inherit'
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
if (res.status !== 0) {
|
|
53
|
+
console.warn(
|
|
54
|
+
'\n[devmotion] Could not auto-install Chromium. Run this manually before `devmotion render`:\n' +
|
|
55
|
+
' npx playwright install chromium\n'
|
|
56
|
+
);
|
|
57
|
+
// Do NOT fail the overall install — `devmotion preview` works without it,
|
|
58
|
+
// and `devmotion doctor` will flag it later.
|
|
59
|
+
process.exit(0);
|
|
60
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
</head>
|
|
6
|
+
<body>
|
|
7
|
+
<div
|
|
8
|
+
data-dm-id="title"
|
|
9
|
+
data-dm-enter="fade-in"
|
|
10
|
+
data-dm-enter-time="0.5"
|
|
11
|
+
data-dm-duration="0.8"
|
|
12
|
+
data-dm-easing="ease-out"
|
|
13
|
+
style="
|
|
14
|
+
display: flex;
|
|
15
|
+
align-items: center;
|
|
16
|
+
justify-content: center;
|
|
17
|
+
width: 100%;
|
|
18
|
+
height: 100%;
|
|
19
|
+
color: #fff;
|
|
20
|
+
font-size: 48px;
|
|
21
|
+
font-family: system-ui, sans-serif;
|
|
22
|
+
"
|
|
23
|
+
>
|
|
24
|
+
New Scene
|
|
25
|
+
</div>
|
|
26
|
+
</body>
|
|
27
|
+
</html>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.5/gsap.min.js"></script>
|
|
6
|
+
</head>
|
|
7
|
+
<body>
|
|
8
|
+
<div
|
|
9
|
+
data-dm-id="animated-box"
|
|
10
|
+
data-dm-enter-time="0"
|
|
11
|
+
data-dm-duration="3"
|
|
12
|
+
style="width: 100px; height: 100px; background: #3b82f6; border-radius: 8px"
|
|
13
|
+
></div>
|
|
14
|
+
<script>
|
|
15
|
+
// GSAP animations are captured frame-by-frame by the virtualized clock
|
|
16
|
+
gsap.to('[data-dm-id="animated-box"]', {
|
|
17
|
+
x: 300,
|
|
18
|
+
rotation: 360,
|
|
19
|
+
duration: 2,
|
|
20
|
+
ease: 'power2.out'
|
|
21
|
+
});
|
|
22
|
+
</script>
|
|
23
|
+
</body>
|
|
24
|
+
</html>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/bodymovin/5.12.2/lottie.min.js"></script>
|
|
6
|
+
</head>
|
|
7
|
+
<body>
|
|
8
|
+
<div
|
|
9
|
+
data-dm-id="lottie-animation"
|
|
10
|
+
data-dm-enter-time="0"
|
|
11
|
+
data-dm-duration="3"
|
|
12
|
+
style="width: 300px; height: 300px"
|
|
13
|
+
></div>
|
|
14
|
+
<script>
|
|
15
|
+
// DevMotion auto-detects Lottie and drives every loaded animation
|
|
16
|
+
// frame-by-frame from the timeline — no DevMotion hooks needed.
|
|
17
|
+
lottie.loadAnimation({
|
|
18
|
+
container: document.querySelector('[data-dm-id="lottie-animation"]'),
|
|
19
|
+
renderer: 'svg',
|
|
20
|
+
loop: true,
|
|
21
|
+
autoplay: true,
|
|
22
|
+
path: './assets/animation.json'
|
|
23
|
+
});
|
|
24
|
+
</script>
|
|
25
|
+
</body>
|
|
26
|
+
</html>
|