Skip to content

Commit afa6140

Browse files
authored
Change to OpenFunction (#1)
Signed-off-by: Benjamin Huo <[email protected]> Signed-off-by: benjaminhuo <[email protected]> Signed-off-by: Benjamin Huo <[email protected]>
1 parent 198faee commit afa6140

16 files changed

+2015
-190
lines changed

CONTRIBUTING.md

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,10 @@ npm run conformance
4747
When developing a feature locally, you can install a local version of the Functions Framework
4848
using `npm link`. First compile your local clone of the Functions Framework:
4949

50+
> You'll need to install typescript first by: `npm install typescript --save-dev`
51+
5052
```
51-
npm compile
53+
npx tsc
5254
```
5355

5456
Then link the Functions Framework using `npm link`.
@@ -63,26 +65,34 @@ You can then run the Functions Framework locally using `functions-framework`.
6365

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

68+
```shell
69+
# Login to npm registry, contact repo admin for https://www.npmjs.com/ user name and password
70+
npm login
71+
# First run a dry run to find out errors
72+
npm publish ./ --access public --dry-run
73+
# Then publish the package
74+
npm publish --access public
75+
```
6676
### Reverting a Publish
6777

6878
If the release process fails, you can revert the publish by running the following (i.e. unpublishing `1.10.0`):
6979

7080
```sh
71-
# Login to the Wombat Dressing Room. Create a 24 hour token. Close the window.
72-
npm login --registry https://wombat-dressing-room.appspot.com
7381
# Unpublish the package (must be done within 72 hours of publishing).
7482
# If >72 hours, deprecate a specific release and publish a newer version.
75-
# i.e. `npm deprecate @google-cloud/functions-framework@1.10.0 "Deprecate 1.10.0"
83+
# i.e. `npm deprecate @openfunction/functions-framework@0.3.6 "archive old version"`
7684
# See https://docs.npmjs.com/policies/unpublish#what-to-do-if-your-package-does-not-meet-the-unpublish-criteria
77-
npm unpublish @google-cloud/functions-framework@1.10.0
85+
npm unpublish @openfunction/functions-framework@0.3.6
7886
# Set the default version to the previous working version.
79-
npm dist-tag add @google-cloud/functions-framework@1.9.0 latest --registry=https://wombat-dressing-room.appspot.com
87+
npm dist-tag add @openfunction/functions-framework@0.3.3 latest
8088
```
8189

8290
### API Extractor
8391

8492
To generate the API Extractor documentation, run the API extractor with the following command:
8593

94+
> You'll need to install `api-extractor` first by `npm install -g @microsoft/api-extractor` and then install `gts` by `npm install gts`
95+
8696
```sh
8797
npm run docs
8898
```

README.md

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
# Functions Framework for Node.js
22

3-
[![npm version](https://img.shields.io/npm/v/@google-cloud/functions-framework.svg)](https://www.npmjs.com/package/@google-cloud/functions-framework) [![npm downloads](https://img.shields.io/npm/dm/@google-cloud/functions-framework.svg)](https://npmcharts.com/compare/@google-cloud/functions-framework?minimal=true)
3+
[![npm version](https://img.shields.io/npm/v/@openfunction/functions-framework.svg)](https://www.npmjs.com/package/@openfunction/functions-framework) [![npm downloads](https://img.shields.io/npm/dm/@openfunction/functions-framework.svg)](https://npmcharts.com/compare/@openfunction/functions-framework?minimal=true)
44

55
[![Node unit CI][ff_node_unit_img]][ff_node_unit_link] [![Node lint CI][ff_node_lint_img]][ff_node_lint_link] [![Node conformace CI][ff_node_conformance_img]][ff_node_conformance_link]
66

7+
> This is OpenFunction's nodejs functions-framework forked from [GCP functions-framework-nodejs](https://github.com/GoogleCloudPlatform/functions-framework-nodejs)
8+
79
An open source FaaS (Function as a Service) framework based on [Express](https://expressjs.com/)
8-
for writing portable Node.js functions -- brought to you by the Google Cloud Functions team.
10+
for writing portable Node.js functions
911

1012
The Functions Framework lets you write lightweight functions that run in many
1113
different environments, including:
@@ -14,6 +16,7 @@ different environments, including:
1416
* Your local development machine
1517
* [Cloud Run](https://cloud.google.com/run/) and [Cloud Run for Anthos](https://cloud.google.com/anthos/run)
1618
* [Knative](https://github.com/knative/)-based environments
19+
* [OpenFunction](https://github.com/OpenFunction/OpenFunction)
1720

1821
The framework allows you to go from:
1922

@@ -53,7 +56,7 @@ handling logic.
5356
Add the Functions Framework to your `package.json` file using `npm`.
5457

5558
```sh
56-
npm install @google-cloud/functions-framework
59+
npm install @openfunction/functions-framework
5760
```
5861

5962
## Quickstarts
@@ -71,7 +74,7 @@ npm install @google-cloud/functions-framework
7174
1. Run the following command:
7275

7376
```sh
74-
npx @google-cloud/functions-framework --target=helloWorld
77+
npx @openfunction/functions-framework --target=helloWorld
7578
```
7679

7780
1. Open http://localhost:8080/ in your browser and see _Hello, World_.
@@ -95,7 +98,7 @@ npm install @google-cloud/functions-framework
9598
1. Now install the Functions Framework:
9699

97100
```sh
98-
npm install @google-cloud/functions-framework
101+
npm install @openfunction/functions-framework
99102
```
100103

101104
1. Add a `start` script to `package.json`, with configuration passed via
@@ -132,9 +135,9 @@ command-line arguments:
132135

133136
```sh
134137
pack build \
135-
--builder gcr.io/buildpacks/builder:v1 \
136-
--env GOOGLE_FUNCTION_SIGNATURE_TYPE=http \
137-
--env GOOGLE_FUNCTION_TARGET=helloWorld \
138+
--builder openfunction/builder-node:v2-16.13 \
139+
--env FUNC_TYPE=http \
140+
--env FUNC_NAME=helloWorld \
138141
my-first-function
139142
```
140143

@@ -228,7 +231,7 @@ It will be passed as an argument to your function when it receives a request.
228231
Note that your function must use the `cloudevent`-style function signature:
229232
230233
```js
231-
const functions = require('@google-cloud/functions-framework');
234+
const functions = require('@openfunction/functions-framework');
232235
233236
functions.cloudEvent('helloCloudEvents', (cloudevent) => {
234237
console.log(cloudevent.specversion);
@@ -246,7 +249,7 @@ To enable the CloudEvent functions, you must list the Functions Framework as a d
246249
```json
247250
{
248251
"dependencies": {
249-
"@google-cloud/functions-framework": "~2.0.0-beta.1"
252+
"@openfunction/functions-framework": "~0.3.6"
250253
}
251254
}
252255
```
@@ -262,9 +265,9 @@ More advanced guides and docs can be found in the [`docs/` folder](docs/).
262265
Contributions to this library are welcome and encouraged. See
263266
[CONTRIBUTING](CONTRIBUTING.md) for more information on how to get started.
264267
265-
[ff_node_unit_img]: https://github.com/GoogleCloudPlatform/functions-framework-nodejs/workflows/Node.js%20Unit%20CI/badge.svg
266-
[ff_node_unit_link]: https://github.com/GoogleCloudPlatform/functions-framework-nodejs/actions?query=workflow%3A"Node.js+Unit+CI"
267-
[ff_node_lint_img]: https://github.com/GoogleCloudPlatform/functions-framework-nodejs/workflows/Node.js%20Lint%20CI/badge.svg
268-
[ff_node_lint_link]: https://github.com/GoogleCloudPlatform/functions-framework-nodejs/actions?query=workflow%3A"Node.js+Lint+CI"
269-
[ff_node_conformance_img]: https://github.com/GoogleCloudPlatform/functions-framework-nodejs/workflows/Node.js%20Conformance%20CI/badge.svg
270-
[ff_node_conformance_link]: https://github.com/GoogleCloudPlatform/functions-framework-nodejs/actions?query=workflow%3A"Node.js+Conformance+CI"
268+
[ff_node_unit_img]: https://github.com/openfunction/functions-framework-nodejs/workflows/Node.js%20Unit%20CI/badge.svg
269+
[ff_node_unit_link]: https://github.com/openfunction/functions-framework-nodejs/actions?query=workflow%3A"Node.js+Unit+CI"
270+
[ff_node_lint_img]: https://github.com/openfunction/functions-framework-nodejs/workflows/Node.js%20Lint%20CI/badge.svg
271+
[ff_node_lint_link]: https://github.com/openfunction/functions-framework-nodejs/actions?query=workflow%3A"Node.js+Lint+CI"
272+
[ff_node_conformance_img]: https://github.com/openfunction/functions-framework-nodejs/workflows/Node.js%20Conformance%20CI/badge.svg
273+
[ff_node_conformance_link]: https://github.com/openfunction/functions-framework-nodejs/actions?query=workflow%3A"Node.js+Conformance+CI"

docs/cloudevents.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@ This guide shows you how to use the Functions Framework for local testing with:
77

88
## Local Testing of CloudEvents
99

10-
Install `@google-cloud/functions-framework` and list it as a dependency in your `package.json`:
10+
Install `@openfunction/functions-framework` and list it as a dependency in your `package.json`:
1111

1212
```
13-
npm install --save @google-cloud/functions-framework
13+
npm install --save @openfunction/functions-framework
1414
```
1515

1616
Create an `index.js` file and declare your function:
1717

1818
```js
19-
const functions = require('@google-cloud/functions-framework');
19+
const functions = require('@openfunction/functions-framework');
2020

2121
functions.cloudEvent('helloCloudEvents', (cloudevent) => {
2222
console.log(cloudevent.specversion);

docs/debugging.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ exports.helloWorld = (req, res) => {
1313
2. Install the Functions Framework:
1414

1515
```sh
16-
npm install @google-cloud/functions-framework
16+
npm install @openfunction/functions-framework
1717
```
1818

1919
3. Run `node`, enable the inspector and run the Functions Framework:

docs/esm.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Using ES Modules
22

3-
The Functions Framework >= `1.9.0` supports loading your code as an ES Module.
3+
The Functions Framework >= `0.3.6` supports loading your code as an ES Module.
44

55
ECMAScript modules (ES modules or ESM) are a TC39 standard, unflagged feature in Node >=14 for loading JavaScript modules. As opposed to CommonJS, ESM provides an asynchronous API for loading modules and provides a very commonly adopted syntax improvement via `import` and `export` statements.
66

@@ -34,7 +34,7 @@ Create a `package.json` file:
3434
},
3535
"main": "index.js",
3636
"dependencies": {
37-
"@google-cloud/functions-framework": "^1.9.0"
37+
"@openfunction/functions-framework": "^0.3.6"
3838
}
3939
}
4040
```

docs/esm/README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Using ES Modules
22

3-
The Functions Framework >= `1.9.0` supports loading your code as an ES Module.
3+
The Functions Framework >= `0.3.6` supports loading your code as an ES Module.
44

55
ECMAScript modules (ES modules or ESM) are a TC39 standard, unflagged feature in Node >=14 for loading JavaScript modules. As opposed to CommonJS, ESM provides an asynchronous API for loading modules and provides a very commonly adopted syntax improvement via `import` and `export` statements.
66

@@ -36,11 +36,16 @@ Create a `package.json` file:
3636
},
3737
"main": "index.js",
3838
"dependencies": {
39-
"@google-cloud/functions-framework": "^1.9.0"
39+
"@openfunction/functions-framework": "^0.3.6"
4040
}
4141
}
4242
```
4343

44+
Update corresponding `package-lock.json`:
45+
```shell
46+
npm install @openfunction/functions-framework --package-lock-only
47+
```
48+
4449
Create a `index.js` file:
4550

4651
```js

0 commit comments

Comments
 (0)