-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Support ts-node app driver #822
Comments
Why does this not work? Or is this issue about making it the default via init templates? |
(My question is: why is this a ticket?) |
I think it's a proposed improvement on our current template/guidelines to use "node" and require users to have a separate compile step... |
If I take a brand new project from {
"app": "npx ts-node bin/test_cdk.ts"
} When I run |
Does it work now in 0.12.0? |
Yes it does! Thanks. |
ts-node doesnt work for me (as of CDK 0.19.0) has something changed? The error I get is:
|
Seems like the toolkit can't find I verified the following configuration works with 0.19.0 and node.js v10.13.0: cdk.json {
"app": "npx ts-node bin/hello-cdk.ts"
} package.json: {
"devDependencies": {
"@types/node": "^8.9.4",
"aws-cdk": "^0.19.0",
"ts-node": "^7.0.1",
"typescript": "^3.1.2"
},
"dependencies": {
"@aws-cdk/cdk": "^0.19.0"
}
} |
hmm wierd..
package.json:
cdk.json
then
I usually use yarn not npx, so lets give that a try: I changed cdk.json to
then
trying
If I try running the TS file directly it runs okay:
So im out of ideas now... |
I think the missing piece of information here was "Windows". Your npx executable probably ends up being called
(Or |
@rix0rrr wow ye! I am running in the git bash shell in windows so I am surprised that there is a difference but indeed running Thanks for all you assistance guys, I hope this helps other future googlers too 😉 |
Oh, that confuses me too then. But it might be that the bash shell for Windows has the same behavior as |
@rix0rrr sorry to keep going on about this mate, but although the "add .cmd" works on windows it doesnt work on osx or linux. On those platforms you can just do "npx" or "yarn" without the ".cmd" which is annoying as I want a consistent build command on all platforms. Any idea if there is a way around this? |
Offhand, making an executable Let me think about other solutions. |
An alternative is we run the command through the shell on Windows... but that opens up a host of potential shell quoting issues that I really don't want to be responsible for. Will crop up easily in a directory with spaces, not to mention that quoted argument parsing in Windows is unpredictable and depends on a complicated dance between OS and userspace code. |
I am experimenting around with run-script-os lets me do:
It works, but it feels like it should be part of cdk somehow.. |
@rix0rrr what do you think? Should we reopen this issue because it would be nice to have a cross-platform solution as the extra CDK compilation step with TS really shouldnt be needed.. |
Sure, let's reopen |
Okay, too much detritus in this ticket. I'll create a new one |
Instead of requiring a build step to convert the Typescript code to javascript, it would help development cycle time if cdk.json could say something like:
The text was updated successfully, but these errors were encountered: