Skip to content

Commit

Permalink
Merge branch 'release/2.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
electerious committed Nov 4, 2020
2 parents 63e4264 + 4f149cb commit ad7cce9
Show file tree
Hide file tree
Showing 15 changed files with 216 additions and 49 deletions.
30 changes: 30 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
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**
- Installation: [e.g. Docker/Docker-Compose/Netlify/Vercel/Manually]
- Ackee version: [e.g. v2.1.0]

**📋 Additional context**

Add any other context about the problem here.
4 changes: 4 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -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.
22 changes: 22 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -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.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,7 @@ node_modules

# Dist folder
dist/*
!dist/.gitkeep
!dist/.gitkeep

# Vercel
.vercel
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ env:
- YARN_GPG=no
node_js:
- 'node'
- '12'
- '14'
os:
- windows
Expand Down
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).

## [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.

### 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.
Expand Down
47 changes: 47 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# 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 issues
- 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.

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:

```sh
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:

```sh
yarn lint
```

## Testing

To make sure your changes didn't break anything, use the `test` task to run all tests:

```sh
yarn test
```

That's it, happy coding!
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
12 changes: 12 additions & 0 deletions api/index.js
Original file line number Diff line number Diff line change
@@ -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
18 changes: 18 additions & 0 deletions docs/Get started.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
48 changes: 7 additions & 41 deletions functions/api.js
Original file line number Diff line number Diff line change
@@ -1,43 +1,9 @@
'use strict'

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 allowOrigin = process.env.ACKEE_ALLOW_ORIGIN || ''
const dbUrl = process.env.ACKEE_MONGODB || process.env.MONGODB_URI

if (dbUrl == null) {
throw new Error('MongoDB connection URI missing in environment')
}

connect(dbUrl)

const apolloServer = new ApolloServer({
introspection: isDemoMode === true || isDevelopmentMode === true,
playground: isDemoMode === true || isDevelopmentMode === true,
debug: isDevelopmentMode === true,
typeDefs: [
UnsignedIntTypeDefinition,
DateTimeTypeDefinition,
require('../src/types')
],
resolvers: {
UnsignedInt: UnsignedIntResolver,
DateTime: DateTimeResolver,
...require('../src/resolvers')
},
context: createServerlessContext
})

exports.handler = apolloServer.createHandler({
cors: {
origin: allowOrigin === '*' ? true : allowOrigin.split(','),
methods: 'GET,POST,PATCH,OPTIONS',
allowedHeaders: 'Content-Type'
}
})
/**
* 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
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "ackee",
"private": true,
"version": "2.2.0",
"version": "2.3.0",
"authors": [
"Tobias Reich <tobias@electerious.com>"
],
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -115,6 +115,6 @@
}
},
"engines": {
"node": ">= 14"
"node": ">= 12"
}
}
43 changes: 43 additions & 0 deletions src/serverless.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
'use strict'

const { ApolloServer } = require('apollo-server-lambda')
const { UnsignedIntResolver, UnsignedIntTypeDefinition, DateTimeResolver, DateTimeTypeDefinition } = require('graphql-scalars')

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

if (dbUrl == null) {
throw new Error('MongoDB connection URI missing in environment')
}

connect(dbUrl)

const apolloServer = new ApolloServer({
introspection: isDemoMode === true || isDevelopmentMode === true,
playground: isDemoMode === true || isDevelopmentMode === true,
debug: isDevelopmentMode === true,
typeDefs: [
UnsignedIntTypeDefinition,
DateTimeTypeDefinition,
require('./types')
],
resolvers: {
UnsignedInt: UnsignedIntResolver,
DateTime: DateTimeResolver,
...require('./resolvers')
},
context: createServerlessContext
})

exports.handler = apolloServer.createHandler({
cors: {
origin: allowOrigin === '*' ? true : allowOrigin.split(','),
methods: 'GET,POST,PATCH,OPTIONS',
allowedHeaders: 'Content-Type'
}
})
7 changes: 7 additions & 0 deletions vercel.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"build": {
"env": {
"NODEJS_AWS_HANDLER_NAME": "handler"
}
}
}
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down

0 comments on commit ad7cce9

Please sign in to comment.