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

Function startDev

packages/cli-v3/src/commands/dev.tsx:130–235  ·  view source on GitHub ↗
(
  dir: string,
  options: DevCommandOptions,
  authorization: { apiUrl: string; accessToken: string },
  dashboardUrl: string
)

Source from the content-addressed store, hash-verified

128}
129
130async function startDev(
131 dir: string,
132 options: DevCommandOptions,
133 authorization: { apiUrl: string; accessToken: string },
134 dashboardUrl: string
135) {
136 let rerender: (node: React.ReactNode) => void | undefined;
137
138 try {
139 if (options.logLevel) {
140 logger.loggerLevel = options.logLevel;
141 }
142
143 await printStandloneInitialBanner(true);
144
145 let displayedUpdateMessage = false;
146
147 if (!options.skipUpdateCheck) {
148 displayedUpdateMessage = await updateTriggerPackages(dir, { ...options }, true, true);
149 }
150
151 printDevBanner(displayedUpdateMessage);
152
153 logger.debug("Starting dev session", { dir, options, authorization });
154
155 let config = await readConfig(dir, {
156 projectRef: options.projectRef,
157 configFile: options.config,
158 });
159
160 logger.debug("Initial config", { config });
161
162 if (config.status === "error") {
163 logger.error("Failed to read config", config.error);
164 process.exit(1);
165 }
166
167 async function getDevReactElement(
168 configParam: ResolvedConfig,
169 authorization: { apiUrl: string; accessToken: string },
170 configPath?: string,
171 configModule?: any
172 ) {
173 const accessToken = authorization.accessToken;
174 const apiUrl = authorization.apiUrl;
175
176 apiClient = new CliApiClient(apiUrl, accessToken);
177
178 const devEnv = await apiClient.getProjectEnv({
179 projectRef: configParam.project,
180 env: "dev",
181 });
182
183 if (!devEnv.success) {
184 if (devEnv.error === "Project not found") {
185 logger.error(
186 `Project not found: ${configParam.project}. Ensure you are using the correct project ref and CLI profile (use --profile). Currently using the "${options.profile}" profile, which points to ${authorization.apiUrl}`
187 );

Callers 1

devCommandFunction · 0.85

Calls 7

updateTriggerPackagesFunction · 0.90
readConfigFunction · 0.90
printDevBannerFunction · 0.85
getDevReactElementFunction · 0.85
debugMethod · 0.65
errorMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…