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

refactor: upgrade template #22

Merged
merged 11 commits into from
Mar 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 4 additions & 2 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
github: [hadenlabs]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
ko_fi: luismayta # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: luismayta # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: https://www.paypal.me/luismayta
custom:
- https://www.paypal.me/luismayta
- https://www.buymeacoffee.com/luismayta
24 changes: 1 addition & 23 deletions .github/linters/.commitlintrc.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,3 @@
{
"extends": ["@commitlint/config-conventional"],
"rules": {
"header-max-length": [2, "always", 80],
"subject-case": [2, "always", ["lower-case"]],
"type-enum": [
2,
"always",
[
"build",
"chore",
"ci",
"docs",
"feat",
"fix",
"perf",
"refactor",
"revert",
"style",
"test",
"sample"
]
]
}
"extends": ["@hadenlabs/commitlint-config"]
}
120 changes: 14 additions & 106 deletions .github/linters/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,117 +1,25 @@
module.exports = {
env: {
node: true,
es2021: true,
},
extends: [
'standard',
'plugin:react/recommended', // Uses the recommended rules from @eslint-plugin-react
'plugin:@typescript-eslint/recommended',
'plugin:import/errors',
'plugin:import/warnings',
'plugin:import/typescript',
'plugin:promise/recommended',
'plugin:react-hooks/recommended',
'plugin:prettier/recommended', // Enables eslint-plugin-prettier and displays prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array.
'prettier',
'plugin:prettier/recommended', // Enables eslint-plugin-prettier and displays prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array.
],
plugins: ['prettier'],
settings: {
react: {
version: 'detect', // Tells eslint-plugin-react to automatically detect the version of React to use
},
'import/resolver': {
'babel-module': {},
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 12,
sourceType: 'module',
},
env: {
browser: true,
jest: true,
},
overrides: [
{
files: ['*.ts', '*.tsx'],
parser: '@typescript-eslint/parser',
extends: [
'standard',
'plugin:react/recommended', // Uses the recommended rules from @eslint-plugin-react
'plugin:@typescript-eslint/recommended',
'plugin:import/errors',
'plugin:import/warnings',
'plugin:import/typescript',
'plugin:promise/recommended',
'plugin:react-hooks/recommended',
'plugin:prettier/recommended', // Enables eslint-plugin-prettier and displays prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array.
'plugin:jsx-a11y/recommended',
'prettier',
'prettier/@typescript-eslint',
],
plugins: ['prettier', 'react-hooks', 'jsx-a11y'],
parserOptions: {
ecmaversion: 2018,
project: './tsconfig.json',
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
},
settings: {
react: {
version: 'detect',
},
'import/resolver': {
'babel-module': {},
},
},
rules: {
'react/react-in-jsx-scope': 0,
'ordered-imports': 0,
quotemark: 0,
'no-console': 0,
semicolon: 0,
'jsx-no-lambda': 0,
camelcase: 0,
'@typescript-eslint/interface-name-prefix': 0,
'@typescript-eslint/naming-convention': [
'error',
{
selector: 'default',
format: ['camelCase', 'PascalCase'],
leadingUnderscore: 'forbid',
},
{
selector: 'class',
format: ['PascalCase'],
},
{
selector: 'property',
modifiers: ['readonly'],
format: ['camelCase', 'UPPER_CASE'],
},
{
selector: 'memberLike',
modifiers: ['protected'],
format: ['camelCase'],
leadingUnderscore: 'require',
},
{
selector: 'memberLike',
modifiers: ['private'],
format: ['camelCase'],
leadingUnderscore: 'require',
},
{
selector: 'variable',
format: ['PascalCase', 'camelCase', 'UPPER_CASE'],
},
{
selector: 'interface',
format: ['PascalCase'],
prefix: ['I'],
},
],
},
},
{
files: ['**/*.tsx'],
rules: {
'react/prop-types': 'off',
},
},
],
plugins: ['@typescript-eslint', 'prettier'],
rules: {},
}
4 changes: 3 additions & 1 deletion .github/linters/.prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ package-lock.json
coverage
.mypy_cache/
.build
CHANGELOG.tpl.md
.terraform
*.tpl.md
*.enc.yaml
17 changes: 17 additions & 0 deletions .github/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 60
# Number of days of inactivity before a stale issue is closed
daysUntilClose: 7
# Issues with these labels will never be considered stale
exemptLabels:
- pinned
- security
# Label to use when marking an issue as stale
staleLabel: closing/stale
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: false
75 changes: 75 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: lint code

on:
schedule:
- cron: '0 0 * * *' # every day at midnight

push:
branches:
- develop

pull_request:
branches:
- develop

env:
NODE_VERSION: 14.15.5
PYTHON_VERSION: 3.8.0
LANG: en_US.UTF-8
LC_ALL: en_US.UTF-8

jobs:
precommit:
name: build
runs-on: ubuntu-20.04
env:
LANG: en_US.UTF-8
LC_ALL: en_US.UTF-8

steps:
- name: Check out a copy of the repo
uses: actions/checkout@v2

- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v2
with:
node-version: ${{ env.NODE_VERSION }}

- name: install yarn
run: npm install -g yarn

- name: get package manager's global cache path
id: global-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- name: cache package manager's global cache and node_modules
id: cache-dependencies
uses: actions/cache@v2
with:
path: |
${{ steps.global-cache-dir-path.outputs.dir }}
node_modules
key: ${{ runner.os }}-${{ matrix.node-version }}-${{
hashFiles('**/yarn.lock'
) }}
restore-keys: |
${{ runner.os }}-${{ matrix.node-version }}-

- name: Install Dependencies
run: yarn install --frozen-lockfile
if: |
steps.cache-dependencies.outputs.cache-hit != 'true'

- name: switch version ptyhon
uses: actions/setup-python@v2
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: install pipenv
run: python -m pip install --no-cache-dir pipenv

- name: install dependences python
run: pipenv install --dev --deploy --skip-lock --python="$(which python)"

- name: execute pre-commit
run: pipenv run pre-commit run --all-files
56 changes: 56 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: create release

on:
workflow_run:
workflows: ['lint code']
types:
- completed

push:
tags:
- '[0-9]+.[0-9]+.[0-9]+'
# https://semver.org/ proper release tags, more or less
- 'v[0-9]+.[0-9]+.[0-9]+'
# prerelease tags, more or less
- 'v[0-9]+.[0-9]+.[0-9]+-*'

jobs:
release:
runs-on: ubuntu-20.04
if: ${{ github.event.workflow_run.conclusion == 'success' }}
container:
image: golang:1.15
steps:
- name: Check out a copy of the repo
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: show tag
id: tag
run: |
echo ::set-output name=TAG::${GITHUB_REF##*/}

- name: install
run: |
go get github.com/git-chglog/git-chglog/cmd/git-chglog

- name: generate changelog
run: |
# https://github.com/git-chglog/git-chglog#git-chglog
$(go env GOPATH)/bin/git-chglog \
-c .chglog/config.yml \
-o RELEASE_CHANGELOG.md \
${{ steps.tag.outputs.TAG }}

- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
with:
tag_name: ${{ steps.tag.outputs.TAG }}
release_name: ${{ steps.tag.outputs.TAG }}
draft: true
prerelease: false
body_path: RELEASE_CHANGELOG.md
Loading