Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit afa6140

Browse files
authoredMar 1, 2022
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

File tree

16 files changed

+2015
-190
lines changed

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

‎docs/esm/package-lock.json

Lines changed: 1827 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎docs/esm/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111
"test": "mocha test/*.test.js --timeout=20000"
1212
},
1313
"dependencies": {
14-
"@google-cloud/functions-framework": "^1.9.0"
14+
"@openfunction/functions-framework": "^0.3.6"
1515
}
1616
}

‎docs/generated/api.json

Lines changed: 45 additions & 45 deletions
Large diffs are not rendered by default.

‎docs/generated/api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## API Report File for "@google-cloud/functions-framework"
1+
## API Report File for "@openfunction/functions-framework"
22

33
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
44

‎docs/testing-functions.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ the output. You do not need to set up (or mock) an actual server.
1616
The Functions Framework provides utility methods that streamline the process of
1717
setting up functions and the environment for testing, constructing input
1818
parameters, and interpreting results. These are available in the
19-
`@google-cloud/functions-framework/testing` module.
19+
`@openfunction/functions-framework/testing` module.
2020

2121
## Loading functions for testing
2222

@@ -25,7 +25,7 @@ export the functions you wish to unit test.
2525

2626
```js
2727
// hello_tests.js
28-
import * as functions from '@google-cloud/functions-framework';
28+
import * as functions from '@openfunction/functions-framework';
2929

3030
// declare a cloud function and export it so that it can be
3131
// imported in unit tests
@@ -44,7 +44,7 @@ that are available when you pass a callback to `functions.http` directly:
4444

4545
```js
4646
// hello_tests.js
47-
import * as functions from '@google-cloud/functions-framework';
47+
import * as functions from '@openfunction/functions-framework';
4848

4949
// register the HelloTests with the Functions Framework
5050
functions.http('HelloTests', (req, res) => {
@@ -58,7 +58,7 @@ your unit test you must first load the module that registers the function you wi
5858
to test.
5959

6060
```js
61-
import {getFunction} from "@google-cloud/functions-framework/testing";
61+
import {getFunction} from "@openfunction/functions-framework/testing";
6262

6363
describe("HelloTests", () => {
6464
before(async () => {
@@ -85,7 +85,7 @@ create simple stubs to use in unit tests.
8585

8686
```js
8787
import assert from "assert";
88-
import {getFunction} from "@google-cloud/functions-framework/testing";
88+
import {getFunction} from "@openfunction/functions-framework/testing";
8989

9090
describe("HelloTests", () => {
9191
before(async () => {
@@ -134,7 +134,7 @@ any Javascript testing framework:
134134
import assert from "assert";
135135
import sinon from "sinon";
136136
import {CloudEvent} from "cloudevents";
137-
import {getFunction} from "@google-cloud/functions-framework/testing";
137+
import {getFunction} from "@openfunction/functions-framework/testing";
138138

139139
import {MyDependency} from "./my_dependency.js";
140140

@@ -177,7 +177,7 @@ SuperTest.
177177

178178
```js
179179
import supertest from 'supertest';
180-
import {getTestServer} from '@google-cloud/functions-framework/testing';
180+
import {getTestServer} from '@openfunction/functions-framework/testing';
181181

182182
describe("HelloTests", function () {
183183
before(async () => {

‎docs/typescript.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ the Functions Framework.
1212
2. Install the required packages:
1313

1414
```sh
15-
npm install @google-cloud/functions-framework
15+
npm install @openfunction/functions-framework
1616
npm install @types/express concurrently nodemon --save-dev
1717
```
1818

@@ -31,7 +31,7 @@ the Functions Framework.
3131
4. Replace the contents of `src/index.ts` with:
3232

3333
```ts
34-
import type { HttpFunction } from '@google-cloud/functions-framework/build/src/functions';
34+
import type { HttpFunction } from '@openfunction/functions-framework/build/src/functions';
3535
3636
export const helloWorld: HttpFunction = (req, res) => {
3737
res.send('Hello, World');

‎package-lock.json

Lines changed: 76 additions & 92 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
{
2-
"name": "@google-cloud/functions-framework",
3-
"version": "3.0.0",
2+
"name": "@openfunction/functions-framework",
3+
"version": "0.3.6",
44
"description": "FaaS (Function as a service) framework for writing portable Node.js functions",
55
"engines": {
66
"node": ">=10.0.0"
77
},
8-
"repository": "GoogleCloudPlatform/functions-framework-nodejs",
8+
"repository": "openfunction/functions-framework-nodejs",
99
"main": "build/src/index.js",
1010
"types": "build/src/index.d.ts",
1111
"exports": {
1212
".": "./build/src/index.js",
1313
"./testing": "./build/src/testing.js"
1414
},
1515
"dependencies": {
16+
"@openfunction/functions-framework": "0.3.6",
1617
"body-parser": "^1.18.3",
1718
"cloudevents": "^5.3.2",
1819
"express": "^4.16.4",
@@ -42,7 +43,7 @@
4243
"functions-framework": "./build/src/main.js",
4344
"functions-framework-nodejs": "./build/src/main.js"
4445
},
45-
"author": "Google Inc.",
46+
"author": "OpenFunction",
4647
"license": "Apache-2.0",
4748
"devDependencies": {
4849
"@microsoft/api-extractor": "^7.18.20",
@@ -60,6 +61,6 @@
6061
"pack-n-play": "^1.0.0-2",
6162
"sinon": "^12.0.0",
6263
"supertest": "6.1.6",
63-
"typescript": "4.5.4"
64+
"typescript": "^4.5.5"
6465
}
6566
}

‎test/conformance/function.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* eslint-disable node/no-missing-require */
22
const fs = require('fs');
3-
const functions = require('@google-cloud/functions-framework');
3+
const functions = require('@openfunction/functions-framework');
44
const fileName = 'function_output.json';
55

66
functions.http('writeHttpDeclarative', (req, res) => {

‎test/conformance/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"dependencies": {
3-
"@google-cloud/functions-framework": "file:../../"
3+
"@openfunction/functions-framework": "file:../../"
44
},
55
"scripts": {
66
"start": "functions-framework"

0 commit comments

Comments
 (0)
Please sign in to comment.