@twick/cloud-export-video 0.14.15 → 0.14.17
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/bin/twick-export-video.js +14 -4
- package/core/renderer.js +1 -1
- package/package.json +10 -8
- package/platform/aws/handler.js +18 -2
|
@@ -12,12 +12,22 @@ function copyTemplate(destDir) {
|
|
|
12
12
|
const templateDir = join(pkgRoot, 'platform', 'aws');
|
|
13
13
|
if (!fs.existsSync(destDir)) fs.mkdirSync(destDir, { recursive: true });
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
fs.
|
|
15
|
+
// Create platform/aws directory structure to maintain consistency with CMD ["platform/aws/handler.handler"]
|
|
16
|
+
const platformAwsDir = join(destDir, 'platform', 'aws');
|
|
17
|
+
if (!fs.existsSync(platformAwsDir)) {
|
|
18
|
+
fs.mkdirSync(platformAwsDir, { recursive: true });
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
// Copy Dockerfile to root (it references platform/aws/handler.handler)
|
|
22
|
+
const dockerfileSrc = join(templateDir, 'Dockerfile');
|
|
23
|
+
const dockerfileDest = join(destDir, 'Dockerfile');
|
|
24
|
+
fs.copyFileSync(dockerfileSrc, dockerfileDest);
|
|
25
|
+
|
|
26
|
+
// Copy handler.js to platform/aws/ to match the CMD path
|
|
27
|
+
const handlerSrc = join(templateDir, 'handler.js');
|
|
28
|
+
const handlerDest = join(platformAwsDir, 'handler.js');
|
|
29
|
+
fs.copyFileSync(handlerSrc, handlerDest);
|
|
30
|
+
|
|
21
31
|
// Minimal package.json to enable docker layer caching (npm ci)
|
|
22
32
|
const pkgJsonPath = join(destDir, 'package.json');
|
|
23
33
|
if (!fs.existsSync(pkgJsonPath)) {
|
package/core/renderer.js
CHANGED
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twick/cloud-export-video",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.17",
|
|
4
4
|
"description": "Twick cloud function for exporting video with platform-specific templates (AWS Lambda container)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "core/renderer.js",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": "./core/renderer.js",
|
|
9
9
|
"./aws": "./platform/aws/handler.js",
|
|
10
|
+
"./aws/cjs": "./platform/aws/handler.cjs",
|
|
10
11
|
"./platform/aws/*": "./platform/aws/*"
|
|
11
12
|
},
|
|
12
13
|
"bin": {
|
|
@@ -22,6 +23,7 @@
|
|
|
22
23
|
"verify:aws": "node -e \"require('fs').accessSync('platform/aws/Dockerfile'); require('fs').accessSync('platform/aws/handler.js'); console.log('AWS platform assets present')\"",
|
|
23
24
|
"pack:aws": "npm run verify:aws && npm pack",
|
|
24
25
|
"release:aws": "npm run verify:aws && npm publish --access public --tag aws",
|
|
26
|
+
"deploy:aws": "node scripts/deploy-aws.js",
|
|
25
27
|
"prepublishOnly": "npm run verify:aws"
|
|
26
28
|
},
|
|
27
29
|
"publishConfig": {
|
|
@@ -43,13 +45,13 @@
|
|
|
43
45
|
},
|
|
44
46
|
"dependencies": {
|
|
45
47
|
"@sparticuz/chromium": "^129.0.0",
|
|
46
|
-
"@twick/2d": "0.14.
|
|
47
|
-
"@twick/core": "0.14.
|
|
48
|
-
"@twick/ffmpeg": "0.14.
|
|
49
|
-
"@twick/renderer": "0.14.
|
|
50
|
-
"@twick/ui": "0.14.
|
|
51
|
-
"@twick/vite-plugin": "0.14.
|
|
52
|
-
"@twick/visualizer": "0.14.
|
|
48
|
+
"@twick/2d": "0.14.17",
|
|
49
|
+
"@twick/core": "0.14.17",
|
|
50
|
+
"@twick/ffmpeg": "0.14.17",
|
|
51
|
+
"@twick/renderer": "0.14.17",
|
|
52
|
+
"@twick/ui": "0.14.17",
|
|
53
|
+
"@twick/vite-plugin": "0.14.17",
|
|
54
|
+
"@twick/visualizer": "0.14.17",
|
|
53
55
|
"@aws-sdk/client-s3": "^3.620.0",
|
|
54
56
|
"ffmpeg-static": "^5.2.0",
|
|
55
57
|
"fluent-ffmpeg": "^2.1.3"
|
package/platform/aws/handler.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { S3Client, PutObjectCommand } from '@aws-sdk/client-s3';
|
|
2
|
-
import renderTwickVideo from '
|
|
2
|
+
import { renderTwickVideo } from '@twick/cloud-export-video';
|
|
3
3
|
|
|
4
4
|
const s3Client = new S3Client({
|
|
5
5
|
region: process.env.EXPORT_VIDEO_S3_REGION || process.env.AWS_REGION || 'us-east-1',
|
|
@@ -107,11 +107,25 @@ const buildPublicUrl = ({ bucket, key, region, baseUrl }) => {
|
|
|
107
107
|
* Returns: JSON payload containing the uploaded video URL and metadata
|
|
108
108
|
*/
|
|
109
109
|
|
|
110
|
-
|
|
110
|
+
const handler = async (event) => {
|
|
111
111
|
console.log('Video processor function invoked');
|
|
112
112
|
console.log('Event:', JSON.stringify(event));
|
|
113
113
|
const projectData = event.arguments || {};
|
|
114
114
|
|
|
115
|
+
if(!renderTwickVideo) {
|
|
116
|
+
return {
|
|
117
|
+
statusCode: 500,
|
|
118
|
+
headers: {
|
|
119
|
+
'Content-Type': 'application/json',
|
|
120
|
+
'Access-Control-Allow-Origin': '*',
|
|
121
|
+
},
|
|
122
|
+
body: JSON.stringify({
|
|
123
|
+
error: 'Failed to load renderTwickVideo',
|
|
124
|
+
message: 'Failed to load renderTwickVideo',
|
|
125
|
+
}),
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
|
|
115
129
|
try {
|
|
116
130
|
// Validate required fields
|
|
117
131
|
if (!projectData) {
|
|
@@ -293,3 +307,5 @@ ${mediaFiles.map((file, index) => ` ${index + 1}. ${file.filename} (${file.data
|
|
|
293
307
|
};
|
|
294
308
|
}
|
|
295
309
|
};
|
|
310
|
+
|
|
311
|
+
module.exports.handler = handler;
|