Skip to content

Commit 1de649e

Browse files
committed
feat: Initial release
0 parents  commit 1de649e

29 files changed

+20247
-0
lines changed

.eslintignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
dist/
2+
lib/
3+
node_modules/

.eslintrc.js

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
module.exports = {
2+
extends: [
3+
"plugin:@typescript-eslint/recommended",
4+
"plugin:@typescript-eslint/recommended-requiring-type-checking",
5+
"plugin:jest/recommended"
6+
],
7+
parser: "@typescript-eslint/parser",
8+
parserOptions: {
9+
project: "tsconfig.eslint.json",
10+
sourceType: "module",
11+
},
12+
plugins: [
13+
"jest",
14+
"@typescript-eslint",
15+
"eslint-plugin-deprecation",
16+
"eslint-plugin-import",
17+
],
18+
rules: {
19+
"no-sequences": "error",
20+
"no-param-reassign": "error",
21+
"no-unused-labels": "error",
22+
"no-cond-assign": "error",
23+
"no-new-wrappers": "error",
24+
"constructor-super": "error",
25+
"no-duplicate-case": "error",
26+
"no-redeclare": "error",
27+
"no-shadow": [
28+
"error",
29+
{
30+
hoist: "all",
31+
},
32+
],
33+
"no-empty": [
34+
"error",
35+
{
36+
allowEmptyCatch: true,
37+
},
38+
],
39+
"no-invalid-this": "error",
40+
"no-unsafe-finally": "error",
41+
"no-var": "warn",
42+
"no-console": "off",
43+
"eqeqeq": ["warn", "always"],
44+
"prefer-const": "error",
45+
"deprecation/deprecation": "warn",
46+
"import/no-extraneous-dependencies": "error",
47+
"import/no-duplicates": "warn",
48+
"import/no-unassigned-import": "warn",
49+
"import/no-internal-modules": "off",
50+
"@typescript-eslint/adjacent-overload-signatures": "error",
51+
"@typescript-eslint/no-namespace": "error",
52+
"@typescript-eslint/triple-slash-reference": [
53+
"error",
54+
{
55+
path: "always",
56+
types: "prefer-import",
57+
lib: "always",
58+
},
59+
],
60+
"@typescript-eslint/no-unnecessary-type-assertion": "error",
61+
"@typescript-eslint/no-floating-promises": "error",
62+
"@typescript-eslint/no-throw-literal": "error",
63+
"@typescript-eslint/no-confusing-void-expression": "error",
64+
"@typescript-eslint/no-empty-interface": "warn",
65+
"@typescript-eslint/prefer-for-of": "warn",
66+
"@typescript-eslint/unified-signatures": "warn",
67+
"@typescript-eslint/no-unsafe-assignment": "error"
68+
},
69+
env: {
70+
"node": true,
71+
},
72+
}

