Skip to content

Commit 03903bf

Browse files
committed
feat: initial version
0 parents  commit 03903bf

22 files changed

+12273
-0
lines changed

.editorconfig

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Editor Config - generated by Confit. This file will NOT be re-overwritten by Confit
2+
# Feel free to customise it further.
3+
# http://editorconfig.org
4+
root = true
5+
6+
[*]
7+
indent_style = space
8+
indent_size = 2
9+
charset = utf-8
10+
trim_trailing_whitespace = true
11+
insert_final_newline = true
12+
13+
[*.md]
14+
trim_trailing_whitespace = false

.eslintignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Common folders to ignore
2+
node_modules/*
3+

.eslintrc.js

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
module.exports = {
2+
root: true,
3+
parserOptions: {
4+
ecmaVersion: 2016,
5+
sourceType: 'script',
6+
},
7+
8+
env: {
9+
es6: true,
10+
'jest/globals': true,
11+
},
12+
13+
extends: [
14+
'plugin:prettier/recommended',
15+
'plugin:unicorn/recommended',
16+
'plugin:node/recommended-script',
17+
'plugin:jest/recommended',
18+
],
19+
plugins: ['jest'],
20+
rules: {
21+
// Allow some flexibility here
22+
'unicorn/prevent-abbreviations': 'off',
23+
24+
// Use camelCase for files (and directories - not enforced)
25+
'unicorn/filename-case': ['error', { case: 'camelCase' }],
26+
27+
// Turn off explicit length checks
28+
'unicorn/explicit-length-check': 'off',
29+
30+
// Because we support Node 10, turn off this rule:
31+
'unicorn/prefer-module': 'off',
32+
33+
// Turning off because it leads to many uses of the word 'error' in the same block, which is confusing
34+
// E.g.
35+
// } catch(error) {
36+
// logger.error(error);
37+
// return error(error);
38+
// }
39+
'unicorn/catch-error-name': 'off',
40+
41+
// This rule is no good for test specs. Need to find a way to disable this for test specs
42+
'unicorn/consistent-function-scoping': 'off',
43+
44+
// This rule is breaking at the moment due to ES module support lacking
45+
'node/no-unsupported-features/es-syntax': 'off',
46+
47+
// Jest does not support the node:protocol, yet
48+
'unicorn/prefer-node-protocol': 'off',
49+
},
50+
};

.github/workflows/codeql-analysis.yml

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
#
7+
# ******** NOTE ********
8+
# We have attempted to detect the languages in your repository. Please check
9+
# the `language` matrix defined below to confirm you have the correct set of
10+
# supported CodeQL languages.
11+
#
12+
name: "CodeQL"
13+
14+
on:
15+
push:
16+
branches: [ master ]
17+
pull_request:
18+
# The branches below must be a subset of the branches above
19+
branches: [ master ]
20+
schedule:
21+
- cron: '40 0 * * 1'
22+
23+
jobs:
24+
analyze:
25+
name: Analyze
26+
runs-on: ubuntu-latest
27+
permissions:
28+
actions: read
29+
contents: read
30+
security-events: write
31+
32+
strategy:
33+
fail-fast: false
34+
matrix:
35+
language: [ 'javascript' ]
36+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
37+
# Learn more:
38+
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
39+
40+
steps:
41+
- name: Checkout repository
42+
uses: actions/checkout@v2
43+
44+
# Initializes the CodeQL tools for scanning.
45+
- name: Initialize CodeQL
46+
uses: github/codeql-action/init@v1
47+
with:
48+
languages: ${{ matrix.language }}
49+
# If you wish to specify custom queries, you can do so here or in a config file.
50+
# By default, queries listed here will override any specified in a config file.
51+
# Prefix the list here with "+" to use these queries and those in the config file.
52+
# queries: ./path/to/local/query, your-org/your-repo/queries@main
53+
54+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
55+
# If this step fails, then you should remove it and run the build manually (see below)
56+
- name: Autobuild
57+
uses: github/codeql-action/autobuild@v1
58+
59+
# ℹ️ Command-line programs to run using the OS shell.
60+
# 📚 https://git.io/JvXDl
61+
62+
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
63+
# and modify them (or add more) to build your code if your project
64+
# uses a compiled language
65+
66+
#- run: |
67+
# make bootstrap
68+
# make release
69+
70+
- name: Perform CodeQL Analysis
71+
uses: github/codeql-action/analyze@v1

.github/workflows/npm-publish.yml

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages
3+
4+
name: Node.js Package
5+
6+
on:
7+
pull_request:
8+
push:
9+
branches: [ master ]
10+
11+
jobs:
12+
test:
13+
runs-on: ubuntu-latest
14+
strategy:
15+
matrix:
16+
# Run the steps below with the following versions of Node.js
17+
node-version: [ 10.x, 16.x ]
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v2
21+
- name: Use Node.js ${{ matrix.node-version }}
22+
uses: actions/setup-node@v2
23+
with:
24+
node-version: ${{ matrix.node-version }}
25+
- name: Install
26+
run: npm ci
27+
#- name: List Env vars
28+
# run: env
29+
- name: Test
30+
run: npm run test:coverage
31+
- name: Lint
32+
run: npm run verify
33+
- name: Coveralls
34+
uses: coverallsapp/github-action@master
35+
with:
36+
github-token: ${{ secrets.GITHUB_TOKEN }}
37+
path-to-lcov: ./reports/coverage/lcov.info
38+
parallel: true
39+
40+
test-finished:
41+
needs: [ test ]
42+
runs-on: ubuntu-latest
43+
steps:
44+
- name: Coveralls Finished
45+
uses: coverallsapp/github-action@master
46+
with:
47+
github-token: ${{ secrets.github_token }}
48+
parallel-finished: true
49+
50+
release:
51+
# Only release on push to master
52+
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
53+
runs-on: ubuntu-latest
54+
# Waits for test jobs for each Node.js version to complete
55+
needs: [ test ]
56+
steps:
57+
- name: Checkout
58+
uses: actions/checkout@v2
59+
60+
- name: Setup Node.js
61+
uses: actions/setup-node@v2
62+
with:
63+
node-version: 14.x
64+
- name: Install
65+
run: npm ci
66+
- name: Release
67+
run: npx semantic-release
68+
env:
69+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
70+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
71+

.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.nyc_output/
2+
node_modules/
3+
4+
reports/
5+
/.semverDetails

.husky/pre-push

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
npm run pre-push

.npmignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
src/*.spec.js

.npmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
save-exact=true

.nvmrc

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

.prettierrc

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"singleQuote": true,
3+
"trailingComma": "all",
4+
"printWidth": 100,
5+
"tabWidth": 2,
6+
"semi": true
7+
}

0 commit comments

Comments
 (0)