Skip to content

Commit

Permalink
feat: initial release
Browse files Browse the repository at this point in the history
  • Loading branch information
vnphanquang committed Mar 15, 2022
0 parents commit bbd9ddf
Show file tree
Hide file tree
Showing 40 changed files with 15,300 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Editor configuration, see https://editorconfig.org

root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
91 changes: 91 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
module.exports = {
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:import/typescript',
],
plugins: ['import', '@typescript-eslint', 'modules-newline', 'prettier'],
parser: '@typescript-eslint/parser',
rules: {
semi: 'off',
'@typescript-eslint/semi': ['error'],
'@typescript-eslint/consistent-type-imports': [
'error',
{
prefer: 'type-imports',
},
],
'@typescript-eslint/no-unused-vars': [
'warn',
{
argsIgnorePattern: '^_',
},
],
'@typescript-eslint/member-delimiter-style': [
'error',
{
multiline: {
delimiter: 'semi',
requireLast: true,
},
singleline: {
delimiter: 'semi',
requireLast: true,
},
},
],
'object-curly-newline': [
'error',
{
ObjectExpression: {
consistent: true,
},
ObjectPattern: {
consistent: true,
},
ImportDeclaration: {
minProperties: 2,
multiline: true,
},
ExportDeclaration: {
minProperties: 2,
multiline: true,
},
},
],
'import/prefer-default-export': 'off',
'import/extensions': ['off', 'never'],
'import/order': [
'error',
{
groups: [
'builtin',
'external',
'internal',
'parent',
'sibling',
'index',
'object',
'unknown',
],
pathGroups: [
{
pattern: '$*/**',
group: 'internal',
},
],
'newlines-between': 'always',
pathGroupsExcludedImportTypes: [],
alphabetize: {
order: 'asc',
caseInsensitive: true,
},
warnOnUnassignedImports: true,
},
],
},
env: {
node: true,
},
overrides: [],
};
86 changes: 86 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: CI

on:
workflow_dispatch:
pull_request:
branches:
- main
paths-ignore:
- '.editorconfig'
- '.gitignore'
- 'CODE_OF_CONDUCT.md'
- 'CONTRIBUTING.md'
- 'README.md'
- 'LICENSE'
- 'release.config.js'

env:
MONKEYTYPE_API_KEY: ${{ secrets.MONKEYTYPE_API_KEY }}

jobs:
Tests:
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
node: [16]
os: [ubuntu-latest]
include:
- can-fail: false
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup pnpm
uses: pnpm/action-setup@v2.2.1
with:
version: 6.32.2
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
continue-on-error: ${{ matrix.can-fail }}
- name: Build package
run: pnpm build
continue-on-error: ${{ matrix.can-fail }}
- name: Eslint - code lint
run: pnpm lint:es
continue-on-error: ${{ matrix.can-fail }}
- name: Prettier - code style
run: pnpm prettier
continue-on-error: ${{ matrix.can-fail }}
- name: Test
run: pnpm test:ci
continue-on-error: ${{ matrix.can-fail }}
- name: Update coverage info for PR
if: ${{ github.event_name == 'pull_request' }}
uses: ArtiomTr/jest-coverage-report-action@v2
with:
skip-step: all
coverage-file: coverage/report.json
base-coverage-file: coverage/report.json
CodeGL:
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: ['typescript']
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
- name: Autobuild
uses: github/codeql-action/autobuild@v1
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
45 changes: 45 additions & 0 deletions .github/workflows/codecov.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Codecov

on:
workflow_dispatch:
push:
branches:
- main
paths:
- "**.ts"
- ".github/workflows/codecov.yaml"
- "jest.config.js"

env:
MONKEYTYPE_API_KEY: ${{ secrets.MONKEYTYPE_API_KEY }}

jobs:
Codecov:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup pnpm
uses: pnpm/action-setup@v2.2.1
with:
version: 6.32.2
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 16
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
continue-on-error: false
- name: Test
run: pnpm test
continue-on-error: false
- name: Update code coverage to Codecov
uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
directory: ./coverage
flags: unittests
verbose: true
fail_ci_if_error: true
33 changes: 33 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Release

on:
workflow_dispatch:

jobs:
Release:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup pnpm
uses: pnpm/action-setup@v2.2.1
with:
version: 6.32.2
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 16
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
continue-on-error: false
- name: Build package
run: pnpm build
continue-on-error: false
- name: Release
run: pnpm semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
70 changes: 70 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
coverage/

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Dependency directories
node_modules/
jspm_packages/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.envrc

# OS X temporary files
.DS_Store

# Build target
build/

# vscode
.vscode/

# JetBrains IDEs
.idea/

# tsc cache
.tsbuildinfo

# rollup cache
.rollup.cache/
3 changes: 3 additions & 0 deletions .prettierrc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
tabWidth: 2
semi: true
singleQuote: true
Empty file added CHANGELOG.md
Empty file.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022 Quang Phan

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Loading

0 comments on commit bbd9ddf

Please sign in to comment.