From acb0b4c3536bfdceb0bd6ed042199954ee759d3e Mon Sep 17 00:00:00 2001 From: Shams mosowi Date: Sun, 21 Jun 2020 11:41:03 +0800 Subject: [PATCH] netlify deploy button --- README.md | 65 ++++---------------------- app.json | 38 --------------- cloud_functions/functions/package.json | 1 - netlify.toml | 14 ++++++ www/src/components/Table/ExportCSV.tsx | 1 - 5 files changed, 24 insertions(+), 95 deletions(-) delete mode 100644 app.json create mode 100644 netlify.toml diff --git a/README.md b/README.md index 42a7453b..685dfa79 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,8 @@ supported. More coming soon, for comprehensive list see ROADMAP.md. ![Firetable screenshot](https://firetable.io/demo-screenshot.png) +[![Deploy to Netlify](https://www.netlify.com/img/deploy/button.svg)](https://app.netlify.com/start/deploy?repository=https://github.com/AntlerVC/firetable) + ## Setup instructions ### 1. Create a Firebase project [(Instructions)](https://console.firebase.google.com/u/0/) @@ -35,85 +37,38 @@ supported. More coming soon, for comprehensive list see ROADMAP.md. - Upgrade project to the Blaze Plan - Enable the Google sign-in method in **Authentication / Sign-in method** -### 2. (Optional) Create an [Algolia](https://algolia.com) project - -- Algolia’s free **Community** plan is sufficient - -#### Why Algolia? - -Algolia is currently used for the **Connect Table** cell type to link a cell to -another row in another table. It may also be used in the future for further -plain text search and filtering capabilities. - -You can **opt out** of Algolia by commenting out the following lines in -`cloud_functions/functions/src/index.ts`: - -```ts -import algoliaFnsGenerator from "./algolia"; -import algoliaConfig from "./algolia/algoliaConfig"; -export const algolia = algoliaConfig.reduce((acc: any, collection) => { - return { ...acc, [collection.name]: algoliaFnsGenerator(collection) }; -}, {}); -``` - ### 3. Clone this repo ``` git clone https://github.com/AntlerVC/firetable.git ``` -### 4. Set up Cloud Functions - -- Install dependencies - -``` -cd cloud_functions/functions -yarn -``` - -- Ensure that you have Firebase CLI installed. - [(Instructions)](https://firebase.google.com/docs/cli) - -- Set cloud environment keys for Algolia: get the generated **Application ID** - and **Admin API Key** from the Algolia **API Keys** page - -``` -firebase functions:config:set algolia.app=YOUR_APP_ID algolia.key=ADMIN_API_KEY -``` - -- Deploy the Cloud Functions to your Firebase project - -``` -yarn deploy -``` - -### 5. Set React app environment variables +### 3. Set React app environment variables Create a .env file in the `www` directory -- Get the generated **Application ID** and **Search-Only API Key** from the - Algolia **API Keys** page - - Get the Firebase **Project ID** and **Web API Key** from your Firebase Project’s **Settings** page. Click the cog icon on the left sidebar (under the Firebase logo) and click **Project settings** -``` -REACT_APP_ALGOLIA_APP_ID= -REACT_APP_ALGOLIA_SEARCH_API_KEY= +- (optional) Get the generated **Application ID** and **Search-Only API Key** + from the Algolia **API Keys** page +``` REACT_APP_FIREBASE_PROJECT_ID= REACT_APP_FIREBASE_PROJECT_WEB_API_KEY= +REACT_APP_ALGOLIA_APP_ID= +REACT_APP_ALGOLIA_SEARCH_API_KEY= ``` -### 6. Install front-end dependencies +### 4. Install front-end dependencies ``` cd www yarn ``` -### 7. Run project locally +### 5. Run project locally ``` yarn start diff --git a/app.json b/app.json deleted file mode 100644 index 67d452d4..00000000 --- a/app.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "name": "foo-app", - "env": { - "BACKGROUND_COLOR": { - "description": "specify a css color", - "value": "#fefefe", - "required": false - }, - "TITLE": { - "description": "title for your site" - }, - "APP_SECRET": { - "generator": "secret" - } - }, - "options": { - "allow-unauthenticated": false, - "memory": "512Mi", - "cpu": "1" - }, - "build": { - "skip": false - }, - "hooks": { - "prebuild": { - "commands": ["./my-custom-prebuild"] - }, - "postbuild": { - "commands": ["./my-custom-postbuild"] - }, - "precreate": { - "commands": ["echo 'test'"] - }, - "postcreate": { - "commands": ["./setup.sh"] - } - } -} diff --git a/cloud_functions/functions/package.json b/cloud_functions/functions/package.json index fcce2bf6..7c6acb62 100644 --- a/cloud_functions/functions/package.json +++ b/cloud_functions/functions/package.json @@ -7,7 +7,6 @@ "serve": "npm run build && firebase serve --only functions", "shell": "npm run build && firebase functions:shell", "start": "npm run shell", - "deploy": "firebase deploy --only functions:exportTable", "deployFT": "firebase deploy", "logs": "firebase functions:log" }, diff --git a/netlify.toml b/netlify.toml new file mode 100644 index 00000000..838dd77e --- /dev/null +++ b/netlify.toml @@ -0,0 +1,14 @@ + +[build] + base = www + command = "yarn build" + publish = "www/build/" + +[context.deploy-preview] + command = "yarn start" + +[template.environment] + REACT_APP_FIREBASE_PROJECT_ID = "you firebase project Id" + REACT_APP_FIREBASE_PROJECT_WEB_API_KEY = "your firebase web api key" + REACT_APP_ALGOLIA_APP_ID = "optional algolia app id" + REACT_APP_ALGOLIA_SEARCH_API_KEY = "optional search api key" \ No newline at end of file diff --git a/www/src/components/Table/ExportCSV.tsx b/www/src/components/Table/ExportCSV.tsx index a06faf91..e47a7e07 100644 --- a/www/src/components/Table/ExportCSV.tsx +++ b/www/src/components/Table/ExportCSV.tsx @@ -18,7 +18,6 @@ import Chip from "@material-ui/core/Chip"; import { saveAs } from "file-saver"; import { SnackContext } from "contexts/snackContext"; -import { FireTableFilter } from "hooks/useFiretable"; import { useFiretableContext } from "contexts/firetableContext"; import { db } from "../../firebase"; import { FieldType } from "constants/fields";