MCPcopy
hub / github.com/triggerdotdev/trigger.dev / _deployCommand

Function _deployCommand

packages/cli-v3/src/commands/deploy.ts:181–538  ·  view source on GitHub ↗
(dir: string, options: DeployCommandOptions)

Source from the content-addressed store, hash-verified

179}
180
181async function _deployCommand(dir: string, options: DeployCommandOptions) {
182 const span = trace.getSpan(context.active());
183
184 intro("Deploying project");
185
186 if (!options.skipUpdateCheck) {
187 await updateTriggerPackages(dir, { ...options }, true, true);
188 }
189
190 const authorization = await login({
191 embedded: true,
192 defaultApiUrl: options.apiUrl,
193 profile: options.profile,
194 });
195
196 if (!authorization.ok) {
197 if (authorization.error === "fetch failed") {
198 throw new Error(
199 `Failed to connect to ${authorization.auth?.apiUrl}. Are you sure it's the correct URL?`
200 );
201 } else {
202 throw new Error(
203 `You must login first. Use the \`login\` CLI command.\n\n${authorization.error}`
204 );
205 }
206 }
207
208 span?.setAttributes({
209 "cli.userId": authorization.userId,
210 "cli.email": authorization.email,
211 "cli.config.apiUrl": authorization.auth.apiUrl,
212 });
213
214 const resolvedConfig = await readConfig(dir, {
215 configFile: options.config,
216 projectRef: options.projectRef,
217 });
218
219 if (resolvedConfig.status === "error") {
220 logger.error("Failed to read config:", resolvedConfig.error);
221 span && recordSpanException(span, resolvedConfig.error);
222
223 throw new SkipLoggingError("Failed to read config");
224 }
225
226 logger.debug("Resolved config", { resolvedConfig });
227
228 span?.setAttributes({
229 "resolvedConfig.status": resolvedConfig.status,
230 "resolvedConfig.path": resolvedConfig.status === "file" ? resolvedConfig.path : undefined,
231 "resolvedConfig.config.project": resolvedConfig.config.project,
232 "resolvedConfig.config.projectDir": resolvedConfig.config.projectDir,
233 "resolvedConfig.config.triggerUrl": resolvedConfig.config.triggerUrl,
234 "resolvedConfig.config.triggerDirectories": resolvedConfig.config.triggerDirectories,
235 ...flattenAttributes(resolvedConfig.config.retries, "resolvedConfig.config.retries"),
236 });
237
238 const apiClient = new CliApiClient(authorization.auth.apiUrl, authorization.auth.accessToken);

Callers 1

deployCommandFunction · 0.85

Calls 15

getProjectEnvMethod · 0.95
initializeDeploymentMethod · 0.95
updateTriggerPackagesFunction · 0.90
loginFunction · 0.90
flattenAttributesFunction · 0.90
spinnerFunction · 0.90
safeJsonParseFunction · 0.90
parseBuildErrorStackFunction · 0.90
chalkErrorFunction · 0.90
logESMRequireErrorFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…