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

Add tutorial for typescript #29

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

omkhegde
Copy link
Contributor

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.

@codecov
Copy link

codecov bot commented Oct 30, 2020

Codecov Report

Merging #29 into master will increase coverage by 1.81%.
The diff coverage is n/a.

Impacted file tree graph

@@            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     
Flag Coverage Δ
unittests 99.33% <ø> (+1.81%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/utils.ts 100.00% <0.00%> (ø)
src/metrics.ts 100.00% <0.00%> (ø)
python/rpdk/typescript/codegen.py 100.00% <0.00%> (ø)
src/resource.ts 98.04% <0.00%> (+3.41%) ⬆️
src/proxy.ts 100.00% <0.00%> (+4.25%) ⬆️
src/log-delivery.ts 98.82% <0.00%> (+5.60%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4215ab3...d2436fc. Read the comment docs.

.
.
"dependencies": {
"cfn-rpdk": "https://github.com/eduardomourar/cloudformation-cli-typescript-plugin/releases/download/v0.3.3/cfn-rpdk-0.3.3.tgz",

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?

Copy link
Contributor

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.

@eduardomourar
Copy link
Contributor

I would first update the unicorn maker repository and point to the latest support library version.

@eduardomourar
Copy link
Contributor

eduardomourar commented Nov 2, 2020

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.
Copy link
Contributor

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).

Copy link
Contributor

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.
Copy link
Contributor

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`.
Copy link
Contributor

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`
Copy link
Contributor

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\.
Copy link
Contributor

@eduardomourar eduardomourar Nov 2, 2020

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

@eduardomourar
Copy link
Contributor

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/

@BourgoisMickael
Copy link

Any news about this tutorial ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants