(
dir: string,
options: DevCommandOptions,
authorization: { apiUrl: string; accessToken: string },
dashboardUrl: string
)
| 128 | } |
| 129 | |
| 130 | async 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 | ); |
no test coverage detected
searching dependent graphs…