@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.
@@ -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
- for (const name of ['Dockerfile', 'handler.js']) {
16
- const src = join(templateDir, name);
17
- const dest = join(destDir, name);
18
- fs.copyFileSync(src, dest);
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
@@ -71,4 +71,4 @@ const renderTwickVideo = async (variables, settings) => {
71
71
  }
72
72
  };
73
73
 
74
- export default renderTwickVideo;
74
+ export { renderTwickVideo };
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@twick/cloud-export-video",
3
- "version": "0.14.15",
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.15",
47
- "@twick/core": "0.14.15",
48
- "@twick/ffmpeg": "0.14.15",
49
- "@twick/renderer": "0.14.15",
50
- "@twick/ui": "0.14.15",
51
- "@twick/vite-plugin": "0.14.15",
52
- "@twick/visualizer": "0.14.15",
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"
@@ -1,5 +1,5 @@
1
1
  import { S3Client, PutObjectCommand } from '@aws-sdk/client-s3';
2
- import renderTwickVideo from '../../core/renderer.js';
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
- export const handler = async (event) => {
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;