Skip to content

Commit 5ea6871

Browse files
committed
Implement plugin
1 parent 1e8f62d commit 5ea6871

19 files changed

+15089
-5
lines changed

.editorconfig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
root = true
2+
3+
[*]
4+
end_of_line = lf
5+
charset = utf-8
6+
trim_trailing_whitespace = true
7+
insert_final_newline = true

.eslintrc.json

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{
2+
"plugins": ["import", "prettier"],
3+
"extends": [
4+
"eslint:recommended",
5+
"plugin:@typescript-eslint/recommended",
6+
"airbnb-typescript/base",
7+
"prettier"
8+
],
9+
"ignorePatterns": ["__fixtures__", "dist", "output", "jest.config.ts"],
10+
"parserOptions": {
11+
"project": "./tsconfig.json"
12+
},
13+
"rules": {
14+
"@typescript-eslint/await-thenable": "warn",
15+
"@typescript-eslint/no-floating-promises": [
16+
"warn",
17+
{ "ignoreIIFE": true, "ignoreVoid": false }
18+
],
19+
"@typescript-eslint/no-unused-vars": [
20+
"warn",
21+
{ "argsIgnorePattern": "^_" }
22+
],
23+
"import/order": "warn",
24+
"import/no-extraneous-dependencies": [
25+
"error",
26+
{
27+
"devDependencies": true,
28+
"optionalDependencies": true,
29+
"peerDependencies": true
30+
}
31+
],
32+
"import/prefer-default-export": "off",
33+
"no-console": ["warn"],
34+
"no-plusplus": "off",
35+
"prettier/prettier": "warn",
36+
"radix": ["error", "as-needed"]
37+
},
38+
"overrides": [
39+
{
40+
"files": ["*.spec.ts"],
41+
"rules": {
42+
"@typescript-eslint/no-explicit-any": "off",
43+
"@typescript-eslint/no-non-null-assertion": "off",
44+
"@typescript-eslint/no-unused-expressions": "off"
45+
}
46+
}
47+
]
48+
}

.github/dependabot.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "npm"
4+
directory: "/"
5+
schedule:
6+
interval: "monthly"

.github/workflows/build.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: build
2+
on:
3+
push:
4+
5+
jobs:
6+
build:
7+
timeout-minutes: 15
8+
env:
9+
CI: true
10+
runs-on: ubuntu-latest
11+
strategy:
12+
matrix:
13+
node-version: [12.x, 14.x, 16.x]
14+
steps:
15+
- uses: actions/checkout@v2
16+
- name: Use Node.js ${{ matrix.node-version }}
17+
uses: actions/setup-node@v2
18+
with:
19+
node-version: ${{ matrix.node-version }}
20+
cache: npm
21+
- name: Use NPM 8
22+
run: npm i -g npm@8
23+
- run: npm ci
24+
- name: build
25+
run: npm run build
26+
- name: test
27+
id: test
28+
if: ${{ always() }}
29+
run: npm run test
30+
- name: lint
31+
if: ${{ always() }}
32+
run: npm run lint
33+
- name: style
34+
if: ${{ always() }}
35+
run: npm run format:check
36+
37+
codecov: # Send only a single coverage report per run
38+
needs: build
39+
timeout-minutes: 15
40+
env:
41+
CI: true
42+
runs-on: ubuntu-latest
43+
steps:
44+
- uses: actions/checkout@v2
45+
- name: Use Node.js lts
46+
uses: actions/setup-node@v2
47+
with:
48+
node-version: lts/*
49+
cache: npm
50+
- run: npm ci
51+
- name: test
52+
run: npm run test -- --coverage
53+
- name: codecov
54+
uses: codecov/codecov-action@v2

.github/workflows/release.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: release
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
version:
6+
type: choice
7+
description: Version number to increment
8+
required: true
9+
options:
10+
- patch
11+
- minor
12+
- major
13+
14+
jobs:
15+
release:
16+
env:
17+
CI: true
18+
GITHUB_TOKEN: ${{ secrets.ACTION_GITHUB_TOKEN }}
19+
NPM_OTP_TOKEN: ${{ github.event.inputs.otp }}
20+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
21+
runs-on: ubuntu-latest
22+
steps:
23+
- uses: actions/checkout@v2
24+
with:
25+
fetch-depth: 0 # Need history for changelog generation
26+
- name: Use Node.js lts
27+
uses: actions/setup-node@v2
28+
with:
29+
node-version: lts/*
30+
registry-url: https://registry.npmjs.org
31+
- run: npm ci
32+
- name: build
33+
run: npm run build
34+
- name: test
35+
id: test
36+
if: ${{ always() }}
37+
run: npm run test -- --coverage
38+
- name: lint
39+
if: ${{ always() }}
40+
run: npm run lint
41+
- name: style
42+
if: ${{ always() }}
43+
run: npm run format:check
44+
- name: npm auth
45+
run: npm set "//registry.npmjs.org/:_authToken" ${{ env.NPM_TOKEN }}
46+
- name: config git user
47+
run: |
48+
git config --global user.name ${{ secrets.ACTION_GITHUB_USERNAME }};
49+
git config --global user.email ${{ secrets.ACTION_GITHUB_EMAIL }};
50+
- name: perform release
51+
run: |
52+
npm run release -- \
53+
${{ github.event.inputs.version }} \
54+
--ci
55+
- name: codecov # Perform after version publishing
56+
if: steps.test.outcome == 'success'
57+
uses: codecov/codecov-action@v2

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
coverage
2+
dist
3+
node_modules
4+
5+
# Test output
6+
output

.prettierignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
coverage
2+
dist
3+
output

.release-it.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"git": {
3+
"changelog": "npx auto-changelog --stdout --commit-limit false --unreleased --template https://raw.githubusercontent.com/release-it/release-it/master/templates/changelog-compact.hbs"
4+
},
5+
"github": {
6+
"release": true
7+
},
8+
"hooks": {
9+
"after:bump": "npx auto-changelog -p"
10+
}
11+
}

.vscode/extensions.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"recommendations": [
3+
"editorconfig.editorconfig",
4+
"dbaeumer.vscode-eslint",
5+
"esbenp.prettier-vscode"
6+
]
7+
}

LICENCE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2021 Alex Miller <codex.nz@gmail.com>
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)