@revideo/create 0.5.10-alpha.1087 → 0.5.10
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/examples/avatar-with-background/package.json +8 -8
- package/examples/avatar-with-background/src/scenes/example.tsx +1 -0
- package/examples/default/package.json +8 -8
- package/examples/github-stars-celebration/package.json +7 -7
- package/examples/github-stars-celebration/src/scenes/example.tsx +2 -2
- package/examples/google-cloud-run-parallelized/render-orchestrator/package.json +21 -21
- package/examples/google-cloud-run-parallelized/render-worker/package.json +8 -8
- package/examples/marketing-templates/marketing-template/package.json +7 -7
- package/examples/marketing-templates/multiple-videos-in-one/package.json +7 -7
- package/examples/minimal-drag-drop/README.md +27 -0
- package/examples/minimal-drag-drop/next/app/api/render/route.ts +22 -0
- package/examples/minimal-drag-drop/next/app/globals.css +3 -0
- package/examples/minimal-drag-drop/next/app/layout.tsx +25 -0
- package/examples/minimal-drag-drop/next/app/page.tsx +277 -0
- package/examples/minimal-drag-drop/next/next-env.d.ts +5 -0
- package/examples/minimal-drag-drop/next/next.config.mjs +4 -0
- package/examples/minimal-drag-drop/next/package-lock.json +5577 -0
- package/examples/minimal-drag-drop/next/package.json +35 -0
- package/examples/minimal-drag-drop/next/postcss.config.js +6 -0
- package/examples/minimal-drag-drop/next/public/favicon.ico +0 -0
- package/examples/minimal-drag-drop/next/public/next.svg +1 -0
- package/examples/minimal-drag-drop/next/public/vercel.svg +1 -0
- package/examples/minimal-drag-drop/next/tailwind.config.ts +30 -0
- package/examples/minimal-drag-drop/next/tsconfig.json +26 -0
- package/examples/minimal-drag-drop/next/utils/parse.ts +35 -0
- package/examples/minimal-drag-drop/revideo/package-lock.json +3771 -0
- package/examples/minimal-drag-drop/revideo/package.json +24 -0
- package/examples/minimal-drag-drop/revideo/src/global.css +1 -0
- package/examples/minimal-drag-drop/revideo/src/project.meta +28 -0
- package/examples/minimal-drag-drop/revideo/src/project.ts +9 -0
- package/examples/minimal-drag-drop/revideo/src/render.ts +15 -0
- package/examples/minimal-drag-drop/revideo/src/revideo.d.ts +1 -0
- package/examples/minimal-drag-drop/revideo/src/scenes/example.meta +5 -0
- package/examples/minimal-drag-drop/revideo/src/scenes/example.tsx +44 -0
- package/examples/minimal-drag-drop/revideo/tsconfig.json +9 -0
- package/examples/minimal-drag-drop/revideo/vite.config.ts +6 -0
- package/examples/parallelized-aws-lambda/revideo-project/package.json +8 -11
- package/examples/parallelized-aws-lambda/revideo-project/src/lambda.ts +15 -2
- package/examples/parallelized-aws-lambda/revideo-project/src/render.ts +2 -1
- package/examples/parallelized-aws-lambda/revideo-project/src/scenes/example.tsx +1 -0
- package/examples/reddit-post-video/package.json +7 -7
- package/examples/reddit-post-video/src/project.meta +2 -2
- package/examples/rive-explanation-video/package.json +8 -8
- package/examples/saas-template/next/package.json +33 -33
- package/examples/saas-template/revideo/package.json +23 -23
- package/examples/stitching-videos/package.json +6 -6
- package/examples/stitching-videos/src/render.ts +2 -1
- package/examples/three-js-example/package-lock.json +41 -41
- package/examples/three-js-example/package.json +7 -7
- package/examples/youtube-shorts/README.md +7 -7
- package/examples/youtube-shorts/package-lock.json +332 -365
- package/examples/youtube-shorts/package.json +8 -8
- package/examples/youtube-shorts/src/get-assets.ts +34 -0
- package/examples/youtube-shorts/src/render.ts +4 -35
- package/examples/youtube-shorts/src/scenes/example.tsx +25 -12
- package/index.js +122 -16
- package/package.json +9 -9
- package/examples/avatar-with-background/package-lock.json +0 -3223
- package/examples/marketing-templates/marketing-template/package-lock.json +0 -3824
- package/examples/marketing-templates/multiple-videos-in-one/package-lock.json +0 -3824
- package/examples/rive-explanation-video/package-lock.json +0 -3706
- package/examples/stitching-videos/package-lock.json +0 -2801
|
@@ -10,21 +10,21 @@
|
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@deepgram/sdk": "^3.3.1",
|
|
13
|
-
"@revideo/2d": "0.5.
|
|
14
|
-
"@revideo/cli": "0.5.
|
|
15
|
-
"@revideo/core": "0.5.
|
|
16
|
-
"@revideo/ffmpeg": "0.5.
|
|
17
|
-
"@revideo/renderer": "0.5.
|
|
18
|
-
"@revideo/vite-plugin": "0.5.
|
|
13
|
+
"@revideo/2d": "0.5.10",
|
|
14
|
+
"@revideo/cli": "0.5.10",
|
|
15
|
+
"@revideo/core": "0.5.10",
|
|
16
|
+
"@revideo/ffmpeg": "0.5.10",
|
|
17
|
+
"@revideo/renderer": "0.5.10",
|
|
18
|
+
"@revideo/vite-plugin": "0.5.10",
|
|
19
19
|
"dotenv": "^16.4.5",
|
|
20
20
|
"express": "^4.19.2",
|
|
21
21
|
"openai": "^4.40.2",
|
|
22
22
|
"uuid": "^9.0.1"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@revideo/ui": "0.5.
|
|
25
|
+
"@revideo/ui": "0.5.10",
|
|
26
26
|
"@types/uuid": "^9.0.8",
|
|
27
27
|
"typescript": "5.5.4",
|
|
28
28
|
"vite": "^4.5"
|
|
29
29
|
}
|
|
30
|
-
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
require('dotenv').config();
|
|
2
|
+
|
|
3
|
+
import { getVideoScript, generateAudio, getWordTimestamps, dalleGenerate, getImagePromptFromScript } from './utils';
|
|
4
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
5
|
+
import * as fs from 'fs';
|
|
6
|
+
|
|
7
|
+
async function createAssets(topic: string, voiceName: string){
|
|
8
|
+
const jobId = uuidv4();
|
|
9
|
+
|
|
10
|
+
console.log("Generating assets...")
|
|
11
|
+
const script = await getVideoScript(topic);
|
|
12
|
+
console.log("script", script);
|
|
13
|
+
|
|
14
|
+
await generateAudio(script, voiceName, `./public/${jobId}-audio.wav`);
|
|
15
|
+
const words = await getWordTimestamps(`./public/${jobId}-audio.wav`);
|
|
16
|
+
|
|
17
|
+
console.log("Generating images...")
|
|
18
|
+
const imagePromises = Array.from({ length: 5 }).map(async (_, index) => {
|
|
19
|
+
const imagePrompt = await getImagePromptFromScript(script);
|
|
20
|
+
await dalleGenerate(imagePrompt, `./public/${jobId}-image-${index}.png`);
|
|
21
|
+
return `/${jobId}-image-${index}.png`;
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
const imageFileNames = await Promise.all(imagePromises);
|
|
25
|
+
const metadata = {
|
|
26
|
+
audioUrl: `${jobId}-audio.wav`,
|
|
27
|
+
images: imageFileNames,
|
|
28
|
+
words: words
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
await fs.promises.writeFile(`./public/${jobId}-metadata.json`, JSON.stringify(metadata, null, 2));
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
createAssets("The moon landing", "Sarah")
|
|
@@ -1,43 +1,12 @@
|
|
|
1
|
-
require('dotenv').config();
|
|
2
|
-
|
|
3
1
|
import {renderVideo} from '@revideo/renderer';
|
|
4
2
|
import metadata from './metadata.json';
|
|
5
|
-
import { getVideoScript, generateAudio, getWordTimestamps, dalleGenerate, getImagePromptFromScript } from './utils';
|
|
6
|
-
import { v4 as uuidv4 } from 'uuid';
|
|
7
|
-
import * as fs from 'fs';
|
|
8
|
-
|
|
9
|
-
async function createVideo(topic: string, voiceName: string){
|
|
10
|
-
const jobId = uuidv4();
|
|
11
|
-
|
|
12
|
-
console.log("Generating assets...")
|
|
13
|
-
const script = await getVideoScript(topic);
|
|
14
|
-
console.log("script", script);
|
|
15
|
-
|
|
16
|
-
await generateAudio(script, voiceName, `./public/${jobId}-audio.wav`);
|
|
17
|
-
const words = await getWordTimestamps(`./public/${jobId}-audio.wav`);
|
|
18
|
-
|
|
19
|
-
console.log("Generating images...")
|
|
20
|
-
const imagePromises = Array.from({ length: 5 }).map(async (_, index) => {
|
|
21
|
-
const imagePrompt = await getImagePromptFromScript(script);
|
|
22
|
-
await dalleGenerate(imagePrompt, `./public/${jobId}-image-${index}.png`);
|
|
23
|
-
return `/${jobId}-image-${index}.png`;
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
const imageFileNames = await Promise.all(imagePromises);
|
|
27
|
-
const metadata = {
|
|
28
|
-
audioUrl: `${jobId}-audio.wav`,
|
|
29
|
-
images: imageFileNames,
|
|
30
|
-
words: words
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
await fs.promises.writeFile(`./public/${jobId}-metadata.json`, JSON.stringify(metadata, null, 2));
|
|
34
3
|
|
|
35
|
-
|
|
4
|
+
async function render(){
|
|
36
5
|
await renderVideo({
|
|
37
6
|
projectFile: './src/project.ts',
|
|
38
|
-
variables: metadata
|
|
7
|
+
variables: metadata,
|
|
8
|
+
settings: {logProgress: true}
|
|
39
9
|
});
|
|
40
|
-
console.log("Render finished");
|
|
41
10
|
}
|
|
42
11
|
|
|
43
|
-
|
|
12
|
+
render();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {Audio, Img, makeScene2D, Txt,
|
|
1
|
+
import {Audio, Img, makeScene2D, Txt, Rect, Layout} from '@revideo/2d';
|
|
2
2
|
import {all, createRef, waitFor, useScene, Reference, createSignal} from '@revideo/core';
|
|
3
3
|
|
|
4
4
|
interface Word {
|
|
@@ -49,8 +49,19 @@ export default makeScene2D(function* (view) {
|
|
|
49
49
|
|
|
50
50
|
const duration = words[words.length-1].end + 0.5;
|
|
51
51
|
|
|
52
|
+
const imageContainer = createRef<Layout>();
|
|
53
|
+
const textContainer = createRef<Layout>();
|
|
54
|
+
|
|
52
55
|
yield view.add(
|
|
53
56
|
<>
|
|
57
|
+
<Layout
|
|
58
|
+
size={"100%"}
|
|
59
|
+
ref={imageContainer}
|
|
60
|
+
/>
|
|
61
|
+
<Layout
|
|
62
|
+
size={"100%"}
|
|
63
|
+
ref={textContainer}
|
|
64
|
+
/>
|
|
54
65
|
<Audio
|
|
55
66
|
src={audioUrl}
|
|
56
67
|
play={true}
|
|
@@ -64,19 +75,19 @@ export default makeScene2D(function* (view) {
|
|
|
64
75
|
);
|
|
65
76
|
|
|
66
77
|
yield* all(
|
|
67
|
-
displayImages(
|
|
78
|
+
displayImages(imageContainer, images, duration),
|
|
68
79
|
displayWords(
|
|
69
|
-
|
|
80
|
+
textContainer,
|
|
70
81
|
words,
|
|
71
82
|
textSettings
|
|
72
83
|
)
|
|
73
84
|
)
|
|
74
85
|
});
|
|
75
86
|
|
|
76
|
-
function* displayImages(
|
|
87
|
+
function* displayImages(container: Reference<Layout>, images: string[], totalDuration: number){
|
|
77
88
|
for(const img of images){
|
|
78
89
|
const ref = createRef<Img>();
|
|
79
|
-
|
|
90
|
+
container().add(<Img
|
|
80
91
|
src={img}
|
|
81
92
|
size={["100%", "100%"]}
|
|
82
93
|
ref={ref}
|
|
@@ -87,7 +98,7 @@ function* displayImages(view: View2D, images: string[], totalDuration: number){
|
|
|
87
98
|
}
|
|
88
99
|
}
|
|
89
100
|
|
|
90
|
-
function* displayWords(
|
|
101
|
+
function* displayWords(container: Reference<Layout>, words: Word[], settings: captionSettings){
|
|
91
102
|
let waitBefore = words[0].start;
|
|
92
103
|
|
|
93
104
|
for (let i = 0; i < words.length; i += settings.numSimultaneousWords) {
|
|
@@ -101,7 +112,7 @@ function* displayWords(view: View2D, words: Word[], settings: captionSettings){
|
|
|
101
112
|
|
|
102
113
|
if(settings.stream){
|
|
103
114
|
let nextWordStart = 0;
|
|
104
|
-
yield
|
|
115
|
+
yield container().add(<Txt width={`${settings.textBoxWidthInPercent}%`} textWrap={true} zIndex={2} textAlign={settings.textAlign} ref={textRef}/>);
|
|
105
116
|
|
|
106
117
|
for(let j = 0; j < currentBatch.length; j++){
|
|
107
118
|
const word = currentBatch[j];
|
|
@@ -130,7 +141,7 @@ function* displayWords(view: View2D, words: Word[], settings: captionSettings){
|
|
|
130
141
|
</Txt>
|
|
131
142
|
);
|
|
132
143
|
textRef().add(<Txt fontSize={settings.fontSize}>{optionalSpace}</Txt>);
|
|
133
|
-
|
|
144
|
+
container().add(<Rect fill={settings.currentWordBackgroundColor} zIndex={1} size={wordRef().size} position={wordRef().position} radius={10} padding={10} ref={backgroundRef} />);
|
|
134
145
|
yield* all(waitFor(word.end-word.start), opacitySignal(1, Math.min((word.end-word.start)*0.5, 0.1)));
|
|
135
146
|
wordRef().fill(settings.textColor);
|
|
136
147
|
backgroundRef().remove();
|
|
@@ -139,7 +150,7 @@ function* displayWords(view: View2D, words: Word[], settings: captionSettings){
|
|
|
139
150
|
textRef().remove();
|
|
140
151
|
|
|
141
152
|
} else {
|
|
142
|
-
yield
|
|
153
|
+
yield container().add(<Txt width={`${settings.textBoxWidthInPercent}%`} textAlign={settings.textAlign} ref={textRef} textWrap={true} zIndex={2}/>);
|
|
143
154
|
|
|
144
155
|
const wordRefs = [];
|
|
145
156
|
const opacitySignal = createSignal(settings.fadeInAnimation ? 0.5 : 1);
|
|
@@ -177,7 +188,7 @@ function* displayWords(view: View2D, words: Word[], settings: captionSettings){
|
|
|
177
188
|
|
|
178
189
|
yield* all(
|
|
179
190
|
opacitySignal(1, Math.min(0.1, (currentBatch[0].end-currentBatch[0].start)*0.5)),
|
|
180
|
-
highlightCurrentWord(
|
|
191
|
+
highlightCurrentWord(container, currentBatch, wordRefs, settings.currentWordColor, settings.currentWordBackgroundColor),
|
|
181
192
|
waitFor(currentBatch[currentBatch.length-1].end - currentBatch[0].start + waitAfter),
|
|
182
193
|
);
|
|
183
194
|
textRef().remove();
|
|
@@ -186,7 +197,7 @@ function* displayWords(view: View2D, words: Word[], settings: captionSettings){
|
|
|
186
197
|
}
|
|
187
198
|
}
|
|
188
199
|
|
|
189
|
-
function* highlightCurrentWord(
|
|
200
|
+
function* highlightCurrentWord(container: Reference<Layout>, currentBatch: Word[], wordRefs: Reference<Txt>[], wordColor: string, backgroundColor: string){
|
|
190
201
|
let nextWordStart = 0;
|
|
191
202
|
|
|
192
203
|
for(let i = 0; i < currentBatch.length; i++){
|
|
@@ -194,14 +205,16 @@ function* highlightCurrentWord(view: View2D, currentBatch: Word[], wordRefs: Ref
|
|
|
194
205
|
const word = currentBatch[i];
|
|
195
206
|
const originalColor = wordRefs[i]().fill();
|
|
196
207
|
nextWordStart = currentBatch[i+1]?.start - word.end || 0;
|
|
208
|
+
wordRefs[i]().text(wordRefs[i]().text());
|
|
197
209
|
wordRefs[i]().fill(wordColor);
|
|
198
210
|
|
|
199
211
|
const backgroundRef = createRef<Rect>();
|
|
200
212
|
if(backgroundColor){
|
|
201
|
-
|
|
213
|
+
container().add(<Rect fill={backgroundColor} zIndex={1} size={wordRefs[i]().size} position={wordRefs[i]().position} radius={10} padding={10} ref={backgroundRef} />);
|
|
202
214
|
}
|
|
203
215
|
|
|
204
216
|
yield* waitFor(word.end-word.start);
|
|
217
|
+
wordRefs[i]().text(wordRefs[i]().text());
|
|
205
218
|
wordRefs[i]().fill(originalColor);
|
|
206
219
|
|
|
207
220
|
if(backgroundColor){
|
package/index.js
CHANGED
|
@@ -9,23 +9,97 @@ import path from 'path';
|
|
|
9
9
|
import prompts from 'prompts';
|
|
10
10
|
|
|
11
11
|
const templates = [
|
|
12
|
+
{
|
|
13
|
+
value: 'default',
|
|
14
|
+
title: 'Minimal, standalone Revideo project',
|
|
15
|
+
description: 'A minimal example to get started with Revideo.',
|
|
16
|
+
recommended: true,
|
|
17
|
+
startcommands: 'default',
|
|
18
|
+
},
|
|
12
19
|
{
|
|
13
20
|
value: 'saas-template',
|
|
14
|
-
title: 'Revideo with Next.js
|
|
15
|
-
description: '
|
|
21
|
+
title: 'Revideo with Next.js',
|
|
22
|
+
description: 'A minimal web app built with Revideo and Next.js.',
|
|
23
|
+
recommended: true,
|
|
24
|
+
startCommands: 'next',
|
|
16
25
|
},
|
|
17
26
|
{
|
|
18
|
-
value: '
|
|
19
|
-
title: '
|
|
20
|
-
description: '
|
|
27
|
+
value: 'avatar-with-background',
|
|
28
|
+
title: 'Avatar with Background',
|
|
29
|
+
description: 'Create an avatar with a custom background.',
|
|
30
|
+
startcommands: 'default',
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
value: 'github-stars-celebration',
|
|
34
|
+
title: 'GitHub Stars Celebration',
|
|
35
|
+
description: 'Animate a celebration of GitHub repository stars.',
|
|
36
|
+
startcommands: 'default',
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
value: 'google-cloud-run-parallelized',
|
|
40
|
+
title: 'Google Cloud Run Parallelized',
|
|
41
|
+
description: 'Example of parallelized rendering using Google Cloud Run.',
|
|
42
|
+
startcommands: 'readme',
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
value: 'marketing-templates',
|
|
46
|
+
title: 'Marketing Templates',
|
|
47
|
+
description: 'A collection of templates for marketing videos.',
|
|
48
|
+
startcommands: 'readme',
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
value: 'minimal-drag-drop',
|
|
52
|
+
title: 'Drag and Drop Example',
|
|
53
|
+
description:
|
|
54
|
+
'A minimal example of an editor with drag-and-drop editing functionality.',
|
|
55
|
+
startcommands: 'next',
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
value: 'parallelized-aws-lambda',
|
|
59
|
+
title: 'Parallelized AWS Lambda',
|
|
60
|
+
description: 'Example of parallelized rendering using AWS Lambda.',
|
|
61
|
+
startcommands: 'readme',
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
value: 'reddit-post-video',
|
|
65
|
+
title: 'Reddit Post Video',
|
|
66
|
+
description: 'Generate a video from a Reddit post.',
|
|
67
|
+
startcommands: 'default',
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
value: 'rive-explanation-video',
|
|
71
|
+
title: 'Rive Explanation Video',
|
|
72
|
+
description: 'Create a code explanation video along with Rive animations.',
|
|
73
|
+
startcommands: 'default',
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
value: 'stitching-videos',
|
|
77
|
+
title: 'Stitching Videos',
|
|
78
|
+
description: 'Example of how to concatenate multiple videos together.',
|
|
79
|
+
startcommands: 'default',
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
value: 'three-js-example',
|
|
83
|
+
title: 'Three.js Example',
|
|
84
|
+
description: 'Integrate Three.js with Revideo for 3D animations.',
|
|
85
|
+
startcommands: 'default',
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
value: 'youtube-shorts',
|
|
89
|
+
title: 'YouTube Shorts',
|
|
90
|
+
description: 'Template for creating YouTube Shorts videos.',
|
|
91
|
+
startcommands: 'default',
|
|
21
92
|
},
|
|
22
93
|
];
|
|
23
94
|
|
|
24
95
|
async function run() {
|
|
25
96
|
const options = minimist(process.argv.slice(2));
|
|
26
97
|
|
|
27
|
-
|
|
28
|
-
|
|
98
|
+
const templateFlag = Object.keys(options).find(key =>
|
|
99
|
+
templates.some(template => template.value === key),
|
|
100
|
+
);
|
|
101
|
+
|
|
102
|
+
const pathResponse = await prompts([
|
|
29
103
|
// Prompt for project name
|
|
30
104
|
{
|
|
31
105
|
type: 'text',
|
|
@@ -64,21 +138,41 @@ async function run() {
|
|
|
64
138
|
},
|
|
65
139
|
format: value => path.resolve(value),
|
|
66
140
|
},
|
|
67
|
-
// Prompt for which example to scaffold
|
|
68
|
-
{
|
|
69
|
-
type: 'select',
|
|
70
|
-
name: 'starter',
|
|
71
|
-
message: 'Choose a starter template',
|
|
72
|
-
choices: templates,
|
|
73
|
-
},
|
|
74
141
|
]);
|
|
75
142
|
|
|
143
|
+
console.log(); // linebreak for better readability
|
|
144
|
+
|
|
145
|
+
let templateResponse;
|
|
146
|
+
if (templateFlag) {
|
|
147
|
+
templateResponse = {starter: templateFlag};
|
|
148
|
+
} else {
|
|
149
|
+
// Prompt for which example to scaffold
|
|
150
|
+
templateResponse = await prompts([
|
|
151
|
+
{
|
|
152
|
+
type: 'select',
|
|
153
|
+
name: 'starter',
|
|
154
|
+
message: 'Choose a starter template',
|
|
155
|
+
choices: templates.map(template => ({
|
|
156
|
+
title: template.recommended
|
|
157
|
+
? template.title + kleur.bold(' (Recommended)')
|
|
158
|
+
: template.title,
|
|
159
|
+
value: template.value,
|
|
160
|
+
description: template.description,
|
|
161
|
+
})),
|
|
162
|
+
},
|
|
163
|
+
]);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
const response = {...pathResponse, ...templateResponse};
|
|
167
|
+
|
|
76
168
|
// Abort if the user didn't provide a project name
|
|
77
169
|
if (!response.path) {
|
|
78
170
|
console.log(kleur.red('× Scaffolding aborted by the user.\n'));
|
|
79
171
|
return;
|
|
80
172
|
}
|
|
81
173
|
|
|
174
|
+
console.log('Scaffolding, this can take a few seconds...');
|
|
175
|
+
|
|
82
176
|
// Clone files
|
|
83
177
|
const templateDir = path.resolve(
|
|
84
178
|
fileURLToPath(import.meta.url),
|
|
@@ -123,10 +217,16 @@ async function run() {
|
|
|
123
217
|
const installCommand =
|
|
124
218
|
manager === 'yarn' ? ` ${boldManager}` : ` ${boldManager} install`;
|
|
125
219
|
|
|
126
|
-
|
|
220
|
+
const selectedTemplate = getTemplate(response.starter);
|
|
221
|
+
|
|
222
|
+
if (!selectedTemplate) {
|
|
223
|
+
throw Error(`Template ${response.starter.name} does not exist`);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
if (selectedTemplate.startcommands === 'default') {
|
|
127
227
|
console.log(installCommand);
|
|
128
228
|
console.log(` ${boldManager} start`);
|
|
129
|
-
} else {
|
|
229
|
+
} else if (selectedTemplate.startcommands === 'next') {
|
|
130
230
|
console.log(kleur.blue('\n√ Start the NextJS server:'));
|
|
131
231
|
console.log(` ${kleur.bold('cd')} next`);
|
|
132
232
|
console.log(installCommand);
|
|
@@ -138,6 +238,8 @@ async function run() {
|
|
|
138
238
|
console.log(` ${kleur.bold('cd')} revideo`);
|
|
139
239
|
console.log(installCommand);
|
|
140
240
|
console.log(` ${kleur.bold('npx')} revideo serve`);
|
|
241
|
+
} else {
|
|
242
|
+
console.log(kleur.blue('\nNow find the setup instructions in README.md'));
|
|
141
243
|
}
|
|
142
244
|
console.log();
|
|
143
245
|
}
|
|
@@ -171,6 +273,10 @@ function getPackageManager() {
|
|
|
171
273
|
return ua?.split(' ')[0].split('/')[0] ?? 'npm';
|
|
172
274
|
}
|
|
173
275
|
|
|
276
|
+
function getTemplate(value) {
|
|
277
|
+
return templates.find(template => template.value === value);
|
|
278
|
+
}
|
|
279
|
+
|
|
174
280
|
void run().catch(e => {
|
|
175
281
|
console.error(e);
|
|
176
282
|
sendEvent(EventName.Error, {error: e});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@revideo/create",
|
|
3
|
-
"version": "0.5.10
|
|
3
|
+
"version": "0.5.10",
|
|
4
4
|
"description": "Quickly scaffold revideo projects",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"author": "revideo",
|
|
@@ -20,17 +20,17 @@
|
|
|
20
20
|
"url": "https://github.com/havenhq/revideo.git"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
|
-
"@revideo/2d": "
|
|
24
|
-
"@revideo/core": "
|
|
25
|
-
"@revideo/ffmpeg": "
|
|
26
|
-
"@revideo/renderer": "
|
|
27
|
-
"@revideo/ui": "
|
|
28
|
-
"@revideo/vite-plugin": "
|
|
23
|
+
"@revideo/2d": "0.5.10",
|
|
24
|
+
"@revideo/core": "0.5.10",
|
|
25
|
+
"@revideo/ffmpeg": "0.5.10",
|
|
26
|
+
"@revideo/renderer": "0.5.10",
|
|
27
|
+
"@revideo/ui": "0.5.10",
|
|
28
|
+
"@revideo/vite-plugin": "0.5.10"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@revideo/telemetry": "
|
|
31
|
+
"@revideo/telemetry": "0.5.10",
|
|
32
32
|
"minimist": "^1.2.8",
|
|
33
33
|
"prompts": "^2.4.2"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "56d48446d0f2dd2146bf594516b880b38a6e36a9"
|
|
36
36
|
}
|