From 19559bcec9f67c053c51e5071a611435d2c8c3cf Mon Sep 17 00:00:00 2001 From: Alasdair McLeay Date: Sun, 29 Jan 2023 12:11:01 +0000 Subject: [PATCH] Initial docs --- .gitignore | 1 + README.md | 28 ++++++++++++++++++++++- package.json | 10 ++++++++ remix-google-cloud-functions/package.json | 6 +++-- 4 files changed, 42 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 8406dfc..915a34d 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ node_modules !.yarn/releases !.yarn/sdks !.yarn/versions +/remix-google-cloud-functions/README.md diff --git a/README.md b/README.md index 97d5063..e4868f6 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,39 @@ # remix-google-cloud-functions -Google Cloud functions request handler for Remix. +[Remix](https://remix.run) [Adapter](https://remix.run/docs/en/v1/other-api/adapter) for [Google Cloud Functions](https://cloud.google.com/functions) and [Firebase Functions](https://firebase.google.com/docs/functions). ## Usage +### Firebase + +See the [example project](./example/). + +```sh +npm i remix-google-cloud-functions @remix-run/node @google-cloud/functions-framework firebase-functions +``` + +Create a Firebase function as follows - `build` should point to the output from `remix build` or `remix dev`. + +```js +const { onRequest } = require("firebase-functions/v2/https"); +const { createRequestHandler } = require("remix-google-cloud-functions"); + +const remix = onRequest( + createRequestHandler({ + build: require("../build"), + }) +); +module.exports = { remix }; +``` + +### Google Cloud Functions + ```sh npm i remix-google-cloud-functions @remix-run/node @google-cloud/functions-framework ``` +TBC. Refer to the Firebase example above or follow the [official guide](https://cloud.google.com/functions/docs/writing/write-http-functions) + ## About Remix [Remix](https://remix.run) is a web framework that helps you build better websites with React. diff --git a/package.json b/package.json index 3642257..49a09ef 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,15 @@ { "private": true, + "description": "Remix Adapter for Google Cloud Functions and Firebase Functions", + "license": "MIT", + "author": "Alasdair McLeay", + "repository": { + "type": "git", + "url": "https://github.com/penx/remix-google-cloud-functions" + }, + "bugs": { + "url": "https://github.com/penx/remix-google-cloud-functions/issues" + }, "packageManager": "yarn@3.3.1", "workspaces": [ "example", diff --git a/remix-google-cloud-functions/package.json b/remix-google-cloud-functions/package.json index b15e36b..43c49cb 100644 --- a/remix-google-cloud-functions/package.json +++ b/remix-google-cloud-functions/package.json @@ -1,8 +1,9 @@ { "name": "remix-google-cloud-functions", - "description": "Google Cloud functions request handler for Remix", + "description": "Remix Adapter for Google Cloud Functions and Firebase Functions", "version": "0.0.3", "license": "MIT", + "author": "Alasdair McLeay", "main": "build/index.js", "repository": { "type": "git", @@ -13,7 +14,8 @@ }, "scripts": { "build": "rm -rf build && tsc -b", - "test": "jest" + "test": "jest", + "prepare": "cp ../README.md ./README.md" }, "peerDependencies": { "@google-cloud/functions-framework": "^3.1.1",