Skip to content

Commit

Permalink
Initial MVP
Browse files Browse the repository at this point in the history
  • Loading branch information
RomRider committed Jan 22, 2021
0 parents commit 5b94c61
Show file tree
Hide file tree
Showing 25 changed files with 6,526 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .devcontainer/configuration.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
lovelace:
mode: yaml
resources:
- url: http://127.0.0.1:5000/apexcharts-card.js
type: module

default_config:

demo:

sensor:
- platform: template
sensors:
pressure:
friendly_name: "Pressure"
unit_of_measurement: "hPa"
value_template: "{{ state_attr('weather.home', 'pressure') }}"
device_class: pressure
temperature:
friendly_name: "Temperature"
unit_of_measurement: "°C"
value_template: "{{ state_attr('weather.home', 'temperature') }}"
device_class: temperature
humidity:
friendly_name: "Humidity"
unit_of_measurement: "%"
value_template: "{{ state_attr('weather.home', 'humidity') }}"
device_class: humidity
- platform: random
name: random0_100
minimum: 0
maximum: 100
- platform: random
name: random_big
minimum: 12309812
maximum: 22309812
- platform: random
name: random_0_1000
minimum: 0
maximum: 1000
38 changes: 38 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"name": "Mini Graph Card Development",
"image": "ghcr.io/ludeeus/devcontainer/generic:latest",
"context": "..",
"remoteUser": "vscode",
"appPort": [
"8123:8123",
"5000:5000",
],
"postCreateCommand": "npm install && sudo container install",
"extensions": [
"github.vscode-pull-request-github",
"eamodio.gitlens",
"dbaeumer.vscode-eslint",
"redhat.vscode-yaml",
"yzhang.markdown-all-in-one",
"esbenp.prettier-vscode",
"bierner.lit-html"
],
"settings": {
"files.eol": "\n",
"editor.tabSize": 2,
"terminal.integrated.shell.linux": "/bin/bash",
"editor.formatOnPaste": false,
"editor.formatOnSave": true,
"editor.formatOnType": true,
"files.trimTrailingWhitespace": true,
"markdown.extension.toc.githubCompatibility": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"files.watcherExclude": {
"**/.git/objects/**": true,
"**/.git/subtree-cache/**": true,
"**/node_modules/**": true,
"**/.hg/store/**": true,
"**/.rpt2_cache/**": true
}
}
}
15 changes: 15 additions & 0 deletions .devcontainer/ui-lovelace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
views:
- title: Main
cards:
- type: custom:apexcharts-card
stacked: true
series:
- entity: sensor.random_0_1000
name: test1
type: area
- entity: sensor.random_0_1000
name: test2
type: area
hours_to_show: 0.25
cache: true

20 changes: 20 additions & 0 deletions .eslintrc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
parser: "@typescript-eslint/parser"
extends:
- eslint:recommended
- plugin:@typescript-eslint/eslint-recommended
- plugin:@typescript-eslint/recommended
rules:
no-else-return: 0
no-underscore-dangle: 0
nonblock-statement-body-position: 0
curly: 0
no-return-assign: 0
consistent-return: 0
no-mixed-operators: 0
class-methods-use-this: 0
no-nested-ternary: 0
camelcase: 0
globals:
window: true
Event: true
customElements: true
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: 2
updates:
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "weekly"
open-pull-requests-limit: 0
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
56 changes: 56 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: CI

on:
pull_request:
branches:
- "*"
push:
branches:
- "*"

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js 12.x
uses: actions/[email protected]
with:
node-version: 12.x
- name: Cache Node.js modules
uses: actions/cache@v2
with:
path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS
key: ${{ runner.OS }}-node-12.x-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node-12.x
${{ runner.OS }}-
- name: Install dependencies
run: npm ci
- name: Lint the code
run: npm run lint --if-present
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [10.x, 12.x]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/[email protected]
with:
node-version: ${{ matrix.node-version }}
- name: Cache Node.js modules
uses: actions/cache@v2
with:
path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS
key: ${{ runner.OS }}-node-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node-${{ matrix.node-version }}
${{ runner.OS }}-
- name: Install dependencies
run: npm ci
- name: Build the project
run: npm run build --if-present
33 changes: 33 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Release

on: workflow_dispatch

jobs:
release-bundle:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev'

outputs:
new_release_published: ${{ steps.semantic.outputs.new_release_published }}
new_release_version: ${{ steps.semantic.outputs.new_release_version }}

steps:
- uses: actions/checkout@v2
- name: Use Node.js 12.x
uses: actions/[email protected]
with:
node-version: 12.x
- name: Cache Node.js modules
uses: actions/cache@v2
with:
path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS
key: ${{ runner.OS }}-node-12.x-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node-12.x
${{ runner.OS }}-
- name: Install dependencies
run: npm ci
- name: Release
run: npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/node_modules/
/dist/
.DS_Store
6 changes: 6 additions & 0 deletions .prettierrc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
semi: true
trailingComma: 'all'
singleQuote: true
printWidth: 120
tabWidth: 2

18 changes: 18 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
"url": "http://localhost:8123",
"webRoot": "${workspaceFolder}/dist",
"sourceMaps": true,
"preLaunchTask": "debug",
"postDebugTask": "devcontainer: stop debug"
}
]
}
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"markdown.extension.tableFormatter.enabled": false
}
76 changes: 76 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
{
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "watch",
"group": "test",
"label": "npm: watch",
"detail": "rollup -c --watch",
"isBackground": true,
"problemMatcher": {
"pattern": [
{
"regexp": ".",
"file": 1,
"location": 2,
"message": 3
}
],
"background": {
"activeOnStart": true,
"beginsPattern": "^bundles\\s",
"endsPattern": "^.*waiting for changes\\.\\.\\."
}
}
},
{
"type": "shell",
"label": "devcontainer: Start HA",
"command": "sh -c 'sudo --preserve-env=PATH container start'",
"problemMatcher": {
"pattern": [
{
"regexp": ".",
"file": 1,
"location": 2,
"message": 3
}
],
"background": {
"activeOnStart": true,
"beginsPattern": ".",
"endsPattern": "^Start Home Assistant$"
}
},
"group": "test",
"isBackground": true
},
{
"label": "debug",
"group": "test",
"dependsOn": [
"devcontainer: Start HA",
"npm: watch"
],
"problemMatcher": []
},
{
"label": "devcontainer: stop debug",
"group": "test",
"command": "sh",
"presentation": {
"echo": true,
"reveal": "never",
"focus": false,
"panel": "shared",
"showReuseMessage": true,
"clear": false
},
"args": [
"-c",
"sudo killall hass; sudo kill $(ps au | grep 'node.*rollup' | grep -v grep | awk {'print $2'}); exit 0;",
]
}
]
}
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2020 Jérôme Wiedemann

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.
4 changes: 4 additions & 0 deletions hacs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "apexcharts-card",
"render_readme": true
}
Loading

0 comments on commit 5b94c61

Please sign in to comment.