-
Notifications
You must be signed in to change notification settings - Fork 15
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
Add tutorial for typescript #29
base: master
Are you sure you want to change the base?
Conversation
Codecov Report
@@ Coverage Diff @@
## master #29 +/- ##
==========================================
+ Coverage 97.52% 99.33% +1.81%
==========================================
Files 13 13
Lines 888 1050 +162
Branches 158 183 +25
==========================================
+ Hits 866 1043 +177
+ Misses 22 7 -15
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
. | ||
. | ||
"dependencies": { | ||
"cfn-rpdk": "https://github.com/eduardomourar/cloudformation-cli-typescript-plugin/releases/download/v0.3.3/cfn-rpdk-0.3.3.tgz", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can't this be specified in the file we generate on init? why have the customer do this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The support library is part of the init Template.
I would first update the unicorn maker repository and point to the latest support library version. |
There are also the following repositories containing multiple examples: https://github.com/eduardomourar/example-aws-resource-type and https://github.com/org-formation/aws-resource-providers |
``` | ||
import fetch, { Response } from 'node-fetch'; | ||
|
||
// Use this logger to forward log messages to CloudWatch Logs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the new support lib version, the logger proxy is being passed to the handler instead (similar to the java one).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i have created the following PR containing the updated logger: brianterry/unicorn-maker#10
return progress; | ||
``` | ||
|
||
Especially important in the create handler is to not assign read only properties, but instead throw and `InvalidRequest` esception. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe there is a typo, it should have been "exception"
return progress; | ||
``` | ||
|
||
After all the handlers have been implemented run `npm build`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be npm run build
. | ||
``` | ||
|
||
Run `npm install` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be npm install --optional
so that the AWS SDK, which is an optional dependency, gets installed
2. In `testing-unicorn-maker/sam-tests/create.json`, paste the following test\. | ||
|
||
**Note:** | ||
Add the necessary information, such as credential and remove any comments in the file before testing\. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is no need to have the user add valid AWS credentials. they can just be dummy ones because the handler are not making any API calls to AWS
This tutorial can now use the details from this AWS Blog post: https://aws.amazon.com/blogs/mt/introducing-typescript-support-for-building-aws-cloudformation-resource-types/ |
Any news about this tutorial ? |
Issue #, if available:
Description of changes:
The tutorial walks the user through setting up a resource using sample resource provider, Testing::Unicorn::Maker,
and run the contract tests.