@revideo/create 0.5.10 → 0.5.11-alpha.1101
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/package.json +9 -9
- package/examples/README.md +0 -43
- package/examples/avatar-with-background/package.json +0 -27
- package/examples/avatar-with-background/src/project.meta +0 -31
- package/examples/avatar-with-background/src/project.ts +0 -6
- package/examples/avatar-with-background/src/render.ts +0 -14
- package/examples/avatar-with-background/src/revideo.d.ts +0 -1
- package/examples/avatar-with-background/src/scenes/example.meta +0 -5
- package/examples/avatar-with-background/src/scenes/example.tsx +0 -28
- package/examples/avatar-with-background/tsconfig.json +0 -9
- package/examples/avatar-with-background/vite.config.ts +0 -8
- package/examples/default/package.json +0 -24
- package/examples/default/src/project.meta +0 -31
- package/examples/default/src/project.ts +0 -7
- package/examples/default/src/render.ts +0 -15
- package/examples/default/src/revideo.d.ts +0 -1
- package/examples/default/src/scenes/example.tsx +0 -38
- package/examples/default/tsconfig.json +0 -9
- package/examples/default/vite.config.ts +0 -8
- package/examples/github-stars-celebration/package-lock.json +0 -3833
- package/examples/github-stars-celebration/package.json +0 -24
- package/examples/github-stars-celebration/src/global.css +0 -1
- package/examples/github-stars-celebration/src/project.meta +0 -28
- package/examples/github-stars-celebration/src/project.ts +0 -8
- package/examples/github-stars-celebration/src/render.ts +0 -15
- package/examples/github-stars-celebration/src/revideo.d.ts +0 -1
- package/examples/github-stars-celebration/src/scenes/example.meta +0 -5
- package/examples/github-stars-celebration/src/scenes/example.tsx +0 -51
- package/examples/github-stars-celebration/tsconfig.json +0 -9
- package/examples/github-stars-celebration/vite.config.ts +0 -8
- package/examples/google-cloud-run-parallelized/README.md +0 -127
- package/examples/google-cloud-run-parallelized/render-orchestrator/Dockerfile +0 -56
- package/examples/google-cloud-run-parallelized/render-orchestrator/package.json +0 -22
- package/examples/google-cloud-run-parallelized/render-orchestrator/src/index.ts +0 -72
- package/examples/google-cloud-run-parallelized/render-orchestrator/src/revideo.d.ts +0 -1
- package/examples/google-cloud-run-parallelized/render-orchestrator/tsconfig.json +0 -10
- package/examples/google-cloud-run-parallelized/render-worker/.gcloudignore +0 -17
- package/examples/google-cloud-run-parallelized/render-worker/.puppeteerrc.cjs +0 -9
- package/examples/google-cloud-run-parallelized/render-worker/package.json +0 -30
- package/examples/google-cloud-run-parallelized/render-worker/src/index.ts +0 -45
- package/examples/google-cloud-run-parallelized/render-worker/src/project.meta +0 -31
- package/examples/google-cloud-run-parallelized/render-worker/src/project.ts +0 -6
- package/examples/google-cloud-run-parallelized/render-worker/src/render.ts +0 -14
- package/examples/google-cloud-run-parallelized/render-worker/src/revideo.d.ts +0 -1
- package/examples/google-cloud-run-parallelized/render-worker/src/scenes/example.tsx +0 -30
- package/examples/google-cloud-run-parallelized/render-worker/tsconfig.json +0 -13
- package/examples/google-cloud-run-parallelized/render-worker/vite.config.ts +0 -9
- package/examples/logo.svg +0 -6
- package/examples/logo_dark.svg +0 -6
- package/examples/marketing-templates/README.md +0 -10
- package/examples/marketing-templates/marketing-template/package.json +0 -24
- package/examples/marketing-templates/marketing-template/src/globals.css +0 -0
- package/examples/marketing-templates/marketing-template/src/project.meta +0 -28
- package/examples/marketing-templates/marketing-template/src/project.ts +0 -9
- package/examples/marketing-templates/marketing-template/src/render.ts +0 -15
- package/examples/marketing-templates/marketing-template/src/revideo.d.ts +0 -1
- package/examples/marketing-templates/marketing-template/src/scenes/example.meta +0 -5
- package/examples/marketing-templates/marketing-template/src/scenes/example.tsx +0 -67
- package/examples/marketing-templates/marketing-template/tsconfig.json +0 -9
- package/examples/marketing-templates/marketing-template/vite.config.ts +0 -9
- package/examples/marketing-templates/multiple-videos-in-one/package.json +0 -24
- package/examples/marketing-templates/multiple-videos-in-one/src/project.meta +0 -28
- package/examples/marketing-templates/multiple-videos-in-one/src/project.ts +0 -9
- package/examples/marketing-templates/multiple-videos-in-one/src/render.ts +0 -15
- package/examples/marketing-templates/multiple-videos-in-one/src/revideo.d.ts +0 -1
- package/examples/marketing-templates/multiple-videos-in-one/src/scenes/example.meta +0 -5
- package/examples/marketing-templates/multiple-videos-in-one/src/scenes/example.tsx +0 -122
- package/examples/marketing-templates/multiple-videos-in-one/tsconfig.json +0 -9
- package/examples/marketing-templates/multiple-videos-in-one/vite.config.ts +0 -9
- package/examples/minimal-drag-drop/README.md +0 -27
- package/examples/minimal-drag-drop/next/app/api/render/route.ts +0 -22
- package/examples/minimal-drag-drop/next/app/globals.css +0 -3
- package/examples/minimal-drag-drop/next/app/layout.tsx +0 -25
- package/examples/minimal-drag-drop/next/app/page.tsx +0 -277
- package/examples/minimal-drag-drop/next/next-env.d.ts +0 -5
- package/examples/minimal-drag-drop/next/next.config.mjs +0 -4
- package/examples/minimal-drag-drop/next/package-lock.json +0 -5577
- package/examples/minimal-drag-drop/next/package.json +0 -35
- package/examples/minimal-drag-drop/next/postcss.config.js +0 -6
- package/examples/minimal-drag-drop/next/public/favicon.ico +0 -0
- package/examples/minimal-drag-drop/next/public/next.svg +0 -1
- package/examples/minimal-drag-drop/next/public/vercel.svg +0 -1
- package/examples/minimal-drag-drop/next/tailwind.config.ts +0 -30
- package/examples/minimal-drag-drop/next/tsconfig.json +0 -26
- package/examples/minimal-drag-drop/next/utils/parse.ts +0 -35
- package/examples/minimal-drag-drop/revideo/package-lock.json +0 -3771
- package/examples/minimal-drag-drop/revideo/package.json +0 -24
- package/examples/minimal-drag-drop/revideo/src/global.css +0 -1
- package/examples/minimal-drag-drop/revideo/src/project.meta +0 -28
- package/examples/minimal-drag-drop/revideo/src/project.ts +0 -9
- package/examples/minimal-drag-drop/revideo/src/render.ts +0 -15
- package/examples/minimal-drag-drop/revideo/src/revideo.d.ts +0 -1
- package/examples/minimal-drag-drop/revideo/src/scenes/example.meta +0 -5
- package/examples/minimal-drag-drop/revideo/src/scenes/example.tsx +0 -44
- package/examples/minimal-drag-drop/revideo/tsconfig.json +0 -9
- package/examples/minimal-drag-drop/revideo/vite.config.ts +0 -6
- package/examples/parallelized-aws-lambda/.dockerignore +0 -3
- package/examples/parallelized-aws-lambda/Dockerfile +0 -21
- package/examples/parallelized-aws-lambda/Dockerfile.base +0 -64
- package/examples/parallelized-aws-lambda/README.md +0 -197
- package/examples/parallelized-aws-lambda/revideo-project/.puppeteerrc.cjs +0 -9
- package/examples/parallelized-aws-lambda/revideo-project/package-lock.json +0 -4133
- package/examples/parallelized-aws-lambda/revideo-project/package.json +0 -28
- package/examples/parallelized-aws-lambda/revideo-project/src/lambda.ts +0 -157
- package/examples/parallelized-aws-lambda/revideo-project/src/project.meta +0 -28
- package/examples/parallelized-aws-lambda/revideo-project/src/project.ts +0 -7
- package/examples/parallelized-aws-lambda/revideo-project/src/render.ts +0 -17
- package/examples/parallelized-aws-lambda/revideo-project/src/revideo.d.ts +0 -1
- package/examples/parallelized-aws-lambda/revideo-project/src/scenes/example.meta +0 -5
- package/examples/parallelized-aws-lambda/revideo-project/src/scenes/example.tsx +0 -30
- package/examples/parallelized-aws-lambda/revideo-project/tsconfig.json +0 -10
- package/examples/parallelized-aws-lambda/revideo-project/vite.config.ts +0 -9
- package/examples/reddit-post-video/README.md +0 -84
- package/examples/reddit-post-video/package-lock.json +0 -2941
- package/examples/reddit-post-video/package.json +0 -27
- package/examples/reddit-post-video/src/global.css +0 -1
- package/examples/reddit-post-video/src/metadata.json +0 -576
- package/examples/reddit-post-video/src/project.meta +0 -31
- package/examples/reddit-post-video/src/project.ts +0 -9
- package/examples/reddit-post-video/src/render.ts +0 -157
- package/examples/reddit-post-video/src/revideo.d.ts +0 -1
- package/examples/reddit-post-video/src/scenes/example.meta +0 -5
- package/examples/reddit-post-video/src/scenes/example.tsx +0 -74
- package/examples/reddit-post-video/tsconfig.json +0 -9
- package/examples/reddit-post-video/vite.config.ts +0 -6
- package/examples/rive-explanation-video/README.md +0 -9
- package/examples/rive-explanation-video/package.json +0 -25
- package/examples/rive-explanation-video/src/global.css +0 -1
- package/examples/rive-explanation-video/src/project.meta +0 -31
- package/examples/rive-explanation-video/src/project.ts +0 -8
- package/examples/rive-explanation-video/src/render.ts +0 -15
- package/examples/rive-explanation-video/src/revideo.d.ts +0 -1
- package/examples/rive-explanation-video/src/scenes/example.meta +0 -5
- package/examples/rive-explanation-video/src/scenes/example.tsx +0 -218
- package/examples/rive-explanation-video/tsconfig.json +0 -9
- package/examples/rive-explanation-video/vite.config.ts +0 -8
- package/examples/saas-template/.prettierrc +0 -9
- package/examples/saas-template/README.md +0 -28
- package/examples/saas-template/next/app/actions.tsx +0 -113
- package/examples/saas-template/next/app/api/render/route.ts +0 -22
- package/examples/saas-template/next/app/globals.css +0 -3
- package/examples/saas-template/next/app/layout.tsx +0 -25
- package/examples/saas-template/next/app/page.tsx +0 -187
- package/examples/saas-template/next/next.config.mjs +0 -4
- package/examples/saas-template/next/package.json +0 -34
- package/examples/saas-template/next/postcss.config.js +0 -6
- package/examples/saas-template/next/public/favicon.ico +0 -0
- package/examples/saas-template/next/public/next.svg +0 -1
- package/examples/saas-template/next/public/vercel.svg +0 -1
- package/examples/saas-template/next/tailwind.config.ts +0 -30
- package/examples/saas-template/next/tsconfig.json +0 -26
- package/examples/saas-template/next/utils/parse.ts +0 -35
- package/examples/saas-template/revideo/package.json +0 -24
- package/examples/saas-template/revideo/src/global.css +0 -1
- package/examples/saas-template/revideo/src/project.meta +0 -27
- package/examples/saas-template/revideo/src/project.ts +0 -9
- package/examples/saas-template/revideo/src/render.ts +0 -15
- package/examples/saas-template/revideo/src/revideo.d.ts +0 -1
- package/examples/saas-template/revideo/src/scenes/example.meta +0 -5
- package/examples/saas-template/revideo/src/scenes/example.tsx +0 -178
- package/examples/saas-template/revideo/tsconfig.json +0 -9
- package/examples/saas-template/revideo/vite.config.ts +0 -6
- package/examples/stitching-videos/README.md +0 -7
- package/examples/stitching-videos/package.json +0 -23
- package/examples/stitching-videos/src/project.meta +0 -28
- package/examples/stitching-videos/src/project.ts +0 -20
- package/examples/stitching-videos/src/render.ts +0 -27
- package/examples/stitching-videos/src/revideo.d.ts +0 -1
- package/examples/stitching-videos/src/scenes/example.tsx +0 -30
- package/examples/stitching-videos/tsconfig.json +0 -9
- package/examples/stitching-videos/vite.config.ts +0 -8
- package/examples/three-js-example/README.md +0 -8
- package/examples/three-js-example/package-lock.json +0 -2753
- package/examples/three-js-example/package.json +0 -25
- package/examples/three-js-example/src/components/Three.ts +0 -166
- package/examples/three-js-example/src/global.css +0 -1
- package/examples/three-js-example/src/project.meta +0 -31
- package/examples/three-js-example/src/project.ts +0 -8
- package/examples/three-js-example/src/render.ts +0 -15
- package/examples/three-js-example/src/revideo.d.ts +0 -1
- package/examples/three-js-example/src/scenes/basic3D.meta +0 -5
- package/examples/three-js-example/src/scenes/basic3D.tsx +0 -89
- package/examples/three-js-example/tsconfig.json +0 -9
- package/examples/three-js-example/vite.config.ts +0 -6
- package/examples/youtube-shorts/README.md +0 -65
- package/examples/youtube-shorts/package-lock.json +0 -3881
- package/examples/youtube-shorts/package.json +0 -30
- package/examples/youtube-shorts/src/get-assets.ts +0 -34
- package/examples/youtube-shorts/src/global.css +0 -3
- package/examples/youtube-shorts/src/metadata.json +0 -635
- package/examples/youtube-shorts/src/project.meta +0 -28
- package/examples/youtube-shorts/src/project.ts +0 -9
- package/examples/youtube-shorts/src/render.ts +0 -12
- package/examples/youtube-shorts/src/revideo.d.ts +0 -1
- package/examples/youtube-shorts/src/scenes/example.tsx +0 -224
- package/examples/youtube-shorts/src/utils.ts +0 -123
- package/examples/youtube-shorts/tsconfig.json +0 -9
- package/examples/youtube-shorts/vite.config.ts +0 -8
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
'use server';
|
|
2
|
-
|
|
3
|
-
import pLimit from 'p-limit';
|
|
4
|
-
|
|
5
|
-
const PER_PAGE = 30;
|
|
6
|
-
|
|
7
|
-
interface ReturnType {
|
|
8
|
-
stargazerTimes: number[];
|
|
9
|
-
status: 'success' | 'rate-limit' | 'error';
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
async function getStargazerTimesForPage(
|
|
13
|
-
repo: `${string}/${string}`,
|
|
14
|
-
page: number,
|
|
15
|
-
headers: HeadersInit,
|
|
16
|
-
): Promise<ReturnType> {
|
|
17
|
-
const response = await fetch(
|
|
18
|
-
`https://api.github.com/repos/${repo}/stargazers?page=${page}&per_page=${PER_PAGE}`,
|
|
19
|
-
{
|
|
20
|
-
headers: {
|
|
21
|
-
Accept: 'application/vnd.github.v3.star+json',
|
|
22
|
-
...headers,
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
);
|
|
26
|
-
|
|
27
|
-
if (response.status === 403) {
|
|
28
|
-
return {stargazerTimes: [], status: 'rate-limit'};
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
if (!response.ok) {
|
|
32
|
-
return {stargazerTimes: [], status: 'error'};
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const data = await response.json();
|
|
36
|
-
const dates: Date[] = data.map((stargazer: any) => new Date(stargazer.starred_at));
|
|
37
|
-
const msTimes = dates.map((date) => date.getTime());
|
|
38
|
-
|
|
39
|
-
return {
|
|
40
|
-
stargazerTimes: msTimes,
|
|
41
|
-
status: 'success',
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
const limit = pLimit(10);
|
|
46
|
-
|
|
47
|
-
async function getTimes(
|
|
48
|
-
repo: `${string}/${string}`,
|
|
49
|
-
totalPages: number,
|
|
50
|
-
headers: HeadersInit,
|
|
51
|
-
): Promise<ReturnType> {
|
|
52
|
-
const stargazerPromises: Promise<ReturnType>[] = [];
|
|
53
|
-
|
|
54
|
-
// Fetch all pages in parallel
|
|
55
|
-
for (let page = 1; page <= totalPages; page++) {
|
|
56
|
-
stargazerPromises.push(limit(() => getStargazerTimesForPage(repo, page, headers)));
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
const stargazerTimes = await Promise.all(stargazerPromises);
|
|
60
|
-
|
|
61
|
-
// In case of failure, return the first error
|
|
62
|
-
const objectsThatFailed = stargazerTimes.filter(({status}) => status !== 'success');
|
|
63
|
-
if (stargazerTimes.some(({status}) => status !== 'success')) {
|
|
64
|
-
return {
|
|
65
|
-
stargazerTimes: [],
|
|
66
|
-
status: objectsThatFailed[0].status,
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
const stargazerMs = stargazerTimes.map(({stargazerTimes}) => stargazerTimes).flat();
|
|
71
|
-
const sortedMs = stargazerMs.sort((a, b) => a - b);
|
|
72
|
-
|
|
73
|
-
const firstMs = sortedMs[0];
|
|
74
|
-
const relativeMs = sortedMs.map((ms) => ms - firstMs);
|
|
75
|
-
|
|
76
|
-
return {
|
|
77
|
-
stargazerTimes: relativeMs,
|
|
78
|
-
status: 'success',
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
export async function getGithubRepositoryInfo(
|
|
83
|
-
repoName: `${string}/${string}`,
|
|
84
|
-
key?: string,
|
|
85
|
-
): Promise<ReturnType & {repoImage: string}> {
|
|
86
|
-
const headers: HeadersInit = {};
|
|
87
|
-
|
|
88
|
-
if (key) {
|
|
89
|
-
headers.Authorization = `token ${key}`;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
const response = await fetch(`https://api.github.com/repos/${repoName}`, {
|
|
93
|
-
headers,
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
if (response.status === 403) {
|
|
97
|
-
return {stargazerTimes: [], repoImage: '', status: 'rate-limit'};
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
if (!response.ok) {
|
|
101
|
-
return {stargazerTimes: [], repoImage: '', status: 'error'};
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
const responseParsed = await response.json();
|
|
105
|
-
const pages = Math.ceil(responseParsed.stargazers_count / PER_PAGE);
|
|
106
|
-
const info = await getTimes(repoName, pages, headers);
|
|
107
|
-
|
|
108
|
-
return {
|
|
109
|
-
stargazerTimes: info.stargazerTimes,
|
|
110
|
-
repoImage: responseParsed.owner.avatar_url,
|
|
111
|
-
status: info.status,
|
|
112
|
-
};
|
|
113
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
const RENDER_URL = 'http://localhost:4000/render';
|
|
2
|
-
|
|
3
|
-
async function getResponse(body: string) {
|
|
4
|
-
return await fetch(RENDER_URL, {
|
|
5
|
-
method: 'POST',
|
|
6
|
-
headers: {
|
|
7
|
-
'Content-Type': 'application/json',
|
|
8
|
-
},
|
|
9
|
-
body,
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export async function POST(request: Request) {
|
|
14
|
-
const body = await request.json();
|
|
15
|
-
|
|
16
|
-
const response = await getResponse(JSON.stringify(body));
|
|
17
|
-
if (!response.ok) {
|
|
18
|
-
return new Response('Failed to render', {status: 500});
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
return new Response(response.body, {status: 200});
|
|
22
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type {Metadata} from 'next';
|
|
2
|
-
import {Inter} from 'next/font/google';
|
|
3
|
-
import './globals.css';
|
|
4
|
-
|
|
5
|
-
const inter = Inter({subsets: ['latin']});
|
|
6
|
-
|
|
7
|
-
export const metadata: Metadata = {
|
|
8
|
-
title: 'Create Next App',
|
|
9
|
-
description: 'Generated by create next app',
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export default function RootLayout({
|
|
13
|
-
children,
|
|
14
|
-
}: Readonly<{
|
|
15
|
-
children: React.ReactNode;
|
|
16
|
-
}>) {
|
|
17
|
-
return (
|
|
18
|
-
<html lang="en">
|
|
19
|
-
<head>
|
|
20
|
-
<link rel="stylesheet" href="http://localhost:4000/player/project.css" />
|
|
21
|
-
</head>
|
|
22
|
-
<body className={inter.className}>{children}</body>
|
|
23
|
-
</html>
|
|
24
|
-
);
|
|
25
|
-
}
|
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import {Player} from '@revideo/player-react';
|
|
4
|
-
import {getGithubRepositoryInfo} from './actions';
|
|
5
|
-
import {useState} from 'react';
|
|
6
|
-
import {LoaderCircle} from 'lucide-react';
|
|
7
|
-
import {parseStream} from '../utils/parse';
|
|
8
|
-
|
|
9
|
-
function Button({
|
|
10
|
-
children,
|
|
11
|
-
loading,
|
|
12
|
-
onClick,
|
|
13
|
-
}: {
|
|
14
|
-
children: React.ReactNode;
|
|
15
|
-
loading: boolean;
|
|
16
|
-
onClick: () => void;
|
|
17
|
-
}) {
|
|
18
|
-
return (
|
|
19
|
-
<button
|
|
20
|
-
className="text-sm flex items-center gap-x-2 rounded-md p-2 bg-gray-200 text-gray-700 hover:bg-gray-300"
|
|
21
|
-
onClick={() => onClick()}
|
|
22
|
-
disabled={loading}
|
|
23
|
-
>
|
|
24
|
-
{loading && <LoaderCircle className="animate-spin h-4 w-4 text-gray-700" />}
|
|
25
|
-
{children}
|
|
26
|
-
</button>
|
|
27
|
-
);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export default function Home() {
|
|
31
|
-
const [repoName, setRepoName] = useState<string>('');
|
|
32
|
-
const [repoImage, setRepoImage] = useState<string | null>();
|
|
33
|
-
const [stargazerTimes, setStargazerTimes] = useState<number[]>([]);
|
|
34
|
-
|
|
35
|
-
const [githubLoading, setGithubLoading] = useState(false);
|
|
36
|
-
const [needsKey, setNeedsKey] = useState(false);
|
|
37
|
-
const [key, setKey] = useState('');
|
|
38
|
-
const [error, setError] = useState<string | null>();
|
|
39
|
-
|
|
40
|
-
const [renderLoading, setRenderLoading] = useState(false);
|
|
41
|
-
const [progress, setProgress] = useState(0);
|
|
42
|
-
const [downloadUrl, setDownloadUrl] = useState<string | null>(null);
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Get information about the repository from Github.
|
|
46
|
-
* @param repoName
|
|
47
|
-
* @param key
|
|
48
|
-
* @returns
|
|
49
|
-
*/
|
|
50
|
-
async function fetchInformation(repoName: `${string}/${string}`, key: string) {
|
|
51
|
-
setGithubLoading(true);
|
|
52
|
-
const response = await getGithubRepositoryInfo(repoName, key ?? undefined);
|
|
53
|
-
setGithubLoading(false);
|
|
54
|
-
|
|
55
|
-
if (response.status === 'rate-limit') {
|
|
56
|
-
setNeedsKey(true);
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
if (response.status === 'error') {
|
|
61
|
-
setError('Failed to fetch repository information from Github.');
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
setStargazerTimes(response.stargazerTimes);
|
|
66
|
-
setRepoImage(response.repoImage);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Render the video.
|
|
71
|
-
*/
|
|
72
|
-
async function render() {
|
|
73
|
-
setRenderLoading(true);
|
|
74
|
-
const res = await fetch('/api/render', {
|
|
75
|
-
method: 'POST',
|
|
76
|
-
headers: {
|
|
77
|
-
'Content-Type': 'application/json',
|
|
78
|
-
},
|
|
79
|
-
body: JSON.stringify({
|
|
80
|
-
variables: {
|
|
81
|
-
data: stargazerTimes.length ? stargazerTimes : undefined,
|
|
82
|
-
repoName: repoName || undefined,
|
|
83
|
-
repoImage: repoImage || undefined,
|
|
84
|
-
},
|
|
85
|
-
streamProgress: true,
|
|
86
|
-
}),
|
|
87
|
-
}).catch((e) => console.log(e));
|
|
88
|
-
|
|
89
|
-
if (!res) {
|
|
90
|
-
alert('Failed to render video.');
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
const downloadUrl = await parseStream(res.body!.getReader(), (p) => setProgress(p));
|
|
95
|
-
setRenderLoading(false);
|
|
96
|
-
setDownloadUrl(downloadUrl);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
return (
|
|
100
|
-
<>
|
|
101
|
-
<div className="m-auto p-12 max-w-7xl flex flex-col gap-y-4">
|
|
102
|
-
<div>
|
|
103
|
-
<div className="text-sm text-gray-700 mb-2">Repository</div>
|
|
104
|
-
<div className="flex gap-x-4 text-sm">
|
|
105
|
-
<input
|
|
106
|
-
className="flex-1 rounded-md p-2 bg-gray-200 focus:outline-none placeholder:text-gray-400"
|
|
107
|
-
placeholder="redotvideo/revideo"
|
|
108
|
-
value={repoName}
|
|
109
|
-
onChange={(e) => setRepoName(e.target.value)}
|
|
110
|
-
/>
|
|
111
|
-
{!needsKey && (
|
|
112
|
-
<Button
|
|
113
|
-
loading={githubLoading}
|
|
114
|
-
onClick={() => fetchInformation(repoName as `${string}/${string}`, key)}
|
|
115
|
-
>
|
|
116
|
-
Fetch information
|
|
117
|
-
</Button>
|
|
118
|
-
)}
|
|
119
|
-
</div>
|
|
120
|
-
</div>
|
|
121
|
-
{needsKey && (
|
|
122
|
-
<div>
|
|
123
|
-
<div className="text-sm text-blue-600 mb-2">
|
|
124
|
-
You hit the Github API rate-limit. Please provide your own key. Requests to Github are
|
|
125
|
-
made directly and the key stays on your device.
|
|
126
|
-
</div>
|
|
127
|
-
<div className="flex gap-x-4 text-sm">
|
|
128
|
-
<input
|
|
129
|
-
className="flex-1 rounded-md p-2 bg-gray-200 focus:outline-none placeholder:text-gray-400"
|
|
130
|
-
placeholder="ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
|
131
|
-
value={key}
|
|
132
|
-
onChange={(e) => setKey(e.target.value)}
|
|
133
|
-
/>
|
|
134
|
-
<Button
|
|
135
|
-
loading={githubLoading}
|
|
136
|
-
onClick={() => fetchInformation(repoName as `${string}/${string}`, key)}
|
|
137
|
-
>
|
|
138
|
-
Fetch information
|
|
139
|
-
</Button>
|
|
140
|
-
</div>
|
|
141
|
-
</div>
|
|
142
|
-
)}
|
|
143
|
-
{error && <div className="text-sm text-red-600">{error}</div>}
|
|
144
|
-
<div>
|
|
145
|
-
<div className="rounded-lg overflow-hidden">
|
|
146
|
-
{/* You can find the scene code inside revideo/src/scenes/example.tsx */}
|
|
147
|
-
<Player
|
|
148
|
-
src="http://localhost:4000/player/"
|
|
149
|
-
controls={true}
|
|
150
|
-
variables={{
|
|
151
|
-
data: stargazerTimes.length > 0 ? stargazerTimes : undefined,
|
|
152
|
-
repoName: repoName ? repoName : undefined,
|
|
153
|
-
repoImage: repoImage ? repoImage : undefined,
|
|
154
|
-
}}
|
|
155
|
-
/>
|
|
156
|
-
</div>
|
|
157
|
-
</div>
|
|
158
|
-
<div className="flex gap-x-4">
|
|
159
|
-
{/* Progress bar */}
|
|
160
|
-
<div className="text-sm flex-1 bg-gray-100 rounded-md overflow-hidden">
|
|
161
|
-
<div
|
|
162
|
-
className="text-gray-600 bg-gray-400 h-full flex items-center px-4 transition-all transition-200"
|
|
163
|
-
style={{
|
|
164
|
-
width: `${Math.round(progress * 100)}%`,
|
|
165
|
-
}}
|
|
166
|
-
>
|
|
167
|
-
{Math.round(progress * 100)}%
|
|
168
|
-
</div>
|
|
169
|
-
</div>
|
|
170
|
-
{downloadUrl ? (
|
|
171
|
-
<a
|
|
172
|
-
href={downloadUrl}
|
|
173
|
-
download
|
|
174
|
-
className="text-sm flex items-center gap-x-2 rounded-md p-2 bg-green-200 text-gray-700 hover:bg-gray-300"
|
|
175
|
-
>
|
|
176
|
-
Download video
|
|
177
|
-
</a>
|
|
178
|
-
) : (
|
|
179
|
-
<Button onClick={() => render()} loading={renderLoading}>
|
|
180
|
-
Render video
|
|
181
|
-
</Button>
|
|
182
|
-
)}
|
|
183
|
-
</div>
|
|
184
|
-
</div>
|
|
185
|
-
</>
|
|
186
|
-
);
|
|
187
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "next",
|
|
3
|
-
"version": "0.1.0",
|
|
4
|
-
"private": true,
|
|
5
|
-
"scripts": {
|
|
6
|
-
"dev": "next dev",
|
|
7
|
-
"build": "next build",
|
|
8
|
-
"start": "next start",
|
|
9
|
-
"lint": "next lint"
|
|
10
|
-
},
|
|
11
|
-
"dependencies": {
|
|
12
|
-
"@radix-ui/react-navigation-menu": "^1.1.4",
|
|
13
|
-
"@revideo/player-react": "0.5.10",
|
|
14
|
-
"class-variance-authority": "^0.7.0",
|
|
15
|
-
"lucide-react": "^0.378.0",
|
|
16
|
-
"next": "14.2.3",
|
|
17
|
-
"p-limit": "^3",
|
|
18
|
-
"react": "^18",
|
|
19
|
-
"react-dom": "^18",
|
|
20
|
-
"tailwind-merge": "^2.3.0",
|
|
21
|
-
"tailwindcss-animate": "^1.0.7"
|
|
22
|
-
},
|
|
23
|
-
"devDependencies": {
|
|
24
|
-
"@types/node": "^20",
|
|
25
|
-
"@types/react": "^18",
|
|
26
|
-
"@types/react-dom": "^18",
|
|
27
|
-
"autoprefixer": "^10.4.19",
|
|
28
|
-
"eslint": "^8",
|
|
29
|
-
"eslint-config-next": "14.2.3",
|
|
30
|
-
"postcss": "^8",
|
|
31
|
-
"tailwindcss": "^3.4.3",
|
|
32
|
-
"typescript": "^5"
|
|
33
|
-
}
|
|
34
|
-
}
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 394 80"><path fill="#000" d="M262 0h68.5v12.7h-27.2v66.6h-13.6V12.7H262V0ZM149 0v12.7H94v20.4h44.3v12.6H94v21h55v12.6H80.5V0h68.7zm34.3 0h-17.8l63.8 79.4h17.9l-32-39.7 32-39.6h-17.9l-23 28.6-23-28.6zm18.3 56.7-9-11-27.1 33.7h17.8l18.3-22.7z"/><path fill="#000" d="M81 79.3 17 0H0v79.3h13.6V17l50.2 62.3H81Zm252.6-.4c-1 0-1.8-.4-2.5-1s-1.1-1.6-1.1-2.6.3-1.8 1-2.5 1.6-1 2.6-1 1.8.3 2.5 1a3.4 3.4 0 0 1 .6 4.3 3.7 3.7 0 0 1-3 1.8zm23.2-33.5h6v23.3c0 2.1-.4 4-1.3 5.5a9.1 9.1 0 0 1-3.8 3.5c-1.6.8-3.5 1.3-5.7 1.3-2 0-3.7-.4-5.3-1s-2.8-1.8-3.7-3.2c-.9-1.3-1.4-3-1.4-5h6c.1.8.3 1.6.7 2.2s1 1.2 1.6 1.5c.7.4 1.5.5 2.4.5 1 0 1.8-.2 2.4-.6a4 4 0 0 0 1.6-1.8c.3-.8.5-1.8.5-3V45.5zm30.9 9.1a4.4 4.4 0 0 0-2-3.3 7.5 7.5 0 0 0-4.3-1.1c-1.3 0-2.4.2-3.3.5-.9.4-1.6 1-2 1.6a3.5 3.5 0 0 0-.3 4c.3.5.7.9 1.3 1.2l1.8 1 2 .5 3.2.8c1.3.3 2.5.7 3.7 1.2a13 13 0 0 1 3.2 1.8 8.1 8.1 0 0 1 3 6.5c0 2-.5 3.7-1.5 5.1a10 10 0 0 1-4.4 3.5c-1.8.8-4.1 1.2-6.8 1.2-2.6 0-4.9-.4-6.8-1.2-2-.8-3.4-2-4.5-3.5a10 10 0 0 1-1.7-5.6h6a5 5 0 0 0 3.5 4.6c1 .4 2.2.6 3.4.6 1.3 0 2.5-.2 3.5-.6 1-.4 1.8-1 2.4-1.7a4 4 0 0 0 .8-2.4c0-.9-.2-1.6-.7-2.2a11 11 0 0 0-2.1-1.4l-3.2-1-3.8-1c-2.8-.7-5-1.7-6.6-3.2a7.2 7.2 0 0 1-2.4-5.7 8 8 0 0 1 1.7-5 10 10 0 0 1 4.3-3.5c2-.8 4-1.2 6.4-1.2 2.3 0 4.4.4 6.2 1.2 1.8.8 3.2 2 4.3 3.4 1 1.4 1.5 3 1.5 5h-5.8z"/></svg>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 283 64"><path fill="black" d="M141 16c-11 0-19 7-19 18s9 18 20 18c7 0 13-3 16-7l-7-5c-2 3-6 4-9 4-5 0-9-3-10-7h28v-3c0-11-8-18-19-18zm-9 15c1-4 4-7 9-7s8 3 9 7h-18zm117-15c-11 0-19 7-19 18s9 18 20 18c6 0 12-3 16-7l-8-5c-2 3-5 4-8 4-5 0-9-3-11-7h28l1-3c0-11-8-18-19-18zm-10 15c2-4 5-7 10-7s8 3 9 7h-19zm-39 3c0 6 4 10 10 10 4 0 7-2 9-5l8 5c-3 5-9 8-17 8-11 0-19-7-19-18s8-18 19-18c8 0 14 3 17 8l-8 5c-2-3-5-5-9-5-6 0-10 4-10 10zm83-29v46h-9V5h9zM37 0l37 64H0L37 0zm92 5-27 48L74 5h10l18 30 17-30h10zm59 12v10l-3-1c-6 0-10 4-10 10v15h-9V17h9v9c0-5 6-9 13-9z"/></svg>
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/* eslint-disable naming-convention */
|
|
2
|
-
import type {Config} from 'tailwindcss';
|
|
3
|
-
|
|
4
|
-
const config: Config = {
|
|
5
|
-
content: [
|
|
6
|
-
'./pages/**/*.{js,ts,jsx,tsx,mdx}',
|
|
7
|
-
'./components/**/*.{js,ts,jsx,tsx,mdx}',
|
|
8
|
-
'./app/**/*.{js,ts,jsx,tsx,mdx}',
|
|
9
|
-
],
|
|
10
|
-
theme: {
|
|
11
|
-
extend: {
|
|
12
|
-
colors: {
|
|
13
|
-
gray: {
|
|
14
|
-
50: '#FAFAFA',
|
|
15
|
-
100: '#F3F3F3',
|
|
16
|
-
200: '#E5E5E5',
|
|
17
|
-
300: '#C7C7C7',
|
|
18
|
-
400: '#ACACAC',
|
|
19
|
-
500: '#808080',
|
|
20
|
-
600: '#5F5F5F',
|
|
21
|
-
700: '#4E4E4E',
|
|
22
|
-
800: '#373737',
|
|
23
|
-
900: '#2A2A2A',
|
|
24
|
-
950: '#151515',
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
};
|
|
30
|
-
export default config;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"lib": ["dom", "dom.iterable", "esnext"],
|
|
4
|
-
"allowJs": true,
|
|
5
|
-
"skipLibCheck": true,
|
|
6
|
-
"strict": true,
|
|
7
|
-
"noEmit": true,
|
|
8
|
-
"esModuleInterop": true,
|
|
9
|
-
"module": "esnext",
|
|
10
|
-
"moduleResolution": "bundler",
|
|
11
|
-
"resolveJsonModule": true,
|
|
12
|
-
"isolatedModules": true,
|
|
13
|
-
"jsx": "preserve",
|
|
14
|
-
"incremental": true,
|
|
15
|
-
"plugins": [
|
|
16
|
-
{
|
|
17
|
-
"name": "next"
|
|
18
|
-
}
|
|
19
|
-
],
|
|
20
|
-
"paths": {
|
|
21
|
-
"@/*": ["./*"]
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
|
|
25
|
-
"exclude": ["node_modules"]
|
|
26
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
export async function parseStream(
|
|
2
|
-
reader: ReadableStreamDefaultReader<Uint8Array>,
|
|
3
|
-
updateProgress: (progress: number) => void,
|
|
4
|
-
) {
|
|
5
|
-
while (true) {
|
|
6
|
-
const {done, value} = await reader.read();
|
|
7
|
-
|
|
8
|
-
const decoded = new TextDecoder('utf-8').decode(value);
|
|
9
|
-
const split = decoded.split('\n');
|
|
10
|
-
|
|
11
|
-
if (done) {
|
|
12
|
-
break;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const event = split[0].slice(6).trim();
|
|
16
|
-
const data = split[1].slice(6).trim();
|
|
17
|
-
|
|
18
|
-
if (event === 'progress') {
|
|
19
|
-
const parsed = JSON.parse(data);
|
|
20
|
-
updateProgress(parsed.progress);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
if (event === 'completed') {
|
|
24
|
-
const parsed = JSON.parse(data);
|
|
25
|
-
return parsed.downloadLink as string;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
if (event === 'error') {
|
|
29
|
-
console.error(data);
|
|
30
|
-
break;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
return '';
|
|
35
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "revideo",
|
|
3
|
-
"private": true,
|
|
4
|
-
"version": "0.0.0",
|
|
5
|
-
"scripts": {
|
|
6
|
-
"start": "vite",
|
|
7
|
-
"serve": "vite",
|
|
8
|
-
"build": "tsc && vite build",
|
|
9
|
-
"render": "tsc && node dist/render.js"
|
|
10
|
-
},
|
|
11
|
-
"dependencies": {
|
|
12
|
-
"@revideo/core": "0.5.10",
|
|
13
|
-
"@revideo/2d": "0.5.10",
|
|
14
|
-
"@revideo/renderer": "0.5.10",
|
|
15
|
-
"@revideo/vite-plugin": "0.5.10",
|
|
16
|
-
"@revideo/ffmpeg": "0.5.10"
|
|
17
|
-
},
|
|
18
|
-
"devDependencies": {
|
|
19
|
-
"@revideo/ui": "0.5.10",
|
|
20
|
-
"@revideo/cli": "0.5.10",
|
|
21
|
-
"typescript": "5.5.4",
|
|
22
|
-
"vite": "^4.5"
|
|
23
|
-
}
|
|
24
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap');
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 0,
|
|
3
|
-
"shared": {
|
|
4
|
-
"background": null,
|
|
5
|
-
"range": [
|
|
6
|
-
0,
|
|
7
|
-
null
|
|
8
|
-
],
|
|
9
|
-
"size": {
|
|
10
|
-
"x": 1920,
|
|
11
|
-
"y": 1080
|
|
12
|
-
},
|
|
13
|
-
"audioOffset": 0
|
|
14
|
-
},
|
|
15
|
-
"preview": {
|
|
16
|
-
"fps": 30,
|
|
17
|
-
"resolutionScale": 1
|
|
18
|
-
},
|
|
19
|
-
"rendering": {
|
|
20
|
-
"fps": 30,
|
|
21
|
-
"resolutionScale": 1,
|
|
22
|
-
"colorSpace": "srgb",
|
|
23
|
-
"exporter": {
|
|
24
|
-
"name": "@revideo/core/wasm"
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import {renderVideo} from '@revideo/renderer';
|
|
2
|
-
|
|
3
|
-
async function render() {
|
|
4
|
-
console.log('Rendering video...');
|
|
5
|
-
|
|
6
|
-
// This is the main function that renders the video
|
|
7
|
-
const file = await renderVideo({
|
|
8
|
-
projectFile: './src/project.ts',
|
|
9
|
-
settings: { logProgress: true }
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
console.log(`Rendered video to ${file}`);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
render();
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/// <reference types="@revideo/core/project" />
|