From df95f48f3e76a997a6c424e3055bd8439095552e Mon Sep 17 00:00:00 2001 From: Spencer Elliott Date: Sun, 1 Nov 2020 16:19:48 -0500 Subject: [PATCH 01/13] Support Node.js 12 --- .travis.yml | 1 + package.json | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 2ea650dc..46d38f6e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,7 @@ env: - YARN_GPG=no node_js: - 'node' + - '12' - '14' os: - windows diff --git a/package.json b/package.json index 9e5ff9a9..c8e1943f 100644 --- a/package.json +++ b/package.json @@ -115,6 +115,6 @@ } }, "engines": { - "node": ">= 14" + "node": ">= 12" } } From f4ed5e93316d73e66beaeb91b38fd57ca2ff1780 Mon Sep 17 00:00:00 2001 From: Spencer Elliott Date: Sun, 1 Nov 2020 16:30:51 -0500 Subject: [PATCH 02/13] Move netlify handler to 'src/serverless.js' --- functions/api.js => src/serverless.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) rename functions/api.js => src/serverless.js (77%) diff --git a/functions/api.js b/src/serverless.js similarity index 77% rename from functions/api.js rename to src/serverless.js index 7187fc24..7ee0b4bf 100644 --- a/functions/api.js +++ b/src/serverless.js @@ -3,10 +3,10 @@ const { ApolloServer } = require('apollo-server-lambda') const { UnsignedIntResolver, UnsignedIntTypeDefinition, DateTimeResolver, DateTimeTypeDefinition } = require('graphql-scalars') -const connect = require('../src/utils/connect') -const isDemoMode = require('../src/utils/isDemoMode') -const isDevelopmentMode = require('../src/utils/isDevelopmentMode') -const { createServerlessContext } = require('../src/utils/createContext') +const connect = require('./utils/connect') +const isDemoMode = require('./utils/isDemoMode') +const isDevelopmentMode = require('./utils/isDevelopmentMode') +const { createServerlessContext } = require('./utils/createContext') const allowOrigin = process.env.ACKEE_ALLOW_ORIGIN || '' const dbUrl = process.env.ACKEE_MONGODB || process.env.MONGODB_URI @@ -24,12 +24,12 @@ const apolloServer = new ApolloServer({ typeDefs: [ UnsignedIntTypeDefinition, DateTimeTypeDefinition, - require('../src/types') + require('./types') ], resolvers: { UnsignedInt: UnsignedIntResolver, DateTime: DateTimeResolver, - ...require('../src/resolvers') + ...require('./resolvers') }, context: createServerlessContext }) From 3afc0ec48a528ed92ba365ff053c125351111945 Mon Sep 17 00:00:00 2001 From: Spencer Elliott Date: Sun, 1 Nov 2020 16:31:14 -0500 Subject: [PATCH 03/13] Vercel + Netlify serverless functions --- api/index.js | 12 ++++++++++++ functions/api.js | 9 +++++++++ vercel.json | 7 +++++++ 3 files changed, 28 insertions(+) create mode 100644 api/index.js create mode 100644 functions/api.js create mode 100644 vercel.json diff --git a/api/index.js b/api/index.js new file mode 100644 index 00000000..1f442cd8 --- /dev/null +++ b/api/index.js @@ -0,0 +1,12 @@ +'use strict' + +/** + * A serverless function handler for the '/api' route, for use with Vercel. + * This handler follows the AWS Lambda API; Vercel deployments are opted-in + * using the "NODEJS_AWS_HANDLER_NAME" environment variable defined in vercel.json. + * + * See: + * - https://vercel.com/docs/serverless-functions/supported-languages#node.js + * - https://vercel.com/docs/runtimes#advanced-usage/advanced-node-js-usage/aws-lambda-api + */ +exports.handler = require('../src/serverless').handler \ No newline at end of file diff --git a/functions/api.js b/functions/api.js new file mode 100644 index 00000000..ea43d588 --- /dev/null +++ b/functions/api.js @@ -0,0 +1,9 @@ +'use strict' + +/** + * A serverless function handler for the '/api' route, for use with Netlify. + * + * See: + * - https://docs.netlify.com/functions/overview/ + */ +exports.handler = require('../src/serverless').handler \ No newline at end of file diff --git a/vercel.json b/vercel.json new file mode 100644 index 00000000..0489c923 --- /dev/null +++ b/vercel.json @@ -0,0 +1,7 @@ +{ + "build": { + "env": { + "NODEJS_AWS_HANDLER_NAME": "handler" + } + } +} From e8dffb7e41de6359bb83166b260652d847792a7b Mon Sep 17 00:00:00 2001 From: Spencer Elliott Date: Sun, 1 Nov 2020 16:43:27 -0500 Subject: [PATCH 04/13] Ignore Vercel-generated files --- .gitignore | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index fec11ac0..9639f3e9 100644 --- a/.gitignore +++ b/.gitignore @@ -31,4 +31,7 @@ node_modules # Dist folder dist/* -!dist/.gitkeep \ No newline at end of file +!dist/.gitkeep + +# Vercel +.vercel From 2b3c601eaab0f99c0639bfee83f452728a19f1cc Mon Sep 17 00:00:00 2001 From: Spencer Elliott Date: Sun, 1 Nov 2020 16:57:05 -0500 Subject: [PATCH 05/13] Add docs for Vercel --- README.md | 1 + docs/Get started.md | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/README.md b/README.md index 8052aa85..b5479f32 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,7 @@ Get Ackee up and running… - […with Helm](docs/Get%20started.md#with-helm) - […without Docker](docs/Get%20started.md#without-docker) - […with Netlify](docs/Get%20started.md#with-netlify) +- […with Vercel](docs/Get%20started.md#with-vercel) - […with Heroku](docs/Get%20started.md#with-heroku) - […with Render](docs/Get%20started.md#with-render) diff --git a/docs/Get started.md b/docs/Get started.md index 5b1c18eb..e984d9e3 100644 --- a/docs/Get started.md +++ b/docs/Get started.md @@ -177,6 +177,24 @@ Ackee now runs on port `3000` and is only accessible from you local network. It' Netlify adds a forked version of Ackee to your GitHub repositories. You can always [pull the newest code](https://docs.github.com/en/free-pro-team@latest/github/collaborating-with-issues-and-pull-requests/syncing-a-fork) from the original project. Pushing those changes to your repository will automatically deploy the new version of Ackee on Netlify. +## With Vercel + +### 1. Deploy to Vercel + +[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/git/external?repository-url=https%3A%2F%2Fgithub.com%2Felecterious%2FAckee&env=ACKEE_USERNAME,ACKEE_PASSWORD,ACKEE_MONGODB,ACKEE_ALLOW_ORIGIN&envDescription=Environment%20variables%20needed%20to%20configure%20the%20user%20and%20database%20connection&envLink=https%3A%2F%2Fgithub.com%2Felecterious%2FAckee%2Fblob%2Fmaster%2Fdocs%2FOptions.md) + +When prompted to select a directory, select the root directory. + +### 2. Configure Ackee + +* Set the build command: `yarn build` +* Set the output directory: `dist` +* Set environment variables `ACKEE_USERNAME`, `ACKEE_PASSWORD`, `ACKEE_MONGODB`, and `ACKEE_ALLOW_ORIGIN`. + +### 3. Updating Ackee + +Vercel adds a forked version of Ackee to your GitHub repositories. You can always [pull the newest code](https://docs.github.com/en/free-pro-team@latest/github/collaborating-with-issues-and-pull-requests/syncing-a-fork) from the original project. Pushing those changes to your repository will automatically deploy the new version of Ackee on Vercel. + ## With Heroku ### 1. Deploy to Heroku From 0f7b9c7534e061e4556a7592b16cb843e2e8424c Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Tue, 3 Nov 2020 17:44:04 +0100 Subject: [PATCH 06/13] Update ackee-tracker --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index c8e1943f..b35e99f8 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "lint": "eslint '{functions,src,test}/**/*.js'" }, "dependencies": { - "ackee-tracker": "^4.0.1", + "ackee-tracker": "^4.1.0", "apollo-server-lambda": "^2.19.0", "apollo-server-micro": "^2.19.0", "classnames": "^2.2.6", diff --git a/yarn.lock b/yarn.lock index a46844da..51a67810 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1629,10 +1629,10 @@ accept@^3.0.2: boom "7.x.x" hoek "6.x.x" -ackee-tracker@^4.0.1: - version "4.0.2" - resolved "https://registry.yarnpkg.com/ackee-tracker/-/ackee-tracker-4.0.2.tgz#fdee1ec329f9b7245a42c022652b5c7063c50c16" - integrity sha512-JQkfKW+1bu8bdv2JGcb53ip8oDNWzpiUpP1D453+/PAjMuEngVA2wzS8Tqan8unBvbOOMXj/HI+GvwgIMWlXLQ== +ackee-tracker@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/ackee-tracker/-/ackee-tracker-4.1.0.tgz#775ba71164df84e83adfff88c0a08fd1be1768a6" + integrity sha512-0WVWU0acUf03s+1tUtjpUt1/dawI/0vetdH3eWfxKmuLlYPnnHbZrRgFBg2Aj26TpLUGnWbgnkerc0Yq/w7LJw== dependencies: platform "^1.3.6" From d1198f5f93966f5c0dd799642d85d3e182602aa1 Mon Sep 17 00:00:00 2001 From: BetaHuhn <51766171+BetaHuhn@users.noreply.github.com> Date: Tue, 3 Nov 2020 19:27:05 +0100 Subject: [PATCH 07/13] Add Issue templates --- .github/ISSUE_TEMPLATE/bug_report.md | 31 +++++++++++++++++++++++ .github/ISSUE_TEMPLATE/config.yml | 4 +++ .github/ISSUE_TEMPLATE/feature_request.md | 22 ++++++++++++++++ 3 files changed, 57 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/config.yml create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 00000000..c8058cf5 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,31 @@ +--- +name: 🐛 Bug report +about: Create a report to help us improve +labels: bug + +--- + +**🐞 Describe the bug** + +A clear and concise description of what the bug is. + +**📚 To Reproduce** + +Steps to reproduce the behavior. + +**💡 Expected behavior** + +A clear and concise description of what you expected to happen. + +**🖼️ Screenshots** + +If applicable, add screenshots to help explain your problem. + +**⚙️ Environment (please complete the following information)** + - Installation: [e.g. Docker/Netlify/Bare-Metal] + - OS: [e.g. Ubuntu 18.04] + - Ackee version [e.g. v2.1.0] + +**📋 Additional context** + +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 00000000..072932d8 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,4 @@ +contact_links: + - name: 📚 Ackee Docs + url: https://docs.ackee.electerious.com/ + about: Checkout Ackee's Documentation before you open an issue. \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 00000000..deece1d7 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,22 @@ +--- +name: 🚀 Feature request +about: Suggest an idea for this project +labels: feature request + +--- + +**🐣 Is your feature request related to a problem? Please describe.** + +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**💡 Describe the solution you'd like** + +A clear and concise description of what you want to happen. + +**❓ Describe alternatives you've considered** + +A clear and concise description of any alternative solutions or features you've considered. + +**📋 Additional context** + +Add any other context about the feature request here. From 041a4fb8a599a1f15d7caf611f5abcbdf8eaef94 Mon Sep 17 00:00:00 2001 From: BetaHuhn <51766171+BetaHuhn@users.noreply.github.com> Date: Tue, 3 Nov 2020 19:50:30 +0100 Subject: [PATCH 08/13] Add contributing guide --- CONTRIBUTING.md | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..6c49c4fc --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,44 @@ +# Contributing + +Thanks for taking the time to contribute to this project! + +## How to help? + +There are multiple tasks you can do in order to help us, for example: +- fill an issue to report bugs or your specific needs +- contribute to existing issue +- write a PR to improve the project + +## Contributing workflow + +In order to make a code contribution, create a fork of Ackee by clicking the "Fork" button on [GitHub](https://github.com/electerious/Ackee) and cloning the repo to your local machine. + +Please use the `develop` branch as a base for your contribution and make your changes on a new branch. + +Once you're finished, push your branch to your repo and create a pull request! + +## Development mode + +Simply run Ackee with `NODE_ENV` set to `development` to get access to the [GraphQL Playground](https://docs.ackee.electerious.com/#/docs/API#playground). You can do this by adding `NODE_ENV=development` to the environment of your `docker-compose.yml` or by running: + +```shell +yarn start:dev +``` + +## Linting + +[ESlint](https://eslint.org/) is used for linting. It's recommended to add the corresponding extension to your editor. It's also possible to run the `lint` task with the following command: + +```shell +yarn lint +``` + +## Testing + +To make sure your changes didn't break anything, use the `test` task to run all tests: + +```shell +yarn test +``` + +That's it, happy coding! \ No newline at end of file From 238dbb80a308b559605611575ce72a98209c71eb Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Wed, 4 Nov 2020 08:26:35 +0100 Subject: [PATCH 09/13] Small adjustments --- .github/ISSUE_TEMPLATE/bug_report.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index c8058cf5..980dc3ef 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -21,10 +21,9 @@ A clear and concise description of what you expected to happen. If applicable, add screenshots to help explain your problem. -**⚙️ Environment (please complete the following information)** - - Installation: [e.g. Docker/Netlify/Bare-Metal] - - OS: [e.g. Ubuntu 18.04] - - Ackee version [e.g. v2.1.0] +**⚙️ Environment** + - Installation: [e.g. Docker/Docker-Compose/Netlify/Vercel/Manually] + - Ackee version: [e.g. v2.1.0] **📋 Additional context** From d7e2bb0ff428b3af703ef51ca116839d14aade50 Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Wed, 4 Nov 2020 08:30:26 +0100 Subject: [PATCH 10/13] Small adjustments --- CONTRIBUTING.md | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6c49c4fc..9a666f3e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -5,8 +5,9 @@ Thanks for taking the time to contribute to this project! ## How to help? There are multiple tasks you can do in order to help us, for example: + - fill an issue to report bugs or your specific needs -- contribute to existing issue +- contribute to existing issues - write a PR to improve the project ## Contributing workflow @@ -15,13 +16,15 @@ In order to make a code contribution, create a fork of Ackee by clicking the "Fo Please use the `develop` branch as a base for your contribution and make your changes on a new branch. +Ensure that you open an issue to discuss the changes before submitting a PR. + Once you're finished, push your branch to your repo and create a pull request! ## Development mode Simply run Ackee with `NODE_ENV` set to `development` to get access to the [GraphQL Playground](https://docs.ackee.electerious.com/#/docs/API#playground). You can do this by adding `NODE_ENV=development` to the environment of your `docker-compose.yml` or by running: -```shell +```sh yarn start:dev ``` @@ -29,7 +32,7 @@ yarn start:dev [ESlint](https://eslint.org/) is used for linting. It's recommended to add the corresponding extension to your editor. It's also possible to run the `lint` task with the following command: -```shell +```sh yarn lint ``` @@ -37,8 +40,8 @@ yarn lint To make sure your changes didn't break anything, use the `test` task to run all tests: -```shell +```sh yarn test ``` -That's it, happy coding! \ No newline at end of file +That's it, happy coding! From 82fdbd7914f6dea734d26805a102f4e62d531c9b Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Wed, 4 Nov 2020 08:36:19 +0100 Subject: [PATCH 11/13] Trim whitespace --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9a666f3e..b5137601 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -30,7 +30,7 @@ yarn start:dev ## Linting -[ESlint](https://eslint.org/) is used for linting. It's recommended to add the corresponding extension to your editor. It's also possible to run the `lint` task with the following command: +[ESlint](https://eslint.org/) is used for linting. It's recommended to add the corresponding extension to your editor. It's also possible to run the `lint` task with the following command: ```sh yarn lint From a67be8455625377ec3475015b9e2da0779ce2ad9 Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Wed, 4 Nov 2020 08:40:51 +0100 Subject: [PATCH 12/13] Update changelog --- CHANGELOG.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 818c1637..cb07fd33 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,19 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [Unreleased] + +This release adds [support for Vercel](https://github.com/electerious/Ackee/blob/master/docs/Get%20started.md) and updates the included `ackee-tracker` which now ignores bots. + +### Added + +- Support for Vercel (#180, thanks @elliottsj) +- Contributing guide and issue templates (#184, thanks @BetaHuhn) + +### Changed + +- `ackee-tracker` updated to version 4.1.0 + ## [2.2.0] - 2020-11-01 New tools like [ackee-report](https://github.com/BetaHuhn/ackee-report), [ackee-bitbar](https://github.com/electerious/ackee-bitbar) and the [Ackee iOS widget](https://twitter.com/getackee/status/1320996848623099909) are build upon the powerful API of Ackee. This release makes it even easier to them by introducing permanent tokens. Permanent tokens never expire and are perfect for tools that run in the background. You can create them in the settings of Ackee and use them for authentication in Ackee-powered apps. From 4f149cb8fa22617dfab2a7ab21d9b684bda900bf Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Wed, 4 Nov 2020 08:41:49 +0100 Subject: [PATCH 13/13] Bump versions --- CHANGELOG.md | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cb07fd33..7b1f15cc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). -## [Unreleased] +## [2.3.0] - 2020-11-04 This release adds [support for Vercel](https://github.com/electerious/Ackee/blob/master/docs/Get%20started.md) and updates the included `ackee-tracker` which now ignores bots. diff --git a/package.json b/package.json index b35e99f8..3c6e92eb 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "ackee", "private": true, - "version": "2.2.0", + "version": "2.3.0", "authors": [ "Tobias Reich " ],