Skip to content

Change to OpenFunction #1

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

Merged
merged 1 commit into from
Mar 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,10 @@ npm run conformance
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:

> You'll need to install typescript first by: `npm install typescript --save-dev`

```
npm compile
npx tsc
```

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

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

```shell
# Login to npm registry, contact repo admin for https://www.npmjs.com/ user name and password
npm login
# First run a dry run to find out errors
npm publish ./ --access public --dry-run
# Then publish the package
npm publish --access public
```
### Reverting a Publish

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

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

### API Extractor

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

> You'll need to install `api-extractor` first by `npm install -g @microsoft/api-extractor` and then install `gts` by `npm install gts`

```sh
npm run docs
```
Expand Down
35 changes: 19 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# Functions Framework for Node.js

[![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)
[![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)

[![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]

> This is OpenFunction's nodejs functions-framework forked from [GCP functions-framework-nodejs](https://github.com/GoogleCloudPlatform/functions-framework-nodejs)

An open source FaaS (Function as a Service) framework based on [Express](https://expressjs.com/)
for writing portable Node.js functions -- brought to you by the Google Cloud Functions team.
for writing portable Node.js functions

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

The framework allows you to go from:

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

```sh
npm install @google-cloud/functions-framework
npm install @openfunction/functions-framework
```

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

```sh
npx @google-cloud/functions-framework --target=helloWorld
npx @openfunction/functions-framework --target=helloWorld
```

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

```sh
npm install @google-cloud/functions-framework
npm install @openfunction/functions-framework
```

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

```sh
pack build \
--builder gcr.io/buildpacks/builder:v1 \
--env GOOGLE_FUNCTION_SIGNATURE_TYPE=http \
--env GOOGLE_FUNCTION_TARGET=helloWorld \
--builder openfunction/builder-node:v2-16.13 \
--env FUNC_TYPE=http \
--env FUNC_NAME=helloWorld \
my-first-function
```

Expand Down Expand Up @@ -228,7 +231,7 @@ It will be passed as an argument to your function when it receives a request.
Note that your function must use the `cloudevent`-style function signature:

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

functions.cloudEvent('helloCloudEvents', (cloudevent) => {
console.log(cloudevent.specversion);
Expand All @@ -246,7 +249,7 @@ To enable the CloudEvent functions, you must list the Functions Framework as a d
```json
{
"dependencies": {
"@google-cloud/functions-framework": "~2.0.0-beta.1"
"@openfunction/functions-framework": "~0.3.6"
}
}
```
Expand All @@ -262,9 +265,9 @@ More advanced guides and docs can be found in the [`docs/` folder](docs/).
Contributions to this library are welcome and encouraged. See
[CONTRIBUTING](CONTRIBUTING.md) for more information on how to get started.

[ff_node_unit_img]: https://github.com/GoogleCloudPlatform/functions-framework-nodejs/workflows/Node.js%20Unit%20CI/badge.svg
[ff_node_unit_link]: https://github.com/GoogleCloudPlatform/functions-framework-nodejs/actions?query=workflow%3A"Node.js+Unit+CI"
[ff_node_lint_img]: https://github.com/GoogleCloudPlatform/functions-framework-nodejs/workflows/Node.js%20Lint%20CI/badge.svg
[ff_node_lint_link]: https://github.com/GoogleCloudPlatform/functions-framework-nodejs/actions?query=workflow%3A"Node.js+Lint+CI"
[ff_node_conformance_img]: https://github.com/GoogleCloudPlatform/functions-framework-nodejs/workflows/Node.js%20Conformance%20CI/badge.svg
[ff_node_conformance_link]: https://github.com/GoogleCloudPlatform/functions-framework-nodejs/actions?query=workflow%3A"Node.js+Conformance+CI"
[ff_node_unit_img]: https://github.com/openfunction/functions-framework-nodejs/workflows/Node.js%20Unit%20CI/badge.svg
[ff_node_unit_link]: https://github.com/openfunction/functions-framework-nodejs/actions?query=workflow%3A"Node.js+Unit+CI"
[ff_node_lint_img]: https://github.com/openfunction/functions-framework-nodejs/workflows/Node.js%20Lint%20CI/badge.svg
[ff_node_lint_link]: https://github.com/openfunction/functions-framework-nodejs/actions?query=workflow%3A"Node.js+Lint+CI"
[ff_node_conformance_img]: https://github.com/openfunction/functions-framework-nodejs/workflows/Node.js%20Conformance%20CI/badge.svg
[ff_node_conformance_link]: https://github.com/openfunction/functions-framework-nodejs/actions?query=workflow%3A"Node.js+Conformance+CI"
6 changes: 3 additions & 3 deletions docs/cloudevents.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ This guide shows you how to use the Functions Framework for local testing with:

## Local Testing of CloudEvents

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

```
npm install --save @google-cloud/functions-framework
npm install --save @openfunction/functions-framework
```

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

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

functions.cloudEvent('helloCloudEvents', (cloudevent) => {
console.log(cloudevent.specversion);
Expand Down
2 changes: 1 addition & 1 deletion docs/debugging.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ exports.helloWorld = (req, res) => {
2. Install the Functions Framework:

```sh
npm install @google-cloud/functions-framework
npm install @openfunction/functions-framework
```

3. Run `node`, enable the inspector and run the Functions Framework:
Expand Down
4 changes: 2 additions & 2 deletions docs/esm.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Using ES Modules

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

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.

Expand Down Expand Up @@ -34,7 +34,7 @@ Create a `package.json` file:
},
"main": "index.js",
"dependencies": {
"@google-cloud/functions-framework": "^1.9.0"
"@openfunction/functions-framework": "^0.3.6"
}
}
```
Expand Down
9 changes: 7 additions & 2 deletions docs/esm/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Using ES Modules

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

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.

Expand Down Expand Up @@ -36,11 +36,16 @@ Create a `package.json` file:
},
"main": "index.js",
"dependencies": {
"@google-cloud/functions-framework": "^1.9.0"
"@openfunction/functions-framework": "^0.3.6"
}
}
```

Update corresponding `package-lock.json`:
```shell
npm install @openfunction/functions-framework --package-lock-only
```

Create a `index.js` file:

```js
Expand Down
Loading