@revideo/create 0.5.10-alpha.1087 → 0.5.10-alpha.1094

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.
Files changed (2) hide show
  1. package/index.js +115 -16
  2. package/package.json +9 -9
package/index.js CHANGED
@@ -9,23 +9,90 @@ 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 (recommended)',
15
- description: 'An example project to get started with Revideo and Next.js.',
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: 'default',
19
- title: 'Minial, standalone Revideo project',
20
- description: 'A minimal example to get started with Revideo.',
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: 'parallelized-aws-lambda',
52
+ title: 'Parallelized AWS Lambda',
53
+ description: 'Example of parallelized rendering using AWS Lambda.',
54
+ startcommands: 'readme',
55
+ },
56
+ {
57
+ value: 'reddit-post-video',
58
+ title: 'Reddit Post Video',
59
+ description: 'Generate a video from a Reddit post.',
60
+ startcommands: 'default',
61
+ },
62
+ {
63
+ value: 'rive-explanation-video',
64
+ title: 'Rive Explanation Video',
65
+ description: 'Create a code explanation video along with Rive animations.',
66
+ startcommands: 'default',
67
+ },
68
+ {
69
+ value: 'stitching-videos',
70
+ title: 'Stitching Videos',
71
+ description: 'Example of how to concatenate multiple videos together.',
72
+ startcommands: 'default',
73
+ },
74
+ {
75
+ value: 'three-js-example',
76
+ title: 'Three.js Example',
77
+ description: 'Integrate Three.js with Revideo for 3D animations.',
78
+ startcommands: 'default',
79
+ },
80
+ {
81
+ value: 'youtube-shorts',
82
+ title: 'YouTube Shorts',
83
+ description: 'Template for creating YouTube Shorts videos.',
84
+ startcommands: 'default',
21
85
  },
22
86
  ];
23
87
 
24
88
  async function run() {
25
89
  const options = minimist(process.argv.slice(2));
26
90
 
27
- prompts.override(options);
28
- const response = await prompts([
91
+ const templateFlag = Object.keys(options).find(key =>
92
+ templates.some(template => template.value === key),
93
+ );
94
+
95
+ const pathResponse = await prompts([
29
96
  // Prompt for project name
30
97
  {
31
98
  type: 'text',
@@ -64,21 +131,41 @@ async function run() {
64
131
  },
65
132
  format: value => path.resolve(value),
66
133
  },
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
134
  ]);
75
135
 
136
+ console.log(); // linebreak for better readability
137
+
138
+ let templateResponse;
139
+ if (templateFlag) {
140
+ templateResponse = {starter: templateFlag};
141
+ } else {
142
+ // Prompt for which example to scaffold
143
+ templateResponse = await prompts([
144
+ {
145
+ type: 'select',
146
+ name: 'starter',
147
+ message: 'Choose a starter template',
148
+ choices: templates.map(template => ({
149
+ title: template.recommended
150
+ ? template.title + kleur.bold(' (Recommended)')
151
+ : template.title,
152
+ value: template.value,
153
+ description: template.description,
154
+ })),
155
+ },
156
+ ]);
157
+ }
158
+
159
+ const response = {...pathResponse, ...templateResponse};
160
+
76
161
  // Abort if the user didn't provide a project name
77
162
  if (!response.path) {
78
163
  console.log(kleur.red('× Scaffolding aborted by the user.\n'));
79
164
  return;
80
165
  }
81
166
 
167
+ console.log('Scaffolding, this can take a few seconds...');
168
+
82
169
  // Clone files
83
170
  const templateDir = path.resolve(
84
171
  fileURLToPath(import.meta.url),
@@ -123,10 +210,16 @@ async function run() {
123
210
  const installCommand =
124
211
  manager === 'yarn' ? ` ${boldManager}` : ` ${boldManager} install`;
125
212
 
126
- if (response.starter == 'default') {
213
+ const selectedTemplate = getTemplate(response.starter);
214
+
215
+ if (!selectedTemplate) {
216
+ throw Error(`Template ${response.starter.name} does not exist`);
217
+ }
218
+
219
+ if (selectedTemplate.startcommands === 'default') {
127
220
  console.log(installCommand);
128
221
  console.log(` ${boldManager} start`);
129
- } else {
222
+ } else if (selectedTemplate.startCommands === 'next') {
130
223
  console.log(kleur.blue('\n√ Start the NextJS server:'));
131
224
  console.log(` ${kleur.bold('cd')} next`);
132
225
  console.log(installCommand);
@@ -138,6 +231,8 @@ async function run() {
138
231
  console.log(` ${kleur.bold('cd')} revideo`);
139
232
  console.log(installCommand);
140
233
  console.log(` ${kleur.bold('npx')} revideo serve`);
234
+ } else {
235
+ console.log(kleur.blue('\nNow find the setup instructions in README.md'));
141
236
  }
142
237
  console.log();
143
238
  }
@@ -171,6 +266,10 @@ function getPackageManager() {
171
266
  return ua?.split(' ')[0].split('/')[0] ?? 'npm';
172
267
  }
173
268
 
269
+ function getTemplate(value) {
270
+ return templates.find(template => template.value === value);
271
+ }
272
+
174
273
  void run().catch(e => {
175
274
  console.error(e);
176
275
  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-alpha.1087+09caa1bb",
3
+ "version": "0.5.10-alpha.1094+c5b6e235",
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": "^0.5.10-alpha.1087+09caa1bb",
24
- "@revideo/core": "^0.5.10-alpha.1087+09caa1bb",
25
- "@revideo/ffmpeg": "^0.5.10-alpha.1087+09caa1bb",
26
- "@revideo/renderer": "^0.5.10-alpha.1087+09caa1bb",
27
- "@revideo/ui": "^0.5.10-alpha.1087+09caa1bb",
28
- "@revideo/vite-plugin": "^0.5.10-alpha.1087+09caa1bb"
23
+ "@revideo/2d": "^0.5.10-alpha.1094+c5b6e235",
24
+ "@revideo/core": "^0.5.10-alpha.1094+c5b6e235",
25
+ "@revideo/ffmpeg": "^0.5.10-alpha.1094+c5b6e235",
26
+ "@revideo/renderer": "^0.5.10-alpha.1094+c5b6e235",
27
+ "@revideo/ui": "^0.5.10-alpha.1094+c5b6e235",
28
+ "@revideo/vite-plugin": "^0.5.10-alpha.1094+c5b6e235"
29
29
  },
30
30
  "dependencies": {
31
- "@revideo/telemetry": "^0.5.10-alpha.1087+09caa1bb",
31
+ "@revideo/telemetry": "^0.5.10-alpha.1094+c5b6e235",
32
32
  "minimist": "^1.2.8",
33
33
  "prompts": "^2.4.2"
34
34
  },
35
- "gitHead": "09caa1bb5c62d8e239faf5c426c178da50d57a39"
35
+ "gitHead": "c5b6e2350e4f757b7e8f86da9110c7fad737181a"
36
36
  }