title: AWS CDK: run external build command in CDK sequence?
body: <p>Is it possible to run an external build command as part of a CDK stack sequence? Intention: 1) create a rest API, 2) write rest URL to config file, 3) build and deploy a React app:</p>
  
  <pre class="lang-ts prettyprint-override"><code>import apigateway = require('@aws-cdk/aws-apigateway');
  import cdk = require('@aws-cdk/core');
  import fs = require('fs')
  import s3deployment = require('@aws-cdk/aws-s3-deployment');
  
  export class MyStack extends cdk.Stack {
  
    const restApi = new apigateway.RestApi(this, ..);
    fs.writeFile('src/app-config.json', 
      JSON.stringify({ "api": restApi.deploymentStage.urlForPath('/myResource') }))
  
    // TODO locally run 'npm run build', create 'build' folder incl rest api config
  
    const websiteBucket = new s3.Bucket(this, ..)
    new s3deployment.BucketDeployment(this, .. {
        sources: [s3deployment.Source.asset('build')],
        destinationBucket: websiteBucket
    }) 
  }
  </code></pre>