Skip to content

Commit

Permalink
initial
Browse files Browse the repository at this point in the history
  • Loading branch information
ari-party committed Jun 3, 2024
0 parents commit c5c0775
Show file tree
Hide file tree
Showing 31 changed files with 4,735 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Port to listen on, defaults to 8080 if undefined
PORT=8080
90 changes: 90 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
{
"env": {
"node": true
},
"extends": [
"airbnb-base",
"plugin:@typescript-eslint/recommended",
"prettier"
],
"parserOptions": {
"project": "./tsconfig.json",
"tsconfigRootDir": "./",
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": [
"@typescript-eslint",
"import",
"prettier"
],
"parser": "@typescript-eslint/parser",
"settings": {
"import/resolver": {
"typescript": {
"project": "./tsconfig.json"
}
}
},
"rules": {
"prettier/prettier": "warn",
"no-console": "off",
"consistent-return": "off",
"no-restricted-syntax": "off",
"no-continue": "off",
"import/order": [
"warn",
{
"groups": [
"builtin",
"external",
[
"internal",
"parent",
"sibling",
"index"
],
"type"
],
"newlines-between": "always",
"alphabetize": {
"order": "asc",
"caseInsensitive": true
}
}
],
"import/extensions": "off",
"import/no-extraneous-dependencies": [
"error",
{
"devDependencies": [
"**/*.config.ts"
]
}
],
"@typescript-eslint/array-type": [
"warn",
{
"default": "array-simple"
}
],
"@typescript-eslint/consistent-type-imports": [
"error",
{
"prefer": "type-imports",
"fixStyle": "separate-type-imports"
}
],
"@typescript-eslint/consistent-type-definitions": "error",
"@typescript-eslint/consistent-indexed-object-style": "error",
"@typescript-eslint/consistent-generic-constructors": "warn",
"@typescript-eslint/consistent-type-assertions": [
"error",
{
"assertionStyle": "as",
"objectLiteralTypeAssertions": "allow"
}
]
}
}

29 changes: 29 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: ci

on:
release:
types: [created]
workflow_dispatch:

jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v5
with:
push: true
tags: ghcr.io/ari-party/umami-views:latest
16 changes: 16 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules

# misc
.DS_Store

# debug
npm-debug.log*

# env files
.env

# package managers
package-lock.json
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pnpm-lock.yaml
src/packages/xy-chart
8 changes: 8 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"singleQuote": true,
"useTabs": false,
"tabWidth": 2,
"trailingComma": "all",
"printWidth": 80,
"endOfLine": "crlf"
}
12 changes: 12 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM node:22-alpine

WORKDIR /server

COPY package.json ./
COPY pnpm-lock.yaml ./

RUN npm install

COPY . .

CMD ["npm", "run", "start"]
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Astrid

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# umami views

[![License](https://img.shields.io/github/license/ari-party/umami-views?style=for-the-badge)](./LICENSE)
![TypeScript](https://img.shields.io/badge/typescript-%23007ACC.svg?style=for-the-badge&logo=typescript&logoColor=white)
![Express.js](https://img.shields.io/badge/express.js-%23404d59.svg?style=for-the-badge&logo=express&logoColor=%2361DAFB)
![Airbnb](https://img.shields.io/badge/Airbnb-%23ff5a5f.svg?style=for-the-badge&logo=Airbnb&logoColor=white)
![ESLint](https://img.shields.io/badge/ESLint-4B3263?style=for-the-badge&logo=eslint&logoColor=white)
![Docker](https://img.shields.io/badge/docker-%230db7ed.svg?style=for-the-badge&logo=docker&logoColor=white)

graph with [umami](https://github.com/umami-software/umami) views data built on [star-history](https://github.com/star-history/star-history)

## usage

```bash
$ curl -G https://example.com/svg \
# The share url provided by Umami
-d 'shareURL=https://umami.is/share/abcdefghijklmnop/example.com' \
# Either light or dark
-d 'theme=light' \
# Don't include if you don't want the svg to be transparent (value can be anything)
-d 'transparent=1' \
```

## installation

```bash
# Pull the Docker image
$ docker pull ghcr.io/ari-party/umami-views:latest

$ docker run -d --name umami-views -p 8080:8080 ghcr.io/ari-party/umami-views:latest
# `-d detached`, it will run in the background
# `--name umami-views`, assign a name to prevent a random name
# `-p 8080:8080`, replace the lefthand 8080 with a port that you prefer,
# the server will be available on that port for you
```
55 changes: 55 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"name": "umami-views",
"version": "1.0.0",
"author": "Astrid <git@astrid.email>",
"license": "MIT",
"type": "module",
"repository": {
"type": "git",
"url": "https://github.com/ari-party/umami-views.git"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"format": "prettier . -w",
"fix": "npm run lint:fix && npm run format",
"start": "tsx src/index.ts"
},
"devDependencies": {
"@types/cors": "^2.8.17",
"@types/d3-axis": "^3.0.6",
"@types/d3-scale": "^4.0.8",
"@types/d3-selection": "^3.0.10",
"@types/d3-shape": "^3.1.6",
"@types/express": "^4.17.21",
"@types/jsdom": "^21.1.7",
"@types/lodash": "^4.17.4",
"@types/node": "^20.14.0",
"@typescript-eslint/eslint-plugin": "^6.19.1",
"@typescript-eslint/parser": "^6.19.1",
"eslint": "^8.56.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-prettier": "^9.1.0",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-prettier": "^5.1.3",
"prettier": "^3.2.5",
"tsx": "^4.11.0",
"typescript": "^5.3.3"
},
"dependencies": {
"cors": "^2.8.5",
"d3-axis": "^3.0.0",
"d3-scale": "^4.0.2",
"d3-selection": "^3.0.0",
"d3-shape": "^3.2.0",
"dayjs": "^1.11.11",
"dotenv": "^16.4.5",
"express": "^4.19.2",
"jsdom": "^24.1.0",
"ky": "^1.3.0",
"lodash": "^4.17.21",
"svgo": "^3.3.2"
}
}
Loading

0 comments on commit c5c0775

Please sign in to comment.