Skip to content

Commit

Permalink
refactor(core): rename "Stack.autoRun" to "autoSynth" (#3016)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: `StackProps.autoRun` was renamed to `StackProps.autoSynth`.
  • Loading branch information
Elad Ben-Israel authored Jun 23, 2019
1 parent 4a0272d commit 3b44791
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions packages/@aws-cdk/core/lib/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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());
Expand Down

0 comments on commit 3b44791

Please sign in to comment.