Skip to content

Commit d3d8a30

Browse files
committed
Initial project setup
1 parent 3bc5de5 commit d3d8a30

File tree

10 files changed

+7491
-0
lines changed

10 files changed

+7491
-0
lines changed

.circleci/config.yml

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
# reusable config stanzas
2+
only-release-tags: &only-release-tags
3+
filters:
4+
tags:
5+
only: /v[0-9]+\.[0-9]+\.[0-9]+.*/
6+
branches:
7+
ignore: /.*/
8+
9+
# start of config
10+
version: 2.1
11+
12+
executors:
13+
nodejs:
14+
docker:
15+
- image: circleci/node:12
16+
working_directory: ~/repo
17+
18+
jobs:
19+
install:
20+
executor: nodejs
21+
steps:
22+
- checkout
23+
- run:
24+
name: Configuring NPM authentication
25+
command: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" >> ~/.npmrc
26+
- restore_cache:
27+
keys:
28+
- v1-dependencies-{{ checksum "package.json" }}
29+
# fallback to using the latest cache if no exact match is found
30+
- v1-dependencies-
31+
- run: npm install
32+
- save_cache:
33+
paths:
34+
- node_modules
35+
key: v1-dependencies-{{ checksum "package.json" }}
36+
- persist_to_workspace:
37+
root: ~/repo
38+
paths:
39+
- ./
40+
lint:
41+
executor: nodejs
42+
steps:
43+
- attach_workspace:
44+
at: ~/repo
45+
- run: npm run lint
46+
test:
47+
executor: nodejs
48+
steps:
49+
- attach_workspace:
50+
at: ~/repo
51+
- run: npm test
52+
build:
53+
executor: nodejs
54+
steps:
55+
- attach_workspace:
56+
at: ~/repo
57+
- run: npm run build
58+
- persist_to_workspace:
59+
root: ~/repo
60+
paths:
61+
- ./
62+
publish:
63+
executor: nodejs
64+
steps:
65+
- attach_workspace:
66+
at: ~/repo
67+
- run:
68+
name: Configuring NPM authentication
69+
command: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN_PUBLISHING}" >> ~/.npmrc
70+
- run: cp package.json README* dist/
71+
- run: npm publish dist
72+
73+
workflows:
74+
version: 2
75+
76+
Test:
77+
jobs:
78+
- install
79+
- lint:
80+
requires:
81+
- install
82+
- test:
83+
requires:
84+
- install
85+
- build:
86+
requires:
87+
- install
88+
89+
Release:
90+
jobs:
91+
- install:
92+
<<: *only-release-tags
93+
- lint:
94+
<<: *only-release-tags
95+
requires:
96+
- install
97+
- test:
98+
<<: *only-release-tags
99+
requires:
100+
- install
101+
- build:
102+
<<: *only-release-tags
103+
requires:
104+
- install
105+
- publish:
106+
<<: *only-release-tags
107+
requires:
108+
- lint
109+
- test
110+
- build

.editorconfig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# editorconfig.org
2+
root = true
3+
4+
[*]
5+
indent_size = 2
6+
indent_style = space
7+
end_of_line = lf
8+
charset = utf-8
9+
trim_trailing_whitespace = true
10+
insert_final_newline = true
11+
12+
[*.md]
13+
trim_trailing_whitespace = false

.eslintrc.js

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
module.exports = {
2+
root: true,
3+
env: {
4+
node: true,
5+
},
6+
parserOptions: {
7+
parser: '@typescript-eslint/parser',
8+
},
9+
extends: [
10+
'plugin:@typescript-eslint/recommended',
11+
'plugin:prettier/recommended',
12+
'prettier',
13+
],
14+
plugins: [
15+
'@typescript-eslint',
16+
'prettier',
17+
],
18+
// add your custom rules here
19+
rules: {
20+
semi: ['error', 'always'],
21+
'comma-dangle': ['error', 'always-multiline'],
22+
'arrow-parens': [
23+
'error',
24+
'as-needed',
25+
{
26+
requireForBlockBody: false,
27+
},
28+
],
29+
'object-curly-newline': [
30+
'error',
31+
{
32+
ObjectExpression: { minProperties: 2, consistent: true },
33+
ObjectPattern: { minProperties: 5, consistent: true },
34+
ImportDeclaration: { consistent: true },
35+
ExportDeclaration: { consistent: true },
36+
},
37+
],
38+
'no-multiple-empty-lines': [
39+
'error',
40+
{
41+
max: 1,
42+
maxEOF: 0,
43+
maxBOF: 0,
44+
},
45+
],
46+
indent: 'off',
47+
'@typescript-eslint/indent': 'off',
48+
'@typescript-eslint/no-explicit-any': 'off',
49+
'@typescript-eslint/no-inferrable-types': 'off',
50+
'no-useless-constructor': 'off',
51+
'@typescript-eslint/no-useless-constructor': 'off',
52+
'@typescript-eslint/no-parameter-properties': 'off',
53+
'@typescript-eslint/consistent-type-assertions': [
54+
'error',
55+
{
56+
assertionStyle: 'as',
57+
objectLiteralTypeAssertions: 'allow-as-parameter',
58+
},
59+
],
60+
'@typescript-eslint/no-unused-vars': [
61+
'warn',
62+
{
63+
argsIgnorePattern: '^_',
64+
},
65+
],
66+
'@typescript-eslint/explicit-function-return-type': [
67+
'warn',
68+
{
69+
allowExpressions: true,
70+
},
71+
],
72+
},
73+
overrides: [
74+
{
75+
files: ['*.js'],
76+
rules: {
77+
'@typescript-eslint/no-var-requires': 'off',
78+
'@typescript-eslint/explicit-function-return-type': 'off',
79+
},
80+
},
81+
{
82+
files: ['*.ts'],
83+
rules: {
84+
// allow TypeScript method signature overloading, see https://github.com/typescript-eslint/typescript-eslint/issues/291
85+
'no-dupe-class-members': 'off',
86+
},
87+
},
88+
],
89+
};

.gitignore

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Build files
2+
dist/
3+
4+
# Include some configs
5+
!*.config.js
6+
!.eslintrc.js
7+
8+
# Node modules
9+
node_modules
10+
11+
# Temporary files
12+
tmp
13+
14+
# When npm runs error it write logs to the below file
15+
npm-debug.log
16+
17+
# IDE
18+
.idea
19+
20+
# Operating System files
21+
.DS_Store

.prettierrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"singleQuote": true,
3+
"trailingComma": "all",
4+
"printWidth": 120
5+
}

jest.config.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
const { pathsToModuleNameMapper } = require('ts-jest/utils');
2+
const { compilerOptions } = require('./tsconfig');
3+
4+
module.exports = {
5+
preset: 'ts-jest',
6+
testEnvironment: 'node',
7+
moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths),
8+
};

0 commit comments

Comments
 (0)