How to use the @aws-cdk/cx-api.DISABLE_ASSET_STAGING_CONTEXT function in @aws-cdk/cx-api

To help you get started, we’ve selected a few @aws-cdk/cx-api examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aws / aws-cdk / packages / @aws-cdk / assets / lib / staging.ts View on Github external
constructor(scope: Construct, id: string, props: StagingProps) {
    super(scope, id);

    this.sourcePath = props.sourcePath;
    this.copyOptions = props;
    this.sourceHash = fingerprint(this.sourcePath, props);

    const stagingDisabled = this.node.tryGetContext(cxapi.DISABLE_ASSET_STAGING_CONTEXT);
    if (stagingDisabled) {
      this.stagedPath = this.sourcePath;
    } else {
      this.relativePath = `asset.` + this.sourceHash + path.extname(this.sourcePath);
      this.stagedPath = this.relativePath; // always relative to outdir
    }
  }
github aws / aws-cdk / packages / aws-cdk / lib / api / cxapp / exec.ts View on Github external
let versionReporting: boolean = config.settings.get(['versionReporting']);
  if (versionReporting === undefined) {
    versionReporting = true; // defaults to true
  }

  if (!versionReporting) {
    context[cxapi.DISABLE_VERSION_REPORTING] = true;
  }

  let stagingEnabled = config.settings.get(['staging']);
  if (stagingEnabled === undefined) {
    stagingEnabled = true;
  }
  if (!stagingEnabled) {
    context[cxapi.DISABLE_ASSET_STAGING_CONTEXT] = true;
  }

  debug('context:', context);
  env[cxapi.CONTEXT_ENV] = JSON.stringify(context);

  const app = config.settings.get(['app']);
  if (!app) {
    throw new Error(`--app is required either in command-line, in ${PROJECT_CONFIG} or in ${USER_DEFAULTS}`);
  }

  // by pass "synth" if app points to a cloud assembly
  if (await fs.pathExists(app) && (await fs.stat(app)).isDirectory()) {
    debug('--app points to a cloud assembly, so we by pass synth');
    return new cxapi.CloudAssembly(app);
  }