Skip to content

Commit

Permalink
feat: initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
rushelex committed Feb 12, 2024
0 parents commit 9707ddc
Show file tree
Hide file tree
Showing 78 changed files with 20,776 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
max_line_length = 120
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
dist
78 changes: 78 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
const { configure, presets } = require('eslint-kit');

module.exports = configure({
presets: [
presets.imports({
sort: {
newline: true,
groups: [
// side effects
['^\\u0000'],

// node.js libraries, react libraries, scoped libraries
['^(node:)?(child_process|crypto|events|fs|http|https|os|path)(/.*)?$', '^@?\\w'],

// parent imports
['^\\.\\.'],

// sibling imports
['^\\.'],
],
},
}),
presets.node(),
presets.typescript({
root: '.',
tsconfig: 'tsconfig.lint.json',
}),
],
extend: {
root: true,
env: { es2020: true },
extends: ['eslint:recommended', 'plugin:@typescript-eslint/eslint-recommended'],
ignorePatterns: ['dist', '.eslintrc.cjs'],
overrides: [
{
files: ['*.ts', '*.tsx'],
parser: '@typescript-eslint/parser',
rules: {
'@typescript-eslint/consistent-type-imports': ['warn', { fixStyle: 'inline-type-imports' }],
'@typescript-eslint/no-unused-vars': [
'warn',
{
ignoreRestSiblings: true,
varsIgnorePattern: '^_',
argsIgnorePattern: '^_',
},
],

//#region @eslint-typescript/stylistic
'@typescript-eslint/adjacent-overload-signatures': 'error',
'@typescript-eslint/array-type': ['error', { default: 'array-simple', readonly: 'array-simple' }],
'@typescript-eslint/class-literal-property-style': 'error',
'@typescript-eslint/consistent-generic-constructors': 'error',
'@typescript-eslint/consistent-indexed-object-style': 'error',
'@typescript-eslint/consistent-type-assertions': 'error',
'@typescript-eslint/consistent-type-definitions': 'error',
'@typescript-eslint/no-confusing-non-null-assertion': 'error',
'no-empty-function': 'off',
'@typescript-eslint/no-empty-function': 'error',
'@typescript-eslint/no-empty-interface': 'error',
'@typescript-eslint/no-inferrable-types': 'error',
'@typescript-eslint/prefer-for-of': 'error',
'@typescript-eslint/prefer-function-type': 'error',
'@typescript-eslint/prefer-namespace-keyword': 'error',
//#endregion @eslint-typescript/stylistic
'@typescript-eslint/switch-exhaustiveness-check': 'error',
},
},
{
files: ['*.d.ts'],
rules: {
'no-inner-declarations': 'off',
'@typescript-eslint/no-empty-interface': 'off',
},
},
],
},
});
17 changes: 17 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"extends": [
"config:js-lib"
],
"labels":[
"renovate-bot"
],
"ignoreDeps": [
"node",
"@types/node",
"npm"
],
"automerge": true,
"automergeType": "pr",
"platformAutomerge": true,
"schedule": ["before 4am on the first day of the month"]
}
147 changes: 147 additions & 0 deletions .github/workflows/checking.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
name: Checking

on:
pull_request:
types:
- opened
- synchronize
- reopened

jobs:
prepare:
name: Prepare
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "lts/*"

- name: Cache dependencies
id: cache-deps
uses: actions/cache@v4
with:
path: ./node_modules
key: deps-${{ hashFiles('package-lock.json') }}

- name: Install dependencies
if: steps.cache-deps.outputs.cache-hit != 'true'
run: npm clean-install

- name: Verify the integrity of provenance attestations and registry signatures for installed dependencies
run: npm audit signatures

- name: Cache testing dependencies
id: cache-test-deps
uses: actions/cache@v4
with:
path: ./test/node_modules
key: test-deps-${{ hashFiles('test/package-lock.json') }}

- name: Install testing dependencies
if: steps.cache-test-deps.outputs.cache-hit != 'true'
run: npm clean-install
working-directory: test

- name: Verify the integrity of provenance attestations and registry signatures for installed dependencies
run: npm audit signatures
working-directory: test

lint:
name: Linting
needs:
- prepare
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "lts/*"

- name: Restore dependencies
uses: actions/cache/restore@v4
with:
path: ./node_modules
key: deps-${{ hashFiles('package-lock.json') }}

- name: Build
run: npm run build

- name: Restore testing dependencies
uses: actions/cache/restore@v4
with:
path: ./test/node_modules
key: test-deps-${{ hashFiles('test/package-lock.json') }}

- name: Run linter
run: npm run lint

typecheck:
name: Type checking
needs:
- prepare
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "lts/*"

- name: Restore dependencies
uses: actions/cache/restore@v4
with:
path: ./node_modules
key: deps-${{ hashFiles('package-lock.json') }}

- name: Build
run: npm run build

- name: Restore testing dependencies
uses: actions/cache/restore@v4
with:
path: ./test/node_modules
key: test-deps-${{ hashFiles('test/package-lock.json') }}

- name: Run typecheck
run: npm run typecheck

tests:
name: Tests
needs:
- prepare
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "lts/*"

- name: Restore dependencies
uses: actions/cache/restore@v4
with:
path: ./node_modules
key: deps-${{ hashFiles('package-lock.json') }}

- name: Build
run: npm run build

- name: Restore testing dependencies
uses: actions/cache/restore@v4
with:
path: ./test/node_modules
key: test-deps-${{ hashFiles('test/package-lock.json') }}

- name: Run tests
run: npm run test
77 changes: 77 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Release

on:
push:
branches:
- main
- next
- beta
- alpha
- rc

permissions:
contents: read # for checkout

jobs:
prepare:
name: Prepare
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "lts/*"

- name: Cache dependencies
id: cache-deps
uses: actions/cache@v4
with:
path: ./node_modules
key: deps-${{ hashFiles('package-lock.json') }}

- name: Install dependencies
if: steps.cache-deps.outputs.cache-hit != 'true'
run: npm clean-install

- name: Verify the integrity of provenance attestations and registry signatures for installed dependencies
run: npm audit signatures

release:
name: Release
needs:
- prepare
runs-on: ubuntu-latest
permissions:
contents: write # to be able to publish a GitHub release
issues: write # to be able to comment on released issues
pull-requests: write # to be able to comment on released pull requests
id-token: write # to enable use of OIDC for npm provenance
steps:
- name: Checkout the repository
uses: actions/checkout@v4
with:
token: ${{ secrets.GH_TOKEN_SEMANTIC_RELEASE }}
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "lts/*"

- name: Restore dependencies
uses: actions/cache/restore@v4
with:
path: ./node_modules
key: deps-${{ hashFiles('package-lock.json') }}

- name: Build
run: npm run build

- name: Release
run: npm run release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
24 changes: 24 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
dist
CHANGELOG.md
package-lock.json
16 changes: 16 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
The ISC License

Copyright (c) 2024, Aleksey Shelementev <[email protected]>

Permission to use, copy, modify, and/or distribute this software for any purpose
with or without fee is hereby granted, provided that the above copyright notice
and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED “AS IS” AND THE AUTHOR DISCLAIMS ALL
WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Loading

0 comments on commit 9707ddc

Please sign in to comment.