From 3b44791c71d06e69d61d8dd301ef9ba52b72832f Mon Sep 17 00:00:00 2001 From: Elad Ben-Israel Date: Mon, 24 Jun 2019 00:52:21 +0300 Subject: [PATCH] refactor(core): rename "Stack.autoRun" to "autoSynth" (#3016) BREAKING CHANGE: `StackProps.autoRun` was renamed to `StackProps.autoSynth`. --- packages/@aws-cdk/core/lib/app.ts | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/packages/@aws-cdk/core/lib/app.ts b/packages/@aws-cdk/core/lib/app.ts index 8ce6b7275c4dc..44974b28eb71a 100644 --- a/packages/@aws-cdk/core/lib/app.ts +++ b/packages/@aws-cdk/core/lib/app.ts @@ -10,13 +10,16 @@ const APP_SYMBOL = Symbol.for('@aws-cdk/core.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());