From 8c223eb899d69ccec5c4904ec9e75e336479a863 Mon Sep 17 00:00:00 2001 From: Elad Ben-Israel Date: Sun, 23 Jun 2019 23:53:24 +0300 Subject: [PATCH] refactor(core): rename "Stack.autoRun" to "autoSynth" BREAKING CHANGE: `StackProps.autoRun` was renamed to `StackProps.autoSynth`. --- packages/@aws-cdk/cdk/lib/app.ts | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/packages/@aws-cdk/cdk/lib/app.ts b/packages/@aws-cdk/cdk/lib/app.ts index dec5fe1720128..7a043f8c45d26 100644 --- a/packages/@aws-cdk/cdk/lib/app.ts +++ b/packages/@aws-cdk/cdk/lib/app.ts @@ -10,13 +10,16 @@ const APP_SYMBOL = Symbol.for('@aws-cdk/cdk.App'); */ export interface AppProps { /** - * Automatically call run before the application exits + * Automatically call `synth()` before the program exits. * - * If you set this, you don't have to call `synth()` anymore. + * If you set this, you don't have to call `synth()` explicitly. Note that + * this feature is only available for certain programming languages, and + * calling `synth()` is still recommended. * - * @default true if running via CDK toolkit (`CDK_OUTDIR` is set), false otherwise + * @default true if running via CDK CLI (`CDK_OUTDIR` is set), `false` + * otherwise */ - readonly autoRun?: boolean; + readonly autoSynth?: boolean; /** * The output directory into which to emit synthesized artifacts. @@ -101,8 +104,8 @@ export class App extends Construct { this.runtimeInfo = this.node.tryGetContext(cxapi.DISABLE_VERSION_REPORTING) ? false : true; this.outdir = props.outdir || process.env[cxapi.OUTDIR_ENV]; - const autoRun = props.autoRun !== undefined ? props.autoRun : cxapi.OUTDIR_ENV in process.env; - if (autoRun) { + const autoSynth = props.autoSynth !== undefined ? props.autoSynth : cxapi.OUTDIR_ENV in process.env; + if (autoSynth) { // synth() guarantuees it will only execute once, so a default of 'true' // doesn't bite manual calling of the function. process.once('beforeExit', () => this.synth());