trigger.dev
Version:
A Command-Line Interface for Trigger.dev projects
32 lines • 1.3 kB
JavaScript
import { glob } from "tinyglobby";
import * as tar from "tar";
import { logger } from "../utilities/logger.js";
// The bundle dir is generated build output, so the usual source ignores (dist,
// node_modules, ...) would strip load-bearing files: under npx the controller
// entry points live beneath a node_modules path segment.
const BUNDLE_IGNORES = ["**/.DS_Store"];
// Bundle contents land at the archive root; the build server extracts without stripping
export async function createBundleArchive(bundleDir, outputPath) {
logger.debug("Creating bundle archive", { bundleDir, outputPath });
const files = await glob(["**/*"], {
cwd: bundleDir,
ignore: BUNDLE_IGNORES,
dot: true, // .trigger/skills and .dockerignore must be included
absolute: false,
onlyFiles: true,
followSymbolicLinks: false,
});
if (files.length === 0) {
throw new Error("No files found in the bundle output. This is likely a bug.");
}
await tar.create({
gzip: true,
file: outputPath,
cwd: bundleDir,
portable: true,
preservePaths: false,
mtime: new Date(0),
}, files);
logger.debug("Bundle archive created", { outputPath, fileCount: files.length });
}
//# sourceMappingURL=bundleArchive.js.map