Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: remove app boilerplate and improvements to cx protocol #868

Merged
merged 9 commits into from
Oct 8, 2018

Commits on Oct 8, 2018

  1. refactor: improvements to cx protocol

    Change the cx protocol to use environment variables and file output
    instead of argv/stdout. This simplifies the App boilerplate code.
    Now, apps look like this:
    
        const app = new App();
        // add stacks
        app.run();
    
    The protocol was also simplified to basically always synthesize all
    stacks in the app, eliminating the need for a "cx request" altogether.
    
    The toolkit was modified to cache the response of the first successful
    execution of the app (after environment contextual is resolved). This
    reduces the number of app executions to a maximum of 2 (if env context
    is missing) and normally 1. Previoiusly, "list" and "synth" were two
    separate commands, so 2 was the normal case.
    
    The protocol now uses the following environment variables:
    
     * `CDK_OUTDIR` represents the synthesis output directory. The toolkit
       allocates a temporary working directory when it executes the app and
       sets this variable.
     * `CDK_CONTEXT_JSON` is a JSON stringified context object.
    
    At the moment, if `CDK_OUTDIR` is not defined, an error message is printed
    indicating the minimum version of the toolkit required to interact with
    the app.
    
    Fixes #216
    
    BREAKING CHANGE
    
    This is a major breaking change:
    
    - The `cdk.App` initializer doesn't accept any arguments.
    - The `cdk.App#run` method does not return a `string` anymore.
    
    All AWS CDK apps in all languages would need to be modified
    to adhere to the new API of the `cdk.App` construct.
    
    Instead of:
    
        const app = new App(process.argv); // ERROR
        // add stacks
        process.stdout.write(app.run());   // ERROR
    
    The new usage is:
    
        const app = new App();
        // add stacks
        app.run();
    
    In order to interact with applications written using this
    version, the CDK Toolkit must also be update using:
    
        $ npm i -g aws-cdk
    Elad Ben-Israel committed Oct 8, 2018
    Configuration menu
    Copy the full SHA
    d9fb15e View commit details
    Browse the repository at this point in the history
  2. fix s3 integ test

    Elad Ben-Israel committed Oct 8, 2018
    Configuration menu
    Copy the full SHA
    bd5da91 View commit details
    Browse the repository at this point in the history
  3. Fix a couple more integration tests

    Elad Ben-Israel committed Oct 8, 2018
    Configuration menu
    Copy the full SHA
    f36f458 View commit details
    Browse the repository at this point in the history
  4. fix lint issue

    Elad Ben-Israel committed Oct 8, 2018
    Configuration menu
    Copy the full SHA
    6296289 View commit details
    Browse the repository at this point in the history
  5. more tslint fixes

    Elad Ben-Israel committed Oct 8, 2018
    Configuration menu
    Copy the full SHA
    909fcae View commit details
    Browse the repository at this point in the history
  6. cr fixes

    Elad Ben-Israel committed Oct 8, 2018
    Configuration menu
    Copy the full SHA
    a504d6f View commit details
    Browse the repository at this point in the history
  7. fixes

    - updates to pacakge-lock.json
    - fix integ test
    Elad Ben-Israel committed Oct 8, 2018
    Configuration menu
    Copy the full SHA
    698d3e0 View commit details
    Browse the repository at this point in the history
  8. Merge remote-tracking branch 'origin/master' into beinsrae/remove-app…

    …-boilerplate
    Elad Ben-Israel committed Oct 8, 2018
    Configuration menu
    Copy the full SHA
    6e42782 View commit details
    Browse the repository at this point in the history
  9. Merge remote-tracking branch 'origin/master' into beinsrae/remove-app…

    …-boilerplate
    Elad Ben-Israel committed Oct 8, 2018
    Configuration menu
    Copy the full SHA
    cd5d9fa View commit details
    Browse the repository at this point in the history