(dir: string, options: DevCommandOptions)
| 94 | const MINIMUM_NODE_MINOR = 16; |
| 95 | |
| 96 | export async function devCommand(dir: string, options: DevCommandOptions) { |
| 97 | try { |
| 98 | runtimeCheck(MINIMUM_NODE_MAJOR, MINIMUM_NODE_MINOR); |
| 99 | } catch (e) { |
| 100 | logger.log(`${chalkError("X Error:")} ${e}`); |
| 101 | process.exitCode = 1; |
| 102 | return; |
| 103 | } |
| 104 | |
| 105 | const authorization = await isLoggedIn(options.profile); |
| 106 | |
| 107 | if (!authorization.ok) { |
| 108 | if (authorization.error === "fetch failed") { |
| 109 | logger.log( |
| 110 | `${chalkError( |
| 111 | "X Error:" |
| 112 | )} Connecting to the server failed. Please check your internet connection or contact eric@trigger.dev for help.` |
| 113 | ); |
| 114 | } else { |
| 115 | logger.log( |
| 116 | `${chalkError("X Error:")} You must login first. Use the \`login\` CLI command.\n\n${ |
| 117 | authorization.error |
| 118 | }` |
| 119 | ); |
| 120 | } |
| 121 | process.exitCode = 1; |
| 122 | return; |
| 123 | } |
| 124 | |
| 125 | const devInstance = await startDev(dir, options, authorization.auth, authorization.dashboardUrl); |
| 126 | const { waitUntilExit } = devInstance.devReactElement; |
| 127 | await waitUntilExit(); |
| 128 | } |
| 129 | |
| 130 | async function startDev( |
| 131 | dir: string, |
no test coverage detected
searching dependent graphs…