Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
brenoepics authored May 5, 2024
0 parents commit a597f4b
Show file tree
Hide file tree
Showing 27 changed files with 31,813 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"image": "mcr.microsoft.com/devcontainers/universal:2",
"features": {
"ghcr.io/dhoeric/features/act:1": {}
},
"customizations": {
"vscode": {
"extensions": [
"cschleiden.vscode-github-actions",
"redhat.vscode-yaml"
]
}
}
}
70 changes: 70 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
module.exports = {
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/strict-type-checked", // Enable type checking, max strictness
"plugin:prettier/recommended" // prettier rules
],

parser: "@typescript-eslint/parser",

parserOptions: {
project: true,
tsconfigRootDir: __dirname
},

plugins: ["@typescript-eslint"],

root: true,

ignorePatterns: [
".eslintrc.js",
"*.spec.ts",
"*.test.ts",
"dist/",
"coverage/",
"lib/",
"pnpm-lock.yaml",
".pnpm-store/",
], // ESLINT IGNORE

env: {
// ESLINT ENV
node: true,
jest: true
},

rules: {
"no-else-return": ["error", { allowElseIf: false }],
"consistent-return": "error",
"no-console": "warn",
"@typescript-eslint/typedef": [
"error",
{
variableDeclaration: true,
memberVariableDeclaration: true
}
],
"@typescript-eslint/explicit-module-boundary-types": "error",
"@typescript-eslint/naming-convention": [
"error",
{
selector: "class",
format: ["PascalCase"]
}
],
"@typescript-eslint/prefer-readonly": "error",
"@typescript-eslint/explicit-member-accessibility": [
"error",
{
accessibility: "explicit",
overrides: {
accessors: "explicit",
constructors: "no-public",
methods: "explicit",
properties: "explicit",
parameterProperties: "explicit"
}
}
]
}
};
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file

version: 2
updates:
- package-ecosystem: "npm" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
67 changes: 67 additions & 0 deletions .github/workflows/check-dist.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# In TypeScript actions, `dist/` is a special directory. When you reference
# an action with the `uses:` property, `dist/index.js` is the code that will be
# run. For this project, the `dist/index.js` file is transpiled from other
# source files. This workflow ensures the `dist/` directory contains the
# expected transpiled code.
#
# If this workflow is run from a feature branch, it will act as an additional CI
# check and fail if the checked-in `dist/` directory does not match what is
# expected from the build.
name: Check Transpiled JavaScript

on:
pull_request:
branches:
- main
push:
branches:
- main

permissions:
contents: read

jobs:
check-dist:
name: Check dist/
runs-on: ubuntu-latest

steps:
- name: Checkout
id: checkout
uses: actions/checkout@v4

- name: Install pnpm
id: setup-pnpm
uses: pnpm/action-setup@v3

- name: Set node version
id: setup-node
uses: actions/setup-node@v4
with:
node-version-file: .node-version
cache: 'pnpm'

- name: Build dist/ Directory
id: build
run: pnpm run preflight

# This will fail the workflow if the `dist/` directory is different from
# expected.
- name: Compare Directories
id: diff
run: |
if [ "$(git diff --ignore-space-at-eol --text dist/ | wc -l)" -gt "0" ]; then
echo "Detected uncommitted changes after build. See status below:"
git diff --ignore-space-at-eol --text dist/
exit 1
fi
# If `dist/` was different from expected, upload the expected version as a
# workflow artifact.
- if: ${{ failure() && steps.diff.outcome == 'failure' }}
name: Upload Artifact
id: upload
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
72 changes: 72 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Continuous Integration

on:
workflow_dispatch:
pull_request:
branches:
- main
push:
branches:
- main

permissions:
contents: read

jobs:
test-typescript:
name: TypeScript Tests
runs-on: ubuntu-latest

steps:
- name: Checkout
id: checkout
uses: actions/checkout@v4

- name: Install pnpm
id: setup-pnpm
uses: pnpm/action-setup@v3

- name: Set node version
id: setup-node
uses: actions/setup-node@v4
with:
node-version-file: .node-version
cache: 'pnpm'

- name: Install Dependencies
id: install
run: pnpm install

- name: Check Format
id: pnpm-format-check
run: pnpm run format:check

- name: Lint
id: pnpm-lint
run: pnpm run lint

- name: Test
id: pnpm-ci-test
run: pnpm run ci-test

test-action:
runs-on: ubuntu-latest
name: A job to say hello
steps:
# To use this repository's private action,
# you must check out the repository
- name: Checkout
uses: actions/checkout@v4
- name: Install pnpm
id: setup-pnpm
uses: pnpm/action-setup@v3
- name: Install dependencies and build
run: pnpm run preflight
- name: Hello world action step
uses: ./ # Uses an action in the root directory
id: hello
with:
who-to-greet: "Mona the Octocat"
# Use the output from the `hello` step
- name: Get the output time
run: echo "The time was ${{ steps.hello.outputs.time }}"
48 changes: 48 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: CodeQL

on:
pull_request:
branches:
- main
push:
branches:
- main
schedule:
- cron: "31 7 * * 3"

permissions:
actions: read
checks: write
contents: read
security-events: write

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
language:
- TypeScript

steps:
- name: Checkout
id: checkout
uses: actions/checkout@v4

- name: Initialize CodeQL
id: initialize
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
source-root: src

- name: Autobuild
id: autobuild
uses: github/codeql-action/autobuild@v3

- name: Perform CodeQL Analysis
id: analyze
uses: github/codeql-action/analyze@v3
Loading

0 comments on commit a597f4b

Please sign in to comment.