Skip to content

Commit

Permalink
feat: init grpc
Browse files Browse the repository at this point in the history
  • Loading branch information
askuzminov committed Sep 15, 2020
1 parent d3fd637 commit 38c7921
Show file tree
Hide file tree
Showing 188 changed files with 51,773 additions and 1 deletion.
273 changes: 273 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,273 @@
// https://github.com/typescript-eslint/typescript-eslint
// https://github.com/TristonJ/eslint-plugin-prefer-arrow
// https://github.com/sindresorhus/eslint-plugin-unicorn
// https://github.com/benmosher/eslint-plugin-import
// https://github.com/gajus/eslint-plugin-jsdoc

module.exports = {
env: {
browser: true,
node: true,
},
ignorePatterns: [
'.eslintrc.js',
'**/dist/**',
'**/node_modules/**',
'**/protobufjs/**',
'**/tests/proto/**',
'**/coverage/**',
],
extends: [
'eslint:recommended',
'plugin:import/errors',
'plugin:import/warnings',
'plugin:import/typescript',
'plugin:prettier/recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
'prettier',
],
parser: '@typescript-eslint/parser',
parserOptions: {
project: 'tsconfig.json',
sourceType: 'module',
},
plugins: ['@typescript-eslint', 'import', 'jsdoc', 'unicorn', 'prefer-arrow'],
settings: {
'import/resolver': {
node: {
extensions: ['.ts', '.tsx', '.json', '.js'],
moduleDirectory: ['public', 'node_modules'],
},
},
},
rules: {
'prettier/prettier': 'error',
'@typescript-eslint/adjacent-overload-signatures': 'error',
'@typescript-eslint/array-type': [
'error',
{
default: 'array',
},
],
'@typescript-eslint/ban-types': [
'error',
{
types: {
Object: {
message: 'Avoid using the `Object` type. Did you mean `object`?',
},
Function: {
message: 'Avoid using the `Function` type. Prefer a specific function type, like `() => void`.',
},
Boolean: {
message: 'Avoid using the `Boolean` type. Did you mean `boolean`?',
},
Number: {
message: 'Avoid using the `Number` type. Did you mean `number`?',
},
String: {
message: 'Avoid using the `String` type. Did you mean `string`?',
},
Symbol: {
message: 'Avoid using the `Symbol` type. Did you mean `symbol`?',
},
},
},
],
'@typescript-eslint/consistent-type-assertions': 'off',
'@typescript-eslint/dot-notation': 'error',
'@typescript-eslint/explicit-member-accessibility': [
'error',
{
accessibility: 'no-public',
},
],
'@typescript-eslint/indent': 'off',
'@typescript-eslint/member-delimiter-style': [
'error',
{
multiline: {
delimiter: 'semi',
requireLast: true,
},
singleline: {
delimiter: 'semi',
requireLast: false,
},
},
],
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-empty-interface': 'error',
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/no-misused-new': 'error',
'@typescript-eslint/no-namespace': 'error',
'@typescript-eslint/no-parameter-properties': 'off',
'@typescript-eslint/no-this-alias': 'error',
'@typescript-eslint/no-unused-expressions': [
'error',
{
allowShortCircuit: true,
},
],
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/no-var-requires': 'error',
'@typescript-eslint/prefer-for-of': 'error',
'@typescript-eslint/prefer-function-type': 'error',
'@typescript-eslint/prefer-namespace-keyword': 'error',
'@typescript-eslint/quotes': [
'error',
'single',
{
avoidEscape: true,
},
],
'@typescript-eslint/semi': ['error', 'always'],
'@typescript-eslint/strict-boolean-expressions': ['error', {}],
'@typescript-eslint/triple-slash-reference': [
'error',
{
path: 'always',
types: 'prefer-import',
lib: 'always',
},
],
'@typescript-eslint/type-annotation-spacing': 'off',
'@typescript-eslint/unified-signatures': 'error',
'@typescript-eslint/unbound-method': 'off',
'@typescript-eslint/no-unsafe-member-access': 'error',
'@typescript-eslint/no-unsafe-call': 'error',
'@typescript-eslint/no-unsafe-assignment': 'error',
'@typescript-eslint/no-unsafe-return': 'error',
'@typescript-eslint/restrict-template-expressions': 'error',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-unused-vars': ['off'],
'@typescript-eslint/no-for-in-array': ['off'],
'@typescript-eslint/no-floating-promises': ['error', { ignoreVoid: true, ignoreIIFE: true }],
'@typescript-eslint/no-misused-promises': 'error',
'arrow-parens': ['off', 'always'],
'brace-style': ['off', 'off'],
camelcase: 'warn',
'comma-dangle': 'off',
'no-unused-vars': 'off',
complexity: [
'warn',
{
max: 20,
},
],
'constructor-super': 'error',
'default-case': 'error',
'eol-last': 'off',
eqeqeq: ['error', 'smart'],
'guard-for-in': 'off',
'id-blacklist': [
'warn',
'any',
'Number',
'number',
'String',
'string',
'Boolean',
'boolean',
'Undefined',
'undefined',
],
'id-match': 'error',
'import/order': [
'error',
{
groups: [
['builtin', 'external'],
['internal', 'unknown', 'object'],
['parent', 'sibling', 'index'],
],
'newlines-between': 'always',
alphabetize: { order: 'asc', caseInsensitive: true },
},
],
'jsdoc/check-alignment': 'error',
'jsdoc/check-indentation': 'error',
'jsdoc/newline-after-description': 'error',
'linebreak-style': ['error', 'unix'],
'max-classes-per-file': ['error', 1],
'max-len': [
'error',
{
code: 120,
},
],
'new-parens': 'off',
'newline-per-chained-call': 'off',
'no-bitwise': 'off',
'no-caller': 'error',
'no-cond-assign': 'error',
'no-console': 'error',
'no-debugger': 'error',
'no-duplicate-case': 'error',
'no-duplicate-imports': 'error',
'no-empty': 'off',
'no-eval': 'error',
'no-extra-bind': 'error',
'no-extra-semi': 'off',
'no-fallthrough': 'error',
'no-invalid-this': 'off',
'no-irregular-whitespace': 'off',
'no-multiple-empty-lines': [
'error',
{
max: 1,
},
],
'no-new-func': 'error',
'no-new-wrappers': 'error',
'no-redeclare': 'error',
'no-return-await': 'error',
'no-sequences': 'error',
'no-shadow': [
'error',
{
hoist: 'all',
},
],
'no-sparse-arrays': 'error',
'no-template-curly-in-string': 'error',
'no-throw-literal': 'error',
'no-trailing-spaces': 'off',
'no-undef-init': 'error',
'no-underscore-dangle': 'error',
'no-unsafe-finally': 'error',
'no-unused-labels': 'error',
'no-constant-condition': ['error', { checkLoops: false }],
'no-var': 'error',
'object-shorthand': 'error',
'one-var': ['error', 'never'],
'prefer-arrow/prefer-arrow-functions': 'off',
'prefer-const': 'error',
'prefer-object-spread': 'error',
'prefer-template': 'error',
'quote-props': ['error', 'as-needed'],
radix: 'error',
'space-before-function-paren': [
'error',
{
anonymous: 'always',
asyncArrow: 'always',
named: 'never',
},
],
'space-in-parens': ['off', 'never'],
'spaced-comment': [
'error',
'always',
{
markers: ['/'],
},
],
'unicorn/filename-case': 'error',
'use-isnan': 'warn',
'valid-typeof': 'off',
'prefer-rest-params': 'warn',
'sort-imports': ['error', { ignoreDeclarationSort: true }],
},
};
60 changes: 60 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Release

