Skip to content

Commit

Permalink
Merge branch 'release/3.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
electerious committed Jan 21, 2021
2 parents 48fbf54 + c2fb184 commit b93b38d
Show file tree
Hide file tree
Showing 302 changed files with 7,061 additions and 5,610 deletions.
5 changes: 4 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ node_modules

# Dist folder
dist/*
!dist/.gitkeep
!dist/favicon.ico
!dist/index.css
!dist/index.js
!dist/tracker.js

# Files not required by Docker
Dockerfile
Expand Down
65 changes: 65 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Build

on:
pull_request:
paths-ignore:
- '**.md'
push:
paths-ignore:
- '**.md'

jobs:
cancel:

name: 'Cancel previous runs'
runs-on: ubuntu-latest
timeout-minutes: 2

steps:
- uses: styfle/[email protected]
with:
access_token: ${{ github.token }}

build:

name: 'Build and test'
runs-on: ${{ matrix.os }}
timeout-minutes: 10

strategy:
matrix:
node-version: [12.x, 14.x]
os: [ubuntu-latest, windows-latest, macOS-latest]

steps:
- uses: actions/checkout@v2

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- run: yarn install --frozen-lockfile

- run: yarn test

- run: yarn coveralls

- name: Parallel Coveralls report
uses: coverallsapp/github-action@master
with:
github-token: ${{ github.token }}
flag-name: run-${{ matrix.test_number }}
parallel: true

coveralls:

needs: build
runs-on: ubuntu-latest

steps:
- name: Finished Coveralls report
uses: coverallsapp/github-action@master
with:
github-token: ${{ github.token }}
parallel-finished: true
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ node_modules

# Dist folder
dist/*
!dist/.gitkeep
!dist/favicon.ico
!dist/index.css
!dist/index.js
!dist/tracker.js

# Vercel
.vercel
13 changes: 0 additions & 13 deletions .travis.yml

This file was deleted.

71 changes: 71 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,77 @@ 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).

## [3.0.0] - 2021-01-21

Events, browser navigation and better referrers 🎉

### Highlights

#### Events

Ackee can now [track events](docs/Events.md) like newsletter subscriptions, buttons clicks, checkout sums and more. It's the most requested feature and I'm happy that it's finally a part of Ackee.

#### Browser navigation

You can now use the back and forward buttons to navigate between pages.

#### Referrers 2.0

You can now [specify a `source` parameter in URLs](docs/Enhancing%20referrers.md) (e.g. `https://example.com?source=Newsletter`). Ackee will use the parameter instead of the referrer when available. This allows you the track links from newsletters and other platforms more precisely.

#### Faster startup, smaller size

Ackee previously had to compile all source files before the server was ready. v3 now ships with all files Ackee needs and only builds those containing environment variables. This means running `yarn start` is way faster and the Docker container even smaller.

Oh, and we also reduced the JS file size of the UI by ~60%.

### Breaking changes

#### New `Access-Control-Allow-Credentials` header

> This change is relevant for everyone.
Ackee requires [a new `Access-Control-Allow-Credentials` header](docs/CORS%20headers.md#credentials) which was previously optional. Make sure to add this header in your server or reverse proxy configuration.

#### ackee-tracker with new `.create` and `.record` syntax

> This change is only relevant for you when using ackee-tracker in the [Manually](https://github.com/electerious/ackee-tracker/blob/master/README.md#manually) or [Programmatic](https://github.com/electerious/ackee-tracker/blob/master/README.md#programmatic) way.
The [changelog of ackee-tracker](https://github.com/electerious/ackee-tracker/blob/master/CHANGELOG.md) contains everything you need to know when updating to the newest version.

#### Referrers require `ReferrerType` in GraphQL API

> This change is relevant for you when using the GraphQL API.
A new parameter is required when requesting referrers via the GraphQL API. The parameter is called `ReferrerType` and can be `WITH_SOURCE`, `NO_SOURCE` or `ONLY_SOURCE`.

#### Referrers can return non URL ids via GraphQL API

> This change is relevant for you when using the GraphQL API.
The `id` of requested referrers was always a URL, but has been changed to a string. That's because [referrers can now include parameters](docs/Enhancing%20referrers.md) (e.g. `source` when using `ackee-tracker`).

### Added

- Browser navigation. It's now possible to navigate using the back and forward button in the browser.
- "Copied to clipboard" message when clicking on an input or textarea that copies to the clipboard (#166)
- Modals can be closed with the ESC key
- Tests for permanent tokens, events and actions
- `source` field for records to track (thanks @BetaHuhn, #185)
- Referrers will now show the `source` parameter when available (thanks @BetaHuhn, #185)
- Use the `s` key to open the settings and `o` to switch to the overview ([Keyboard shortcuts](docs/Keyboard%20shortcuts.md))
- Explanation why data is missing (#192)

### Changed

- Compiled source files are now part of the repo
- Docker container size has been reduced (again)
- Updated build tools allow us to use ~60% less JS in the UI

### Fixed

- Close, delete and submit in modals could be triggered multiple times

## [2.4.1] - 2020-12-20

### Changed
Expand Down
8 changes: 3 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,16 @@
FROM mhart/alpine-node:14 AS build
WORKDIR /srv/app/

# Add dependencies first so that the docker image build can use
# the cache as long as the dependencies stay unchanged.
# Add dependencies first so that Docker can use the cache as long as the dependencies stay unchanged

COPY package.json yarn.lock /srv/app/
RUN yarn install --production --frozen-lockfile

# Copy and compile the source after the dependency step as it's
# more likely that the source changes.
# Copy source after the dependency step as it's more likely that the source changes

COPY build.js /srv/app/
COPY src /srv/app/src
RUN mkdir dist && yarn build
COPY dist /srv/app/dist

# Start with second build stage

Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2020 Tobias Reich
Copyright (c) 2021 Tobias Reich

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 2 additions & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
release: npm run build
web: npm run server
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

# Ackee

[![Travis Build Status](https://travis-ci.org/electerious/Ackee.svg?branch=master)](https://travis-ci.org/electerious/Ackee) [![Coverage Status](https://coveralls.io/repos/github/electerious/Ackee/badge.svg?branch=master)](https://coveralls.io/github/electerious/Ackee?branch=master) [![Mentioned in Awesome Selfhosted](https://awesome.re/mentioned-badge.svg)](https://github.com/awesome-selfhosted/awesome-selfhosted) [![Donate via PayPal](https://img.shields.io/badge/paypal-donate-009cde.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=CYKBESW577YWE)
![Build](https://github.com/electerious/Ackee/workflows/Build/badge.svg) [![Coverage Status](https://coveralls.io/repos/github/electerious/Ackee/badge.svg?branch=master)](https://coveralls.io/github/electerious/Ackee?branch=master) [![Mentioned in Awesome Selfhosted](https://awesome.re/mentioned-badge.svg)](https://github.com/awesome-selfhosted/awesome-selfhosted) [![Donate via PayPal](https://img.shields.io/badge/paypal-donate-009cde.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=CYKBESW577YWE)

Self-hosted, Node.js based analytics tool for those who care about privacy. Ackee runs on your own server, analyzes the traffic of your websites and provides useful statistics in a minimal interface.

Expand All @@ -24,6 +24,7 @@ Ackee is a self-hosted analytics tool that cares about privacy. We believe that
- **Modern technologies**: Lightweight Node.js and MongoDB architecture
- **Beautiful**: Minimal and focused interface
- **No cookies**: No unique user tracking and therefore no required cookie message
- **Events**: Track button clicks, newsletter subscriptions and more
- **GraphQL API**: Fully documented GraphQL API that allows you to build new tools upon Ackee

## 🚀 Get started
Expand Down Expand Up @@ -79,6 +80,7 @@ I am working hard on continuously developing and maintaining Ackee. Please consi

- [ackee-tracker](https://github.com/electerious/ackee-tracker) - Transfer data to Ackee
- [ackee-bitbar](https://github.com/electerious/ackee-bitbar) - Ackee stats in your macOS menu bar
- [ackee-lighthouse](https://github.com/electerious/ackee-lighthouse) - Send Lighthouse reports to Ackee
- [ackee-report](https://github.com/BetaHuhn/ackee-report) - CLI tool to generate performance reports
- [gatsby-plugin-ackee-tracker](https://github.com/Burnsy/gatsby-plugin-ackee-tracker) - Gatsby plugin for Ackee
- [Soapberry](https://wordpress.org/plugins/soapberry/) - WordPress plugin for Ackee
Expand Down
113 changes: 10 additions & 103 deletions build.js
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,110 +2,17 @@
'use strict'
require('dotenv').config()

const { resolve } = require('path')
const { writeFile, readFile } = require('fs').promises
const sass = require('rosid-handler-sass')
const js = require('rosid-handler-js')

const html = require('./src/ui/index')
const isDemoMode = require('./src/utils/isDemoMode')
const isDevelopmentMode = require('./src/utils/isDevelopmentMode')
const config = require('./src/utils/config')
const customTracker = require('./src/utils/customTracker')
const signale = require('./src/utils/signale')

const index = async () => {

const data = html()

return data

}

const favicon = async () => {

const filePath = resolve(__dirname, 'src/ui/images/favicon.ico')
const data = readFile(filePath)

return data

}

const styles = async () => {

const filePath = resolve(__dirname, 'src/ui/styles/index.scss')
const data = sass(filePath, { optimize: isDevelopmentMode === false })

return data
const { index, styles, scripts, tracker, build } = require('./src/ui/index')

// Build files that are identical on every installation
if (config.isPreBuildMode === true) {
build('dist/index.css', styles)
build('dist/index.js', scripts)
build('dist/tracker.js', tracker)
}

const scripts = async () => {

const filePath = resolve(__dirname, 'src/ui/scripts/index.js')

const babel = {
presets: [
[
'@babel/preset-env', {
targets: {
browsers: [
'last 2 Safari versions',
'last 2 Chrome versions',
'last 2 Opera versions',
'last 2 Firefox versions'
]
}
}
]
],
babelrc: false
}

const data = js(filePath, {
optimize: isDevelopmentMode === false,
env: {
ACKEE_TRACKER: process.env.ACKEE_TRACKER,
ACKEE_DEMO: isDemoMode === true ? 'true' : 'false',
NODE_ENV: isDevelopmentMode === true ? 'development' : 'production'
},
babel
})

return data

}

const tracker = async () => {

const filePath = require.resolve('ackee-tracker')
const data = readFile(filePath, 'utf8')

return data

}

const build = async (path, fn) => {

try {
signale.await(`Building and writing '${ path }'`)
const data = await fn()
await writeFile(path, data)
signale.success(`Finished building '${ path }'`)
} catch (err) {
signale.fatal(err)
process.exit(1)
}

}

// Required files
build('dist/index.html', index)
build('dist/favicon.ico', favicon)
build('dist/index.css', styles)
build('dist/index.js', scripts)
build('dist/tracker.js', tracker)

// Optional files
if (customTracker.exists === true) {
build(`dist/${ customTracker.path }`, tracker)
}
// Build files that depend on environment variables
build(`dist/index.html`, index)
if (customTracker.exists === true) build(`dist/${ customTracker.path }`, tracker)
Empty file removed dist/.gitkeep
Empty file.
File renamed without changes.
1 change: 1 addition & 0 deletions dist/index.css

Large diffs are not rendered by default.

Loading

0 comments on commit b93b38d

Please sign in to comment.