MCPcopy Create free account
hub / github.com/lightdash/lightdash / deploy

Function deploy

packages/cli/src/handlers/deploy.ts:340–482  ·  view source on GitHub ↗
(
    explores: (Explore | ExploreError)[],
    options: DeployArgs,
)

Source from the content-addressed store, hash-verified

338};
339
340export 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 }

Callers 3

previewHandlerFunction · 0.90
startPreviewHandlerFunction · 0.90
deployHandlerFunction · 0.85

Calls 13

isExploreErrorFunction · 0.90
getErrorMessageFunction · 0.90
replaceProjectYamlTagsFunction · 0.85
replaceProjectParametersFunction · 0.85
replaceProjectDefaultsFunction · 0.85
deployBatchedFunction · 0.85
logDeployWarningsFunction · 0.85
errorMethod · 0.80
logMethod · 0.45
resolveMethod · 0.45

Tested by

no test coverage detected