Skip to content

Commit

Permalink
feat: initial release
Browse files Browse the repository at this point in the history
  • Loading branch information
zavoloklom committed Sep 14, 2024
1 parent eca9f31 commit 6dd3bf2
Show file tree
Hide file tree
Showing 101 changed files with 20,740 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .c8rc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"all": true,
"reporter": ["lcov", "cobertura", "text-summary"],
"include": ["src/**/*.ts"]
}
86 changes: 86 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
{
"root": true,
"env": {
"node": true,
"es2024": true
},
"globals": {
"process": true,
"import": true
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.eslint.json",
"sourceType": "module",
"ecmaVersion": "latest"
},
"extends": [
"eslint:recommended",
"plugin:import/recommended",
"plugin:@typescript-eslint/recommended-type-checked",
"plugin:sonarjs/recommended-legacy",
"airbnb-base",
"airbnb-typescript/base",
"plugin:import/typescript",
"plugin:prettier/recommended"
],
"plugins": [
"@typescript-eslint",
"sonarjs",
"import",
"@stylistic",
"prettier"
],
"settings": {
"import/resolver": {
"typescript": {
"alwaysTryTypes": true,
"project": "./tsconfig.eslint.json",
"extensions": [".ts", ".tsx", ".d.ts"]
},
"node": {
"extensions": [".js", ".jsx", ".ts", ".tsx", ".d.ts"]
}
}
},
"rules": {
"no-unused-vars": 0,
"no-console": 0,
"@typescript-eslint/no-unused-vars": [
2,
{
"args": "none"
}
],
"prettier/prettier": 2,
"@stylistic/indent": ["error", 4],
"@stylistic/indent-binary-ops": ["error", 4],
"arrow-body-style": 0,
"prefer-arrow-callback": 0,
"prefer-rest-params": 0,
"sonarjs/cognitive-complexity": 1,
"@typescript-eslint/triple-slash-reference": [
2,
{
"path": "never",
"types": "always",
"lib": "always"
}
],
"import/prefer-default-export": 0,
"import/no-default-export": 0,
"import/no-unresolved": [2, { "commonjs": true }],
"import/extensions": 0,
"import/order": [
2,
{
"groups": [
"builtin",
"external",
"internal"
]
}
]
},
"ignorePatterns": ["node_modules", "dist", ".tsimp", "coverage", "bin"]
}
21 changes: 21 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
version: 2
updates:
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "weekly"
open-pull-requests-limit: 5
target-branch: "main"
ignore:
- dependency-name: "@types/node"
update-types: ["version-update:semver-major"]
- dependency-name: "@typescript-eslint/eslint-plugin"
update-types: ["version-update:semver-major"]
- dependency-name: "@typescript-eslint/parser"
update-types: ["version-update:semver-major"]
- dependency-name: "eslint"
update-types: ["version-update:semver-major"]
- dependency-name: "eslint-plugin-sonarjs"
update-types: ["version-update:semver-major"]
allow:
- dependency-type: "all"
118 changes: 118 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
name: CI Pipeline

on:
push:
branches:
- main
pull_request:
branches:
- '**'

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '20.17.0'

- name: Install dependencies
run: npm ci

- name: Build the project
run: npm run build

- name: Run linter
run: npm run lint

- name: Run tests
run: npm run test:coverage

- name: Report coverage to Codacy
env:
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
run: wget -qO - https://coverage.codacy.com/get.sh | bash -s -- report -r ./coverage/cobertura-coverage.xml

- name: Upload build artifacts
uses: actions/upload-artifact@v3
if: github.ref == 'refs/heads/main'
with:
name: build-artifacts
path: ./dist

release:
runs-on: ubuntu-latest
needs: build
if: github.ref == 'refs/heads/main'

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Download build artifacts
uses: actions/download-artifact@v3
with:
name: build-artifacts

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '20.17.0'

- name: Install dependencies
run: npm ci

- name: Run semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npx semantic-release

docker:
runs-on: ubuntu-latest
needs: release
if: github.ref == 'refs/heads/main'

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Get build arguments
id: vars
run: |
BUILD_DATE=$(date +%Y-%m-%dT%T%z)
BUILD_VERSION=$(awk -F\" '/"version":/ {print $4}' package.json)
BUILD_REVISION=$(git rev-parse --short HEAD)
echo "BUILD_DATE=$BUILD_DATE" >> $GITHUB_ENV
echo "BUILD_VERSION=$BUILD_VERSION" >> $GITHUB_ENV
echo "BUILD_REVISION=$BUILD_REVISION" >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
install: true

- name: Log in to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
platforms: linux/amd64,linux/arm64
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/dclint:latest
${{ secrets.DOCKERHUB_USERNAME }}/dclint:${{ env.BUILD_VERSION }}
build-args: |
BUILD_DATE=${{ env.BUILD_DATE }}
BUILD_VERSION=${{ env.BUILD_VERSION }}
BUILD_REVISION=${{ env.BUILD_REVISION }}
33 changes: 33 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace

# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json

# Misc
.DS_Store

# Envs
.env

# Dependencies
/node_modules

# Tests
/coverage

# Build
/dist

# Runtime
/.tsimp
10 changes: 10 additions & 0 deletions .markdownlint.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module.exports = {
"default": true,
"MD004": {
"style": "dash"
},
"MD013": {
"line_length": 120,
"ignore_code_blocks": true
},
};
12 changes: 12 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"printWidth": 120,
"tabWidth": 4,
"useTabs": false,
"semi": true,
"singleQuote": true,
"quoteProps": "as-needed",
"trailingComma": "all",
"bracketSpacing": true,
"bracketSameLine": false,
"arrowParens": "always"
}
Loading

0 comments on commit 6dd3bf2

Please sign in to comment.