(
explores: (Explore | ExploreError)[],
options: DeployArgs,
)
| 338 | }; |
| 339 | |
| 340 | export const deploy = async ( |
| 341 | explores: (Explore | ExploreError)[], |
| 342 | options: DeployArgs, |
| 343 | ): Promise<void> => { |
| 344 | if (explores.length === 0) { |
| 345 | GlobalState.log(styles.warning('No explores found')); |
| 346 | process.exit(1); |
| 347 | } |
| 348 | |
| 349 | const errors = explores.filter((e) => isExploreError(e)).length; |
| 350 | if (errors > 0) { |
| 351 | if (options.ignoreErrors) { |
| 352 | console.error( |
| 353 | styles.warning(`\nDeploying project with ${errors} errors\n`), |
| 354 | ); |
| 355 | } else { |
| 356 | console.error( |
| 357 | styles.error( |
| 358 | `Can't deploy with errors. If you still want to deploy, add ${styles.bold( |
| 359 | '--ignore-errors', |
| 360 | )} flag`, |
| 361 | ), |
| 362 | ); |
| 363 | process.exit(1); |
| 364 | } |
| 365 | } |
| 366 | |
| 367 | const lightdashProjectConfig = await readAndLoadLightdashProjectConfig( |
| 368 | path.resolve(options.projectDir), |
| 369 | options.projectUuid, |
| 370 | ); |
| 371 | |
| 372 | // These two methods are not critical to the deployment process, so we can ignore errors and show warnings instead |
| 373 | try { |
| 374 | await replaceProjectYamlTags( |
| 375 | options.projectUuid, |
| 376 | lightdashProjectConfig, |
| 377 | ); |
| 378 | } catch (e) { |
| 379 | console.error( |
| 380 | styles.warning( |
| 381 | `\nError replacing YAML tags: ${getErrorMessage(e)}\n`, |
| 382 | ), |
| 383 | ); |
| 384 | } |
| 385 | |
| 386 | try { |
| 387 | await replaceProjectParameters( |
| 388 | options.projectUuid, |
| 389 | lightdashProjectConfig, |
| 390 | ); |
| 391 | } catch (e) { |
| 392 | console.error( |
| 393 | styles.warning( |
| 394 | `\nError replacing project parameters: ${getErrorMessage(e)}\n`, |
| 395 | ), |
| 396 | ); |
| 397 | } |
no test coverage detected