MCPcopy Create free account
hub / github.com/vercel/vercel / deploy

Function deploy

packages/client/src/deploy.ts:133–217  ·  view source on GitHub ↗
(
  files: FilesMap,
  clientOptions: VercelClientOptions,
  deploymentOptions: DeploymentOptions
)

Source from the content-addressed store, hash-verified

131}
132
133export async function* deploy(
134 files: FilesMap,
135 clientOptions: VercelClientOptions,
136 deploymentOptions: DeploymentOptions
137): AsyncIterableIterator<{ type: DeploymentEventType; payload: any }> {
138 const debug = createDebug(clientOptions.debug);
139
140 // Check if we should default to a static deployment
141 if (!deploymentOptions.name && files.size > 0) {
142 deploymentOptions.version = 2;
143 deploymentOptions.name =
144 files.size === 1 ? 'file' : getDefaultName(files, clientOptions);
145
146 if (deploymentOptions.name === 'file') {
147 debug('Setting deployment name to "file" for single-file deployment');
148 }
149 }
150
151 if (!deploymentOptions.name && files.size > 0) {
152 deploymentOptions.name =
153 clientOptions.defaultName || getDefaultName(files, clientOptions);
154 debug('No name provided. Defaulting to', deploymentOptions.name);
155 }
156
157 if (clientOptions.withCache) {
158 debug(
159 `'withCache' is provided. Force deploy will be performed with cache retention`
160 );
161 }
162
163 let deployment: Deployment | undefined;
164
165 try {
166 debug('Creating deployment');
167 for await (const event of postDeployment(
168 files,
169 clientOptions,
170 deploymentOptions
171 )) {
172 if (event.type === 'created') {
173 debug('Deployment created');
174 deployment = event.payload;
175 }
176
177 yield event;
178 }
179 } catch (e) {
180 debug('An unexpected error occurred when creating the deployment');
181 return yield { type: 'error', payload: e };
182 }
183
184 /**
185 * When using manual, the deployment will remain INITIALIZING until it is
186 * manually continued so we skip waiting for Ready State.
187 */
188 if (clientOptions.manual) {
189 debug('Manual mode - skipping ready state check');
190 return;

Callers 2

buildCreateDeploymentFunction · 0.90
uploadFunction · 0.90

Calls 7

createDebugFunction · 0.90
isReadyFunction · 0.90
isAliasAssignedFunction · 0.90
checkDeploymentStatusFunction · 0.90
getDefaultNameFunction · 0.85
postDeploymentFunction · 0.85
debugFunction · 0.50

Tested by

no test coverage detected