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

Feature Request: Use ts-node rather than npm watch for boilerplate #1532

Closed
mipearson opened this issue Jan 13, 2019 · 3 comments · Fixed by #2527 or MechanicalRock/tech-radar#14 · May be fixed by MechanicalRock/cdk-constructs#5, MechanicalRock/cdk-constructs#6 or MechanicalRock/cdk-constructs#7
Labels
feature-request A feature should be added or improved.

Comments

@mipearson
Copy link

This is a suggestion rather than a bug - something to consider for your boilerplate generated by cdk init:

In my CDK projects I've been doing the following:

cdk init sample-app
npm i ts-node

And then modifying the cdk.json:

{
  "app": "./node_modules/.bin/ts-node -T bin/cdk.ts"
}

The -T flag skips typechecking, speeding up runtime, as I generally have a test suite / editor that will get cross if there's a typing issue.

I've done this as the workflow is a bit easier day to day, and avoids a potential problem when sharing this code with others less familiar with TypeScript where they may not know that they need to compile it & keep that compilation up to date. I also anticipate that people will be directly resistant to this if they're used to Ruby/Python/etc.

@kennu
Copy link

kennu commented Feb 4, 2019

Thanks @eladb for pointing to this suggestion in #539. I converted a monorepo project to use this approach (although without the -T option) and it seems to work quite well when sharing the package.json and tsconfig.json for the Stack and its Constructs. Maybe it also works when the Constructs are separate repos/packages but didn't really try it yet.

@mitchlloyd
Copy link
Contributor

@rix0rrr Does the CDK team agree with this change? Happy to submit a PR if that is the case. For people getting introduced to TypeScript through CDK, the boostrapped experience is a little rough.

@eladb
Copy link
Contributor

eladb commented Mar 17, 2019

Sounds good to me. It will definitely reduce some friction. @Doug-AWS this will require some updates to sample code and workshop once it lands.

mitchlloyd added a commit to mitchlloyd/aws-cdk that referenced this issue May 11, 2019
eladb pushed a commit that referenced this issue May 14, 2019
Update sample-app with ts-node in a backwards compatible way (`npm run build` still compiles the code).

Closes #1532
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment