MCPcopy Index your code
hub / github.com/triggerdotdev/trigger.dev / copyAdditionalFiles

Function copyAdditionalFiles

packages/cli-v3/src/commands/deploy.ts:1813–1917  ·  view source on GitHub ↗
(
  config: ResolvedConfig,
  tempDir: string
)

Source from the content-addressed store, hash-verified

1811 };
1812
1813async function copyAdditionalFiles(
1814 config: ResolvedConfig,
1815 tempDir: string
1816): Promise<AdditionalFilesReturn> {
1817 const additionalFiles = config.additionalFiles ?? [];
1818 const noMatches: string[] = [];
1819
1820 if (additionalFiles.length === 0) {
1821 return { ok: true };
1822 }
1823
1824 return await tracer.startActiveSpan(
1825 "copyAdditionalFiles",
1826 {
1827 attributes: {
1828 "config.additionalFiles": additionalFiles,
1829 },
1830 },
1831 async (span) => {
1832 try {
1833 logger.debug(`Copying files to ${tempDir}`, {
1834 additionalFiles,
1835 });
1836
1837 const globOptions = {
1838 withFileTypes: true,
1839 ignore: ["node_modules"],
1840 cwd: config.projectDir,
1841 nodir: true,
1842 } satisfies GlobOptions;
1843
1844 const globs: Array<GlobOptions> = [];
1845 let i = 0;
1846
1847 for (const additionalFile of additionalFiles) {
1848 let glob: GlobOptions | Glob<typeof globOptions>;
1849
1850 if (i === 0) {
1851 glob = new Glob(additionalFile, globOptions);
1852 } else {
1853 const previousGlob = globs[i - 1];
1854 if (!previousGlob) {
1855 logger.error("No previous glob, this shouldn't happen", { i, additionalFiles });
1856 continue;
1857 }
1858
1859 // Use the previous glob's options and cache
1860 glob = new Glob(additionalFile, previousGlob);
1861 }
1862
1863 if (!(Symbol.asyncIterator in glob)) {
1864 logger.error("Glob should be an async iterator", { glob });
1865 throw new Error("Unrecoverable error while copying additional files");
1866 }
1867
1868 let matches = 0;
1869 for await (const file of glob) {
1870 matches++;

Callers 1

compileProjectFunction · 0.85

Calls 5

recordSpanExceptionFunction · 0.85
startActiveSpanMethod · 0.80
debugMethod · 0.65
errorMethod · 0.65
filterMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…