Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Config Updates #4

Merged
merged 25 commits into from
Mar 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Editor configuration, see http://editorconfig.org
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
max_line_length = off
trim_trailing_whitespace = false
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
babel.config.js
jest.config.js
jest.config.js
83 changes: 83 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
module.exports = {
root: true,
parser: "@typescript-eslint/parser",
parserOptions: {
parser: "@typescript-eslint/parser",
project: "./tsconfig.json"
},
plugins: ["@typescript-eslint", "import", "simple-import-sort"],
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended"
],
rules: {
"quotes": ["warn", "single", { "allowTemplateLiterals": true }],
"semi": ["warn", "never"],
"space-before-function-paren": ["warn", "always"],
"comma-dangle": "off",
"simple-import-sort/imports": "error",
"simple-import-sort/exports": "error",
"func-names": "off",
"no-empty-function": "off",
"default-case": "off",
"import/named": "off",
"import/namespace": "off",
"import/default": "off",
"import/no-named-as-default-member": "off",
"import/no-unresolved": "off",
"import/prefer-default-export": "off",
"import/first": "error",
"import/newline-after-import": "error",
"import/no-duplicates": "error",
"import/no-named-as-default": "error",
"import/no-cycle": "error",
"import/no-unused-modules": "error",
"import/no-deprecated": "error",
"no-return-await": "off",
"no-use-before-define": ["error", { "functions": false }],
"class-methods-use-this": "off",
"@typescript-eslint/return-await": "error",
"@typescript-eslint/no-misused-promises": ["error", { checksVoidReturn: false }],
"@typescript-eslint/no-floating-promises": ["error", { ignoreVoid: true }],
"@typescript-eslint/no-use-before-define": ["error", { functions: false }],
"@typescript-eslint/no-throw-literal": "off",
"@typescript-eslint/lines-between-class-members": ["error", { exceptAfterSingleLine: true }],
"@typescript-eslint/no-empty-function": ["off"],
"@typescript-eslint/ban-ts-comment": ["warn"],
"@typescript-eslint/naming-convention": [
"error",
{
selector: "function",
format: [
"camelCase",
"PascalCase"
],
filter: {
regex: "Route$",
match: false
}
}
],
"jsx-a11y/click-events-have-key-events": "off",
"react/require-default-props": "off",
"no-underscore-dangle": ["error", { allowAfterThis: true }],
"no-debugger": "error",
"no-console": "error",
"no-restricted-syntax": [
"error",
{
selector: "ForInStatement",
message: "for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the resulting array."
},
{
selector: "LabeledStatement",
message: "Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand."
},
{
selector: "WithStatement",
message: "`with` is disallowed in strict mode because it makes code impossible to predict and optimize."
}
]
}
};
36 changes: 36 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Pull Request Template for Home Assistant / Lovelace Card Repository

## Overview

Please provide a brief description of the changes introduced in this pull request. Include any context that will help reviewers understand the motivation behind the changes, such as the problem you are trying to solve or the feature you are implementing.

### Type of Change

- [ ] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Documentation update
- [ ] Refactoring
- [ ] Other (please describe):

## Checklist

Please ensure that you have completed the following tasks before submitting your pull request:

- [ ] I have read the [contributing guidelines](../CONTRIBUTING.md) for this project.
- [ ] I have tested my changes against the `dev` branch (or another appropriate branch) and verified that they are working as expected.
- [ ] I have updated the documentation (if applicable) to reflect my changes.
- [ ] My changes adhere to the repository's code style guidelines.
- [ ] My changes do not introduce any breaking changes or unexpected behaviors.

## Related Issues / Pull Requests

Please include any related issues or pull requests that this change is associated with, and use the appropriate keywords (`Closes`, `Fixes`, `Resolves`) to automatically close the related issues when this pull request is merged.

- Closes #issue_number
- Fixes #issue_number
- Resolves #issue_number

## Additional Details

Please provide any additional information that you feel is relevant to this pull request, such as screenshots, code snippets, or examples.
43 changes: 43 additions & 0 deletions .github/workflows/pr-build-and-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Pull Request Build & Test

on:
pull_request:
workflow_dispatch:

jobs:
build-and-test:
name: PR Build & Test
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@master

- name: Get yarn cache
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"

- uses: actions/cache@v1
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 19

- name: Install Dependencies
run: yarn install --frozen-lockfile

- name: Lint
run: yarn lint

- name: Lint
run: yarn test

- name: Build
run: yarn build
65 changes: 65 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Build & Release

on:
push:
branches:
- main
workflow_dispatch:

jobs:
build-and-release:
name: Build & Release
needs: build-and-test
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@master

- name: Get yarn cache
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"

- uses: actions/cache@v1
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 19

- name: Install Dependencies
run: yarn install --frozen-lockfile

- name: Lint
run: yarn lint

- name: Lint
run: yarn test

- name: Build
run: yarn build

- uses: rymndhng/release-on-push-action@master
id: release
with:
bump_version_scheme: minor
use_github_release_notes: true

- name: Log Release Version
run: |
echo "Created tag name: ${{ steps.release.outputs.tag_name }}"
echo "Created release version: ${{ steps.release.outputs.version }}"

- name: Upload JS card file to release
uses: svenstaro/upload-release-action@v2
with:
overwrite: true
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ steps.release.outputs.version }}
file: /home/runner/work/lovelace-sun-card/lovelace-sun-card/dist/lovelace-sun-card.js
28 changes: 0 additions & 28 deletions .github/workflows/tests.yaml

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/validate.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name: Validate

on:
workflow_dispatch:
push:
branches:
- main
Expand All @@ -12,9 +11,10 @@ on:
- develop
schedule:
- cron: "0 0 * * *"
workflow_dispatch:

jobs:
validate:
validate-hacs:
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v2"
Expand Down
2 changes: 2 additions & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
nodejs 19.6.0
yarn 1.22.19
1 change: 1 addition & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
MIT License

Copyright (c) 2021 AitorDB
avataar marked this conversation as resolved.
Show resolved Hide resolved
Copyright (c) 2023 rejuvenate/lovelace-sun-card

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
11 changes: 3 additions & 8 deletions dev/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<div class="card">
<sun-card id="test"></sun-card>
</div>
<script src="../dist/home-assistant-sun-card.js"></script>
<script src="/lovelace-sun-card.js"></script>
<script>
const darkMode = false
if (!darkMode) {
Expand All @@ -42,12 +42,7 @@

const test = document.querySelector('#test')
test.setConfig({
title: 'Sunrise & Sunset',
/*fields: {
azimuth: true,
elevation: true
}//*/
//use12hourClock: true
title: 'Sunrise & Sunset'
})
test.hass = {
language: 'en',
Expand All @@ -74,4 +69,4 @@
}
</script>
</body>
</html>
</html>
2 changes: 1 addition & 1 deletion hacs.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "Sun Card",
avataar marked this conversation as resolved.
Show resolved Hide resolved
"render_readme": true,
"filename": "home-assistant-sun-card.js"
"filename": "lovelace-sun-card.js"
}
Loading