aws-rfdk icon indicating copy to clipboard operation
aws-rfdk copied to clipboard

Allow TS examples to build without requiring a full package build

Open horsmand opened this issue 4 years ago • 0 comments

Currently to build our TS examples like All-In-AWS-Infrastructure-Basic you need to first run the build.sh script in the base directory of the repo. This is cumbersome and time consuming, so if we can set out repo up to avoid this, it would be easier to use the examples.

Use Case

When someone wants to use a TS example, they need to follow these steps:

  1. Run build.sh from the base directory, waiting for the full install, build, and tests to run for all the packages in the repo.
  2. Navigate to the example directory and run yarn run build to execute the build.

This can be error prone and the error messaging for trying to run the example build before the full build doesn't make the solution obvious.

It would be ideal if we could simplify this to just being able to run yarn and yarn build from the examples directory and not have to worry about the base directory's build.

Proposed Solution

We need to do these things to get this to work:

  1. Make packages/aws-rfdk/tsconfig.json a static file rather than being generated by build.sh.
  2. Change the build script target for the examples to use tsc -b instead of just tsc.
  3. We've updated some example to contain the extra steps to get the build to work using the build.sh script, so those need to be updated to use the simplified method.

tsconfig.js

We currently have this line in build.sh to generate the tsconfig.json for the aws-rfdk package:

/bin/bash scripts/generate-aggregate-tsconfig.sh > tsconfig.json

We originally had this because it's what CDK does to avoid having to add and update tsconfig.json files in all of their packages. Since we made the decision to switch away from multiple packages in a repo (we had core and deadline as their own packages rather than in a shared package), we don't really need this feature anymore. The tsconfig.json file content shouldn't need to change often, so it can be made into a static file and delete this script.

  • [x] :wave: I may be able to implement this feature request
  • [ ] :warning: This feature might incur a breaking change

This is a :rocket: Feature Request

horsmand avatar Nov 05 '20 22:11 horsmand