(options: {
agent?: Agent;
apiUrl?: string;
debug?: boolean;
deploymentId: string;
path: string;
teamId?: string;
token: string;
userAgent?: string;
vercelOutputDir?: string;
archive?: ArchiveFormat;
})
| 17 | * events early. |
| 18 | */ |
| 19 | export async function* continueDeployment(options: { |
| 20 | agent?: Agent; |
| 21 | apiUrl?: string; |
| 22 | debug?: boolean; |
| 23 | deploymentId: string; |
| 24 | path: string; |
| 25 | teamId?: string; |
| 26 | token: string; |
| 27 | userAgent?: string; |
| 28 | vercelOutputDir?: string; |
| 29 | archive?: ArchiveFormat; |
| 30 | }): AsyncIterableIterator<{ type: DeploymentEventType; payload: any }> { |
| 31 | const debug = createDebug(options.debug); |
| 32 | debug(`Continuing deployment: ${options.deploymentId}`); |
| 33 | const outputDir = |
| 34 | options.vercelOutputDir || join(options.path, '.vercel', 'output'); |
| 35 | |
| 36 | /** |
| 37 | * We need to ensure that the output directory exists before proceeding with |
| 38 | * the continuation. This is important because we only allow continuing for |
| 39 | * prebuilt deployments. |
| 40 | */ |
| 41 | if (!(await fs.pathExists(outputDir))) { |
| 42 | return yield { |
| 43 | type: 'error', |
| 44 | payload: new DeploymentError({ |
| 45 | code: 'output_dir_not_found', |
| 46 | message: `Output directory not found at ${outputDir}. Run 'vercel build' first.`, |
| 47 | }), |
| 48 | }; |
| 49 | } |
| 50 | |
| 51 | const { fileList } = await buildFileTree( |
| 52 | options.path, |
| 53 | { isDirectory: true, prebuilt: true, vercelOutputDir: outputDir }, |
| 54 | debug |
| 55 | ); |
| 56 | |
| 57 | /** |
| 58 | * Files that must be sent individually (outside the tar archive) so the |
| 59 | * API can inspect them before the build starts. |
| 60 | */ |
| 61 | const provisionJsonPath = join(outputDir, 'provision.json'); |
| 62 | const unbundledFiles = fileList.filter(f => f === provisionJsonPath); |
| 63 | |
| 64 | let files: FilesMap; |
| 65 | if (options.archive === 'tgz') { |
| 66 | files = await createTgzFiles(options.path, fileList, debug, unbundledFiles); |
| 67 | // Hash excluded files individually and merge them into the FilesMap |
| 68 | if (unbundledFiles.length > 0) { |
| 69 | const individualFiles = await hashes(unbundledFiles); |
| 70 | for (const [sha, entry] of individualFiles) { |
| 71 | files.set(sha, entry); |
| 72 | } |
| 73 | } |
| 74 | } else { |
| 75 | files = await hashes(fileList); |
| 76 | } |
no test coverage detected