-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactored the project to match other TS projects:
- Set up editorconfig, linting, prettier rules - Renamed folders to match other projects - Changed unit testing stack from mocha/chai to jest - Added github actions for npm publishing and CI - Fixed linting errors - Other various minor changes
- Loading branch information
Andrew Bird
committed
Mar 31, 2021
1 parent
a0732a4
commit 6345883
Showing
51 changed files
with
6,275 additions
and
5,287 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
insert_final_newline = true | ||
indent_size = 2 | ||
indent_style = space |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
dist | ||
node_modules | ||
coverage | ||
.eslintrc.js | ||
generated |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
module.exports = { | ||
root: true, | ||
parser: "@typescript-eslint/parser", | ||
parserOptions: { | ||
tsconfigRootDir: __dirname, | ||
project: ["./tsconfig.json"], | ||
}, | ||
plugins: ["@typescript-eslint", "eslint-comments", "jest", "promise"], | ||
extends: [ | ||
"airbnb-typescript/base", | ||
"plugin:@typescript-eslint/recommended", | ||
"plugin:eslint-comments/recommended", | ||
"plugin:jest/recommended", | ||
"plugin:promise/recommended", | ||
"prettier", | ||
"plugin:@typescript-eslint/recommended-requiring-type-checking", | ||
], | ||
env: { | ||
node: true, | ||
browser: true, | ||
jest: true, | ||
}, | ||
rules: { | ||
// note you must disable the base rule as it can report incorrect errors | ||
"quotes": ["error", "double"], | ||
"no-unused-vars": "off", | ||
"@typescript-eslint/no-unused-vars": ["error"], | ||
"no-underscore-dangle": "off", | ||
"lines-between-class-members": ["warn", "always"], | ||
"@typescript-eslint/explicit-function-return-type": ["error"], | ||
"@typescript-eslint/naming-convention": [ | ||
"error", | ||
{ selector: "typeLike", format: ["PascalCase"] }, | ||
{ selector: "enumMember", format: ["PascalCase"] }, | ||
{ selector: "variableLike", format: ["camelCase"] }, | ||
{ | ||
selector: "interface", | ||
format: ["PascalCase"], | ||
custom: { | ||
regex: "^I[A-Z]", | ||
match: false, | ||
}, | ||
}, | ||
{ | ||
selector: "typeAlias", | ||
format: ["PascalCase"], | ||
custom: { | ||
regex: "^I[A-Z]", | ||
match: false, | ||
}, | ||
}, | ||
], | ||
"class-methods-use-this": "off", | ||
"jest/no-conditional-expect": "off" | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Code owners: | ||
* @greenemcg @AndrewBird81 @adongare @jkotanchik-SB @serhii-ilin @RohitKandimalla |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
name: npm-publish | ||
on: | ||
push: | ||
branches: | ||
- main | ||
jobs: | ||
npm-publish: | ||
name: npm-publish | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Use Node.js 14.x | ||
uses: actions/setup-node@v2-beta | ||
with: | ||
node-version: 14.x | ||
|
||
- name: Cache node modules | ||
uses: actions/cache@v2 | ||
env: | ||
cache-name: cache-node-modules | ||
with: | ||
path: ~/.npm | ||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | ||
restore-keys: | | ||
${{ runner.os }}-build-${{ env.cache-name }}- | ||
${{ runner.os }}-build- | ||
${{ runner.os }}- | ||
- name: Install node dependencies | ||
run: npm ci | ||
|
||
- name: Audit dependencies for security vulnerabilities | ||
run: npm audit | ||
|
||
- name: Lint the source code | ||
run: npm run-script lint | ||
|
||
- name: Build the source code | ||
run: npm run build | ||
|
||
- name: Execute test coverage | ||
run: npm run-script coverage | ||
|
||
- name: Publish if version has been updated | ||
uses: pascalgn/npm-publish-action@master | ||
with: # All of theses inputs are optional | ||
tag_name: "v%s" | ||
tag_message: "v%s" | ||
commit_pattern: "[\\s\\S]*Release (\\S+)" | ||
env: # More info about the environment variables in the README | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Leave this as is, it's automatically generated | ||
NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
# This workflow will do the following: | ||
# - perform a clean install of node dependencies | ||
# - lint the source code for errors | ||
# - build the source code | ||
# - run tests and capture code coverage | ||
# - upload the code coverage report to Codacy | ||
# - upload the code coverage report to Codecov | ||
|
||
name: Continuous Integration | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
|
||
jobs: | ||
build: | ||
name: Checkout, install, lint, build and test with coverage | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Use Node.js 14.x | ||
uses: actions/setup-node@v2-beta | ||
with: | ||
node-version: 14.x | ||
|
||
- name: Cache node modules | ||
uses: actions/cache@v2 | ||
env: | ||
cache-name: cache-node-modules | ||
with: | ||
path: ~/.npm | ||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | ||
restore-keys: | | ||
${{ runner.os }}-build-${{ env.cache-name }}- | ||
${{ runner.os }}-build- | ||
${{ runner.os }}- | ||
- name: Install node dependencies | ||
run: npm ci | ||
|
||
- name: Audit dependencies for security vulnerabilities | ||
run: npm audit | ||
|
||
- name: Lint the source code | ||
run: npm run-script lint | ||
|
||
- name: Build the source code | ||
run: npm run build | ||
|
||
- name: Execute test coverage | ||
run: npm run-script coverage | ||
|
||
- name: Upload code coverage to Codecov | ||
uses: codecov/codecov-action@v1 | ||
with: | ||
file: coverage/lcov.info | ||
fail_ci_if_error: true # optional (default = false) | ||
# flags: unittests # optional | ||
# name: codecov-umbrella # optional | ||
|
||
- name: Store the coverage report as an artifact | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: coverage | ||
path: coverage/lcov.info | ||
|
||
upload-codacy-coverage: | ||
name: Upload code coverage to Codacy | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Download coverage artifact | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: coverage | ||
|
||
- name: Upload code coverage to Codacy | ||
uses: codacy/codacy-coverage-reporter-action@master | ||
with: | ||
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} | ||
coverage-reports: lcov.info |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
node_modules | ||
dist | ||
coverage | ||
generated |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<module type="WEB_MODULE" version="4"> | ||
<component name="NewModuleRootManager" inherit-compiler-output="true"> | ||
<exclude-output /> | ||
<content url="file://$MODULE_DIR$"> | ||
<excludeFolder url="file://$MODULE_DIR$/dist" /> | ||
</content> | ||
<orderEntry type="inheritedJdk" /> | ||
<orderEntry type="sourceFolder" forTests="false" /> | ||
</component> | ||
</module> |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.