.gitattributes

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Marks the files under dist folder as generated, therefore not acknowledging them in diffs and language counters in GitHub.
2+
# Check https://github.com/github/linguist#overrides for details.
3+
dist/** -diff linguist-generated=true

.github/dependabot.yml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
version: 2
2+
updates:
3+
# Enable version updates for npm
4+
- package-ecosystem: 'npm'
5+
# Look for `package.json` and `lock` files in the `root` directory
6+
directory: '/'
7+
# Check the npm registry for updates every day (weekdays)
8+
schedule:
9+
interval: 'weekly'
10+
# Updates for Github Actions used in the repo
11+
- package-ecosystem: "github-actions"
12+
directory: "/"
13+
schedule:
14+
interval: "weekly"

.github/workflows/action-testing.yml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Action testing
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- master
7+
- 'releases/*'
8+
9+
jobs:
10+
# We need to do different set-ups if we run the job locally using act or being run in GitHub Actions
11+
# Check: https://github.com/nektos/act/issues/228 for details
12+
action-tests:
13+
name: Run the action against the base repo
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: 🏠 Checkout locally
17+
if: ${{ env.ACT }}
18+
uses: actions/checkout@v2
19+
with:
20+
path: check-new-commits-action
21+
- name: 💻 Checkout from GitHub
22+
if: ${{ !env.ACT }}
23+
uses: actions/checkout@v2
24+
- name: 🔄 Test the action with currrent repo content
25+
id: check-new-commits
26+
uses: ./
27+
with:
28+
token: ${{ secrets.GITHUB_TOKEN }}
29+
branch: master
30+
seconds: 86400 # one day
31+
- if: ${{ steps.check-new-commits.outputs.has-new-commits == 'true' }}
32+
run: echo "You have ${{ steps.check-new-commits.outputs.new-commits-number }} new commit(s) ✅!"
33+
- if: ${{ steps.check-new-commits.outputs.has-new-commits != 'true' }}
34+
run: echo "You don't have new commits 🛑!"

.github/workflows/release-action.yml

+80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: Release Action version
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
cancel-previous-runs:
8+
name: Cancel previous runs
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: ⏹ Cancel Previous Runs
12+
uses: styfle/[email protected]
13+
with:
14+
access_token: ${{ secrets.GITHUB_TOKEN }}
15+
16+
create-release:
17+
name: Create a release of the action
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: 💻 Checkout
21+
uses: actions/checkout@v2
22+
with:
23+
ref: master
24+
fetch-depth: 0
25+
- name: 🔨 Read .nvmrc
26+
id: read_nvmrc
27+
run: |
28+
echo ::set-output name=NODE_VERSION::$(cat .nvmrc)
29+
- name: 🔨 Setup node
30+
uses: actions/setup-node@v1
31+
with:
32+
node-version: ${{ steps.read_nvmrc.outputs.NODE_VERSION }}
33+
- name: 🔨 Get npm cache directory
34+
id: npm-cache
35+
run: |
36+
echo "::set-output name=dir::$(npm config get cache)"
37+
- name: 🔨 Cache dependencies
38+
uses: actions/cache@v2
39+
with:
40+
path: ${{ steps.npm-cache.outputs.dir }}
41+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
42+
restore-keys: |
43+
${{ runner.os }}-node-
44+
- name: 🚧 Install dependencies
45+
run: npm ci
46+
- name: 📦 Package the binary release
47+
run: npm run all
48+
- name: 🏷 Create the binary release metadata
49+
id: create-tags
50+
run: |
51+
# We use the e-mail mentioned here: https://github.jparrowsec.cnmunity/t/github-actions-bot-email-address/17204/6
52+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
53+
git config user.name "github-actions"
54+
55+
npm run release
56+
57+
TAG=$(git describe --tags --abbrev=0) # Works since vX.Y.Z tags are annotated and won't pick the vX tags, which are not
58+
echo ::set-output name=tag::"${TAG}" # saved as output of the step
59+
- name: ⏫ Push changes to GitHub
60+
uses: ad-m/[email protected]
61+
with:
62+
github_token: ${{ secrets.GITHUB_TOKEN }}
63+
branch: master
64+
tags: true
65+
- name: 📝 Create changelog for GitHub release
66+
run: |
67+
# We first need to remove the header text, and then process it with rexreplace to obtain a proper release changelog
68+
# Reference: https://github.com/conventional-changelog/standard-version/issues/568
69+
tail -n +5 CHANGELOG.md | npx rexreplace "^.*?#+\s\[.*?\n.*?(?=\s*#+\s\[)" "_" -s -M -G -m -o > CHANGELOG-LATEST.md
70+
- name: 🚀 Create a release in GitHub
71+
id: create-gh-release
72+
uses: actions/create-release@v1
73+
env:
74+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
75+
with:
76+
tag_name: ${{ steps.create-tags.outputs.tag }}
77+
release_name: ${{ steps.create-tags.outputs.tag }}
78+
body_path: CHANGELOG-LATEST.md
79+
draft: false
80+
prerelease: false

.github/workflows/unit-testing.yml

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Unit testing
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- master
7+
- 'releases/*'
8+
9+
jobs:
10+
cancel-previous-runs:
11+
name: Cancel previous runs
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: ⏹ Cancel Previous Runs
15+
uses: styfle/[email protected]
16+
with:
17+
access_token: ${{ secrets.GITHUB_TOKEN }}
18+
19+
unit-tests:
20+
name: Run unit tests in the project
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: 💻 Checkout
24+
uses: actions/checkout@v2
25+
- name: 🔨 Read .nvmrc
26+
id: read_nvmrc
27+
run: |
28+
echo ::set-output name=NODE_VERSION::$(cat .nvmrc)
29+
- name: 🔨 Setup node
30+
uses: actions/setup-node@v1
31+
with:
32+
node-version: ${{ steps.read_nvmrc.outputs.NODE_VERSION }}
33+
- name: 🔨 Get npm cache directory
34+
id: npm-cache
35+
run: |
36+
echo "::set-output name=dir::$(npm config get cache)"
37+
- name: 🔨 Cache dependencies
38+
uses: actions/cache@v2
39+
with:
40+
path: ${{ steps.npm-cache.outputs.dir }}
41+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
42+
restore-keys: |
43+
${{ runner.os }}-node-
44+
- name: 🚧 Install dependencies
45+
run: npm ci
46+
- name: 🔄 Run tests
47+
run: npm test

.gitignore

+105
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
# Dependency directory
2+
node_modules
3+
4+
# Rest pulled from https://github.com/github/gitignore/blob/master/Node.gitignore
5+
# Logs
6+
logs
7+
*.log
8+
npm-debug.log*
9+
yarn-debug.log*
10+
yarn-error.log*
11+
lerna-debug.log*
12+
13+
# Diagnostic reports (https://nodejs.org/api/report.html)
14+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
15+
16+
# Runtime data
17+
pids
18+
*.pid
19+
*.seed
20+
*.pid.lock
21+
22+
# Directory for instrumented libs generated by jscoverage/JSCover
23+
lib-cov
24+
25+
# Coverage directory used by tools like istanbul
26+
coverage
27+
*.lcov
28+
29+
# nyc test coverage
30+
.nyc_output
31+
32+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
33+
.grunt
34+
35+
# Bower dependency directory (https://bower.io/)
36+
bower_components
37+
38+
# node-waf configuration
39+
.lock-wscript
40+
41+
# Compiled binary addons (https://nodejs.org/api/addons.html)
42+
build/Release
43+
44+
# Dependency directories
45+
jspm_packages/
46+
47+
# TypeScript v1 declaration files
48+
typings/
49+
50+
# TypeScript cache
51+
*.tsbuildinfo
52+
53+
# Optional npm cache directory
54+
.npm
55+
56+
# Optional eslint cache
57+
.eslintcache
58+
59+
# Optional REPL history
60+
.node_repl_history
61+
62+
# Output of 'npm pack'
63+
*.tgz
64+
65+
# Yarn Integrity file
66+
.yarn-integrity
67+
68+
# dotenv environment variables file
69+
.env
70+
.env.test
71+
72+
# parcel-bundler cache (https://parceljs.org/)
73+
.cache
74+
75+
# next.js build output
76+
.next
77+
78+
# nuxt.js build output
79+
.nuxt
80+
81+
# vuepress build output
82+
.vuepress/dist
83+
84+
# Serverless directories
85+
.serverless/
86+
87+
# FuseBox cache
88+
.fusebox/
89+
90+
# DynamoDB Local files
91+
.dynamodb/
92+
93+
# OS metadata
94+
.DS_Store
95+
Thumbs.db
96+
97+
# Ignore built ts files
98+
__tests__/runner/*
99+
lib/**/*
100+
101+
# Environment variables file
102+
.env
103+
104+
# GitHub Secrets file used by nektos/act
105+
.secrets

.nvmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
12.19.1

.prettierignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Ignore artifacts:
2+
lib
3+
build
4+
coverage

.prettierrc.json

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"printWidth": 80,
3+
"tabWidth": 4,
4+
"useTabs": false,
5+
"semi": false,
6+
"singleQuote": false,
7+
"bracketSpacing": true,
8+
"arrowParens": "always"
9+
}

0 commit comments

Comments
 (0)