Skip to content

Commit

Permalink
feat: initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandermendes committed Sep 17, 2024
0 parents commit 43ad8fd
Show file tree
Hide file tree
Showing 57 changed files with 12,399 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules/
coverage/
dist/
src/generated/
55 changes: 55 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"parser": "@typescript-eslint/parser",
"extends": [
"airbnb-base",
"plugin:jest-formatting/strict",
"plugin:jest/recommended",
"plugin:jest/style",
"plugin:prettier/recommended"
],
"plugins": [
"@typescript-eslint",
"jest",
"jest-formatting",
"json"
],
"env": {
"node": true,
"jest/globals": true
},
"globals": {
"PromiseFulfilledResult": "readonly"
},
"settings": {
"import/parsers": { "@typescript-eslint/parser": [".ts", ".tsx"] },
"import/resolver": { "typescript": {} }
},
"rules": {
"import/prefer-default-export": "off",
"import/no-extraneous-dependencies": "off",
"import/extensions": "off",
"global-require": "off",
"import/no-dynamic-require": "off",
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": ["error"],
"@typescript-eslint/no-non-null-assertion": "error",
"class-methods-use-this": "off",
"indent": "off",
"max-classes-per-file": "off",
"no-underscore-dangle": "off",
"no-shadow": "off",
"@typescript-eslint/no-shadow": ["error"],
"no-console": "off",
"no-param-reassign": "off",
"consistent-return": "off",
"padding-line-between-statements": [
"error",
{ "blankLine": "always", "prev": ["*"], "next": ["block-like", "return", "class"] },
{ "blankLine": "always", "prev": ["block-like", "return", "class"], "next": ["*"] }
],
"jest/consistent-test-it": ["error", { "fn": "it" }],
"jest/prefer-lowercase-title": ["error", { "ignore": ["describe"] }],
"jest/require-top-level-describe": "error",
"jest/no-standalone-expect": "off"
}
}
27 changes: 27 additions & 0 deletions .github/actions/install/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Install
inputs:
NPM_TOKEN:
required: true

runs:
using: composite
steps:
- name: Setup .npmrc
shell: bash
run: echo "//registry.npmjs.org/:_authToken=${{ inputs.NPM_TOKEN }}" >> .npmrc
- name: Get yarn cache directory path
shell: bash
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Restore node modules cache
uses: actions/cache@v3
id: node-modules-cache
with:
path: '**/node_modules'
key: ${{ runner.os }}-nodemodules-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-nodemodules-
- name: Install
shell: bash
if: steps.node-modules-cache.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile --non-interactive
18 changes: 18 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
version: 2
registries:
npm-npmjs:
type: npm-registry
url: https://registry.npmjs.org
token: ${{ secrets.NPM_TOKEN }}
updates:
- package-ecosystem: npm
directory: /
schedule:
interval: monthly
allow:
- dependency-type: direct

- package-ecosystem: github-actions
directory: /
schedule:
interval: monthly
22 changes: 22 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: CI

on:
pull_request:
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
uses: ./.github/workflows/test.yml
secrets:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

dependabot:
uses: ./.github/workflows/dependabot-auto-merge.yml
needs: test
secrets:
GH_TOKEN: "${{ secrets.GH_DEPENDABOT_TOKEN || secrets.GH_DEPLOY_TOKEN }}"
41 changes: 41 additions & 0 deletions .github/workflows/dependabot-auto-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Dependabot Auto-Merge
on:
workflow_call:
secrets:
GH_TOKEN:
required: true

jobs:
dependabot:
runs-on: ubuntu-latest
if: ${{ github.event.pull_request.user.login == 'dependabot[bot]' }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Fetch Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v1
with:
github-token: "${{ secrets.GH_TOKEN }}"
- name: Determine auto-mergeability
id: auto
run: echo "enabled=${{steps.metadata.outputs.dependency-type == 'direct:development' && (steps.metadata.outputs.update-type == 'version-update:semver-patch' || steps.metadata.outputs.update-type == 'version-update:semver-minor')}}" >> $GITHUB_OUTPUT
- name: Enable auto-merge for patches
if: steps.auto.outputs.enabled == 'true'
run: gh pr merge --auto --squash "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GH_TOKEN}}
- name: Approve the PR
if: steps.auto.outputs.enabled == 'true'
run: |
gh pr checkout "$PR_URL"
if [ "$(gh pr status --json reviewDecision -q .currentBranch.reviewDecision)" != "APPROVED" ];
then
gh pr review --approve "$PR_URL"
else
echo "PR already approved.";
fi
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GH_TOKEN}}
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:
push:
branches:
- main
- canary/*

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
uses: ./.github/workflows/test.yml
secrets:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

release:
runs-on: ubuntu-latest
needs: test
steps:
- name: Checkout
uses: actions/checkout@v3
with:
persist-credentials: false
- name: Install
run: yarn install --frozen-lockfile --non-interactive
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GH_DEPLOY_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: yarn run semantic-release
27 changes: 27 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
on:
workflow_call:
secrets:
NPM_TOKEN:
required: true

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install
uses: ./.github/actions/install
with:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Lint
run: yarn lint
- name: Check types
run: yarn typecheck
- name: Restore Jest cache
uses: actions/cache@v3
with:
path: .jest-cache
key: ${{ runner.os }}-jest
- name: Test
run: yarn test
28 changes: 28 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Packages
.yalc
yalc.lock
node_modules/

# Build
dist/
*.tsbuildinfo

# Logs
*.log

# OS
.DS_Store

# IDE
.idea/

# Tests
coverage/
.jest/
spec.json

# Vi
*.swp

# Generated client code
src/generated/
5 changes: 5 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
jsxBracketSameLine: true,
singleQuote: true,
trailingComma: 'all',
};
7 changes: 7 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"recommendations": [
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"davidanson.vscode-markdownlint"
]
}
21 changes: 21 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"typescript.preferences.importModuleSpecifier": "relative",
"files.trimFinalNewlines": true,
"files.trimTrailingWhitespace": true,
"files.insertFinalNewline": true,
"editor.formatOnSave": false,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit",
"source.fixAll.markdownlint": "explicit"
},
"[prisma]": {
"editor.defaultFormatter": "Prisma.prisma",
"editor.formatOnSave": true
},
"editor.rulers": [80],
"eslint.validate": [
"javascript",
"typescript"
],
"typescript.tsdk": "node_modules/typescript/lib",
}
Loading

0 comments on commit 43ad8fd

Please sign in to comment.