Skip to content

🎥 Make videos programmatically with React

faster lambda builds

Jonny Burgere4204cb2ecc6
diff --git a/packages/lambda/src/admin/bundle-lambda.ts b/packages/lambda/build.ts
similarity index 76%
rename from packages/lambda/src/admin/bundle-lambda.ts
rename to packages/lambda/build.ts
index ddce704f4b..deac4f2bb6 100644
--- a/packages/lambda/src/admin/bundle-lambda.ts
+++ b/packages/lambda/build.ts
@@ -2,12 +2,12 @@ import {BundlerInternals} from '@remotion/bundler';
import {dir} from '@remotion/compositor-linux-arm64-gnu';
import fs, {cpSync, readdirSync} from 'node:fs';
import path from 'node:path';
-import {quit} from '../cli/helpers/quit';
-import {FUNCTION_ZIP_ARM64} from '../shared/function-zip-path';
-import zl = require('zip-lib');
+import {FUNCTION_ZIP_ARM64} from './src/shared/function-zip-path';
+
+import zl from 'zip-lib';
const bundleLambda = async () => {
- const outdir = path.join(__dirname, '..', `build-render`);
+ const outdir = path.join(__dirname, `build-render`);
fs.mkdirSync(outdir, {
recursive: true,
});
@@ -16,7 +16,7 @@ const bundleLambda = async () => {
fs.rmSync(outdir, {recursive: true});
fs.mkdirSync(outdir, {recursive: true});
const template = require.resolve(
- path.join(__dirname, '..', 'functions', 'index'),
+ path.join(__dirname, 'src', 'functions', 'index'),
);
await BundlerInternals.esbuild.build({
@@ -47,8 +47,6 @@ const bundleLambda = async () => {
path.join(
__dirname,
'..',
- '..',
- '..',
'renderer',
'node_modules',
'source-map',
@@ -57,17 +55,10 @@ const bundleLambda = async () => {
),
`${outdir}/mappings.wasm`,
);
-
await zl.archiveFolder(outdir, FUNCTION_ZIP_ARM64);
fs.rmSync(outdir, {recursive: true});
};
-bundleLambda()
- .then(() => {
- console.log('Bundled Lambda');
- })
- .catch((err) => {
- console.log(err);
- quit(1);
- });
+await bundleLambda();
+console.log('Bundled Lambda');
diff --git a/packages/lambda/package.json b/packages/lambda/package.json
index b5e5d61115..fa11b847d6 100644
--- a/packages/lambda/package.json
+++ b/packages/lambda/package.json
@@ -12,7 +12,7 @@
"testintegration": "vitest src/test/integration --run",
"lint": "eslint src --ext ts,tsx",
"test": "vitest src/test/unit --run",
- "make": "bun src/admin/bundle-lambda.ts",
+ "make": "bun build.ts",
"prepublishOnly": "bun src/admin/bundle-lambda.ts && bun ensure-version-match.js"
},
"author": "Jonny Burger <[email protected]>",
diff --git a/packages/lambda/tsconfig.json b/packages/lambda/tsconfig.json
index c86952a100..f802c24668 100644
--- a/packages/lambda/tsconfig.json
+++ b/packages/lambda/tsconfig.json
@@ -2,8 +2,7 @@
"extends": "../tsconfig.settings.json",
"compilerOptions": {
"rootDir": "src",
- "outDir": "dist",
- "lib": ["es2019", "dom"]
+ "outDir": "dist"
},
"include": ["src"],
"references": [