Skip to content

Commit 7eda62d

Browse files
committed
Initial commit
0 parents  commit 7eda62d

19 files changed

+22613
-0
lines changed

.codeclimate.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
version: "2"
2+
checks:
3+
argument-count:
4+
config:
5+
threshold: 6
6+
complex-logic:
7+
config:
8+
threshold: 10
9+
file-lines:
10+
config:
11+
threshold: 500
12+
method-complexity:
13+
config:
14+
threshold: 10
15+
method-count:
16+
config:
17+
threshold: 30
18+
method-lines:
19+
config:
20+
threshold: 25
21+
nested-control-flow:
22+
config:
23+
threshold: 4
24+
return-statements:
25+
config:
26+
threshold: 4
27+
similar-code:
28+
config:
29+
threshold: 100
30+
identical-code:
31+
config:
32+
threshold: 75
33+
plugins:
34+
fixme:
35+
enabled: true
36+
config:
37+
strings:
38+
- FIXME
39+
- XXX
40+
- BUG
41+
- TODO
42+
git-legal:
43+
enabled: true
44+
nodesecurity:
45+
enabled: true
46+
47+
exclude_patterns:
48+
- "**/dist/"
49+
- "**/node_modules/"
50+
- "**/test/"
51+
- "**/*.d.ts"
52+
- ".mailmap"
53+
- "**/*.md"
54+
- "**/*polyfill*"
55+
- "*conf*"
56+
- "**/_*"
57+
- "example/"
58+
- "gulpfile*"

.commitlint.config.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": ["@commitlint/config-conventional"]
3+
}

.eslintrc.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"$schema": "http://json.schemastore.org/eslintrc",
3+
"root": true,
4+
"parser": "@typescript-eslint/parser",
5+
"plugins": ["@typescript-eslint"],
6+
"env": {
7+
"node": true
8+
},
9+
"extends": [
10+
"eslint:recommended",
11+
"plugin:@typescript-eslint/eslint-recommended",
12+
"plugin:@typescript-eslint/recommended",
13+
"plugin:prettier/recommended"
14+
],
15+
"rules": {
16+
"no-console": "error",
17+
"no-debugger": "error",
18+
"@typescript-eslint/no-explicit-any": "off",
19+
"@typescript-eslint/explicit-function-return-type": "off",
20+
"@typescript-eslint/no-non-null-assertion": "off",
21+
"@typescript-eslint/no-use-before-define": "off"
22+
},
23+
"overrides": [
24+
{
25+
"files": ["**/test/unit/**/*.spec.{j,t}s?(x)"],
26+
"env": { "jest": true }
27+
}
28+
]
29+
}

.gitignore

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Operating Systems
2+
.DS_Store
3+
**/Thumbs.db
4+
5+
# NPM
6+
node_modules
7+
npm-debug.log*
8+
yarn-debug.log*
9+
yarn-error.log*
10+
11+
# Build Targets
12+
/dist
13+
14+
# Temporary files
15+
/api-extractor.json
16+
17+
# Local env files
18+
.env.local
19+
.env.*.local
20+
21+
# Editor directories and files
22+
.idea
23+
.vscode
24+
*.suo
25+
*.ntvs*
26+
*.njsproj
27+
*.sln
28+
*.sw?
29+
30+
# Jest test coverage
31+
/coverage

.prettierrc.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"$schema": "http://json.schemastore.org/prettierrc",
3+
"printWidth": 140,
4+
"endOfLine": "lf"
5+
}

.travis.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
os: linux
2+
language: node_js
3+
cache: npm
4+
5+
jobs:
6+
include:
7+
- stage: release
8+
node_js: lts/*
9+
before_script:
10+
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
11+
- chmod +x ./cc-test-reporter
12+
- ./cc-test-reporter before-build
13+
script:
14+
- npm install
15+
- npm run build
16+
- npm run lint
17+
- npm run test
18+
after_script:
19+
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
20+
deploy:
21+
provider: script
22+
cleanup: false
23+
skip_cleanup: true
24+
script: npx semantic-release

LICENSE.md

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) 2019 Propero
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.

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# ts-library-template
2+
Template for Typescript Libraries

build/api-extractor.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3+
"projectFolder": ".",
4+
"mainEntryPointFilePath": "<projectFolder>/<%= types %>",
5+
"bundledPackages": [],
6+
"compiler": { "tsconfigFilePath": "<projectFolder>/tsconfig.json" },
7+
"dtsRollup": { "enabled": false, "untrimmedFilePath": "<projectFolder>/<%= types %>" },
8+
"apiReport": { "enabled": true, "reportFileName": "<%= name %>.api.md", "reportFolder": "<projectFolder>/dist" },
9+
"docModel": { "enabled": true, "apiJsonFilePath": "<projectFolder>/dist/<%= name %>.api.json" },
10+
"tsdocMetadata": { "enabled": false },
11+
"messages": {
12+
"compilerMessageReporting": { "default": { "logLevel": "error" } },
13+
"extractorMessageReporting": { "default": { "logLevel": "none" } },
14+
"tsdocMessageReporting": { "default": { "logLevel": "none" } }
15+
}
16+
}

jest.config.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
const tsconfig = require("./tsconfig.json");
2+
const { escapeRegExp, entries, fromPairs } = require("lodash");
3+
const { paths } = tsconfig.compilerOptions;
4+
5+
const keyToRegexp = key => `^${escapeRegExp(key).replace("\\*", "(.*)")}$`;
6+
const valueToPathMatcher = ([value]) => value.replace("*", "$1").replace("./", "<rootDir>/");
7+
const entryMapper = ([key, value]) => [keyToRegexp(key), valueToPathMatcher(value)];
8+
const moduleNameMapper = fromPairs(entries(paths).map(entryMapper));
9+
10+
module.exports = {
11+
preset: "jest-preset-typescript",
12+
collectCoverage: true,
13+
collectCoverageFrom: ["src/**/*.ts", "!**/node_modules/**", "!**.html"],
14+
coverageReporters: ["lcovonly"],
15+
moduleNameMapper
16+
};

0 commit comments

Comments
 (0)