on:
push:
branches: [master, feature/*]

jobs:
release:
name: Release
runs-on: ubuntu-18.04
if: "!contains(github.event.head_commit.message, 'skip ci')"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v2
with: { fetch-depth: 0 }
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 12
- name: Set Branch
id: branch
run: |
BNAME="$(echo -n ${GITHUB_REF##*/} | sed 's#/#-#g' | tr '[:upper:]' '[:lower:]')"
BID="$GITHUB_RUN_NUMBER-$(date +%s)"
echo ::set-env name=BRANCH_NAME::$BNAME
echo ::set-env name=APP_BUILD::$BID-$GITHUB_SHA
echo ::set-env name=BUILD_ID::$BID
- name: Setup GIT
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
mkdir -p ~/.ssh
ssh-keyscan github.com > ~/.ssh/known_hosts
- name: Setup NPM
run: |
echo "Setup NPM"
echo 'always-auth=true' > ~/.npmrc
echo '//registry.npmjs.org/:_authToken=${NPM_TOKEN}' >> ~/.npmrc
echo '//npm.pkg.github.com/:_authToken=${GH_TOKEN}' >> ~/.npmrc
- name: Install dependencies
run: npm ci
- name: Check
run: |
npm run check-types
npm run lint
npm run test
- name: Build
run: npm run build
- name: Release GITHUB
run: |
if [[ $BRANCH_NAME == 'master' ]]; then
echo "Release production"
npm run release publish-github publish-npmjs
else
echo "Release canary"
npm run release -- publish-github prerelease=$BRANCH_NAME.$BUILD_ID
fi
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
dist/
node_modules/
.DS_Store
!/**/.gitkeep
coverage/
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
save=true
save-exact=true
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
dist
tests/proto/
tests/protobufjs/
28 changes: 28 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"name": "jest",
"request": "launch",
"protocol": "inspector",
"program": "${workspaceFolder}/node_modules/jest/bin/jest",
"args": ["--runInBand", "--no-cache", "--coverage", "false"],
"cwd": "${workspaceFolder}",
"console": "integratedTerminal"
},
{
"type": "node",
"request": "launch",
"name": "jest watch",
"program": "${workspaceFolder}/node_modules/.bin/jest",
"args": ["--verbose", "-i", "--no-cache", "--watchAll", "--coverage", "false"],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"windows": {
"program": "${workspaceFolder}/node_modules/jest/bin/jest"
},
"cwd": "${fileDirname}"
}
]
}
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"typescript.tsdk": "node_modules/typescript/lib"
}

0 comments on commit 38c7921

Please sign in to comment.