Skip to content

Commit 8284d9f

Browse files
committed
📝 doc: update REAMDE and CONTRUBUTINIG
Signed-off-by: Haili Zhang <haili.zhang@outlook.com>
1 parent 74cbea9 commit 8284d9f

File tree

2 files changed

+24
-33
lines changed

2 files changed

+24
-33
lines changed

CONTRIBUTING.md

Lines changed: 13 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,44 @@
11
# How to Contribute
22

3-
We'd love to accept your patches and contributions to this project. There are
4-
just a few small guidelines you need to follow.
3+
We'd love to accept your patches and contributions to this project. There are a few small guidelines you need to follow.
54

65
## Contributor License Agreement
76

8-
Contributions to this project must be accompanied by a Contributor License
9-
Agreement. You (or your employer) retain the copyright to your contribution;
10-
this simply gives us permission to use and redistribute your contributions as
11-
part of the project. Head over to <https://cla.developers.google.com/> to see
12-
your current agreements on file or to sign a new one.
7+
Contributions to this project must be accompanied by a Developer Certificate of Origin (DCO). You (or your employer) retain the copyright to your contribution; this gives us permission to use and redistribute your contributions as part of the project. Head over to <https://developercertificate.org/> to see your current agreements on file or to sign a new one.
138

14-
You generally only need to submit a CLA once, so if you've already submitted one
15-
(even if it was for a different project), you probably don't need to do it
16-
again.
9+
You only need to submit a DTO once, so if you've already submitted one (even if it was for a different project), you probably don't need to do it again.
1710

1811
## Code reviews
1912

20-
All submissions, including submissions by project members, require review. We
21-
use GitHub pull requests for this purpose. Consult
22-
[GitHub Help](https://help.github.com/articles/about-pull-requests/) for more
23-
information on using pull requests.
13+
All submissions, including submissions by project members, require review. We use GitHub pull requests for this purpose. Consult [GitHub Help](https://help.github.com/articles/about-pull-requests/) for more information on using pull requests.
2414

2515
## Testing
2616

2717
### Unit Tests
2818

2919
All pull requests should have an associated test to ensure foward compatibility.
3020

21+
> Make sure you have installed [Dapr](https://dapr.io/) before running unit tests, check out [Install Dapr CLI](https://docs.dapr.io/getting-started/install-dapr-cli/) for more details
22+
3123
To run an individual test, you can run a command such as the following:
3224

33-
```
25+
```sh
3426
npm run test -- -g 'loading function'
3527
```
3628

37-
### Conformance Tests
38-
39-
To run the conformance tests, first install Go 1.16+, then run the tests:
40-
41-
```
42-
npm run conformance
43-
```
44-
4529
### Manual Testing
4630

47-
When developing a feature locally, you can install a local version of the Functions Framework
48-
using `npm link`. First compile your local clone of the Functions Framework:
31+
When developing a feature locally, you can install a local version of the Functions Framework using `npm link`. First compile your local clone of the Functions Framework:
4932

5033
> You'll need to install typescript first by: `npm install typescript --save-dev`
5134
52-
```
35+
```sh
5336
npx tsc
5437
```
5538

5639
Then link the Functions Framework using `npm link`.
5740

58-
```
41+
```sh
5942
npm link
6043
```
6144

@@ -65,14 +48,15 @@ You can then run the Functions Framework locally using `functions-framework`.
6548

6649
This module is published using Release Please. When you merge a release PR, the npm package will be automatically published.
6750

68-
```shell
51+
```sh
6952
# Login to npm registry, contact repo admin for https://www.npmjs.com/ user name and password
7053
npm login
7154
# First run a dry run to find out errors
7255
npm publish ./ --access public --dry-run
7356
# Then publish the package
7457
npm publish --access public
7558
```
59+
7660
### Reverting a Publish
7761

7862
If the release process fails, you can revert the publish by running the following (i.e. unpublishing `1.10.0`):
@@ -101,5 +85,4 @@ The docs will be generated in [`docs/generated/`](docs/generated/).
10185

10286
## Community Guidelines
10387

104-
This project follows [Google's Open Source Community
105-
Guidelines](https://opensource.google.com/conduct/).
88+
This project follows [CNCF openness guidelines](https://www.cncf.io/blog/2019/06/11/cncf-openness-guidelines/).

README.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ ignored.
168168
| ------------------ | ------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
169169
| `--port` | `PORT` | The port on which the Functions Framework listens for requests. Default: `8080` |
170170
| `--target` | `FUNCTION_TARGET` | The name of the exported function to be invoked in response to requests. Default: `function` |
171-
| `--signature-type` | `FUNCTION_SIGNATURE_TYPE` | The signature used when writing your function. Controls unmarshalling rules and determines which arguments are used to invoke your function. Default: `http`; accepted values: `http` or `event` or `cloudevent` |
171+
| `--signature-type` | `FUNCTION_SIGNATURE_TYPE` | The signature used when writing your function. Controls unmarshalling rules and determines which arguments are used to invoke your function. Default: `http`; accepted values: `http` or `event` or `cloudevent` or `openfunction` |
172172
| `--source` | `FUNCTION_SOURCE` | The path to the directory of your function. Default: `cwd` (the current working directory) |
173173

174174
You can set command-line flags in your `package.json` via the `start` script.
@@ -231,8 +231,16 @@ async function tryKnativeAsync(ctx, data) {
231231
// Send output in async way via Dapr
232232
await ctx.send(data);
233233

234-
// Use `response` method to prepare data as HTTP response
235-
return ctx.response(data);
234+
// Use `ctx.res` object to deal with HTTP response
235+
ctx.res.send(data);
236+
```
237+
238+
Remember that you also need set command-line flags `--signature-type=openfunction`, for example in your `package.json` via the `start` script:
239+
240+
```js
241+
"scripts": {
242+
"start": "functions-framework --signature-type=openfunction --target=tryKnativeAsync"
243+
}
236244
```
237245
238246
### Google Cloud Functions

0 commit comments

Comments
 (0)