-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from ty-ras/issue/2-add-code
Issue/2 add code
- Loading branch information
Showing
22 changed files
with
4,807 additions
and
1 deletion.
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
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,16 @@ | ||
{ | ||
"all": true, | ||
"include": [ | ||
"src/**/*.ts" | ||
], | ||
"exclude": [ | ||
"src/**/__test__/**/*.*", | ||
"**/*.d.ts", | ||
"**/*.types.ts", | ||
"src/index.ts" | ||
], | ||
"reporter": [ | ||
"text", | ||
"json" | ||
] | ||
} |
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,61 @@ | ||
// ESLint config for formatting the <project name>/src/**/*.ts files. | ||
module.exports = { | ||
root: true, | ||
extends: [ | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/recommended", | ||
"plugin:@typescript-eslint/eslint-recommended", | ||
"plugin:@typescript-eslint/recommended-requiring-type-checking", | ||
"plugin:type-only-import/recommended", | ||
"plugin:jsdoc/recommended-typescript-error", | ||
"plugin:prettier/recommended", | ||
"plugin:sonarjs/recommended" | ||
], | ||
plugins: [ | ||
"type-only-import", | ||
"jsdoc", | ||
"prettier" | ||
], | ||
parser: "@typescript-eslint/parser", | ||
parserOptions: { | ||
project: "./tsconfig.json", | ||
sourceType: "module", | ||
ecmaVersion: "latest", | ||
tsconfigRootDir: __dirname, | ||
}, | ||
rules: { | ||
"prettier/prettier": "error", | ||
//"function-paren-newline": ["error", "always"], | ||
"@typescript-eslint/explicit-module-boundary-types": "off", // IDE will show the return types | ||
"@typescript-eslint/restrict-template-expressions": "off", // We are OK with whatever type within template expressions | ||
"@typescript-eslint/unbound-method": "off", // We never use 'this' within functions anyways. | ||
"@typescript-eslint/no-empty-function": "off", // Empty functions are ok sometimes. | ||
"no-useless-return": "error", | ||
"no-console": "error", | ||
"sonarjs/no-nested-template-literals": "off", // Nested template literals are OK really | ||
"jsdoc/require-file-overview": "error", | ||
"jsdoc/require-jsdoc": [ | ||
"error", | ||
{ | ||
"publicOnly": true, | ||
"require": { | ||
"ArrowFunctionExpression": true, | ||
"ClassDeclaration": true, | ||
"ClassExpression": true, | ||
"FunctionDeclaration": true, | ||
"FunctionExpression": true, | ||
"MethodDefinition": true | ||
}, | ||
"exemptEmptyConstructors": true, | ||
"exemptEmptyFunctions": false, | ||
"enableFixer": false, | ||
"contexts": [ | ||
"TSInterfaceDeclaration", | ||
"TSTypeAliasDeclaration", | ||
"TSMethodSignature", | ||
"TSPropertySignature" | ||
] | ||
} | ||
] | ||
} | ||
}; |
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,17 @@ | ||
// ESLint config for formatting the resulting .d.ts files (<project name>/dist-ts/**/*.d.ts) that end up in NPM package for typing information. | ||
const { extends: extendsArray, plugins, rules } = require("./.eslintrc.cjs"); | ||
module.exports = { | ||
root: true, | ||
extends: extendsArray.filter((ext) => ext.startsWith("plugin:jsdoc/") || ext.startsWith("plugin:prettier/")), | ||
plugins: plugins.filter((plugin) => plugin === "jsdoc" || plugin === "prettier"), | ||
parser: "@typescript-eslint/parser", | ||
parserOptions: { | ||
project: "./tsconfig.out.json", | ||
sourceType: "module", | ||
ecmaVersion: "latest", | ||
tsconfigRootDir: __dirname, | ||
}, | ||
rules: Object.fromEntries(Object.entries(rules).filter(([ruleKey]) => ruleKey.startsWith("jsdoc/") || ruleKey.startsWith("prettier/"))), | ||
// So we won't get errors on comments disable e.g. @typescript-eslint/xyz rules. | ||
noInlineConfig: true, | ||
}; |
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,19 @@ | ||
// ESLint config for formatting the resulting .[m]js files (<project name>/dist-(cjs|mjs)/**/*.[m]js) that end up in NPM package. | ||
module.exports = { | ||
root: true, | ||
extends: [ | ||
"plugin:path-import-extension/recommended", | ||
"plugin:prettier/recommended", | ||
], | ||
plugins: [ | ||
"path-import-extension", | ||
"prettier" | ||
], | ||
parser: "@babel/eslint-parser", | ||
parserOptions: { | ||
requireConfigFile: false | ||
}, | ||
rules: { | ||
"prettier/prettier": "error", | ||
} | ||
}; |
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,7 @@ | ||
node_modules | ||
build | ||
dist* | ||
coverage | ||
*/.eslintrc*.cjs | ||
*/tsconfig*.json | ||
yarn-error.log |
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,6 @@ | ||
{ | ||
"printWidth": 80, | ||
"trailingComma": "all", | ||
"tabWidth": 2, | ||
"useTabs": false | ||
} |
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,18 @@ | ||
export default { | ||
cache: false, // We run Ava in non-coverage mode with 'ro' modifier for Docker volume | ||
extensions: { | ||
ts: "module" | ||
}, | ||
nodeArguments: [ | ||
"--loader=ts-node/esm", | ||
"--experimental-specifier-resolution=node", | ||
"--trace-warnings" | ||
], | ||
files: [ | ||
"**/__test__/*.spec.ts" | ||
], | ||
timeout: "10m", | ||
verbose: true, | ||
// The default is number of corse, which in CI I guess is 1 | ||
concurrency: 5 | ||
} |
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 @@ | ||
# Typesafe REST API Specification - Typesafe Client With Node HTTP1/2 Modules | ||
|
||
[![Coverage](https://codecov.io/gh/ty-ras/client-node/branch/main/graph/badge.svg?flag=client)](https://codecov.io/gh/ty-ras/client-node) | ||
|
||
This folder contains library which exposes a method to create callback implementing `CallHTTPEndpoint` from [`@ty-ras/data-frontent`](https://github.com/ty-ras/data) using Node [HTTP1](https://nodejs.org/api/http.html) or [HTTP2](https://nodejs.org/api/http2.html) modules. |
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,81 @@ | ||
{ | ||
"name": "@ty-ras/client-node", | ||
"version": "2.0.0", | ||
"author": { | ||
"name": "Stanislav Muhametsin", | ||
"email": "[email protected]", | ||
"url": "https://github.com/stazz" | ||
}, | ||
"description": "TyRAS library implementing type-based HTTP endpoint invocation using Node HTTP1 and HTTP2 modules.", | ||
"license": "MIT", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/ty-ras/client-fetch" | ||
}, | ||
"files": [ | ||
"./src", | ||
"./dist-ts", | ||
"./dist-esm", | ||
"./dist-cjs", | ||
"README.md", | ||
"LICENSE.txt" | ||
], | ||
"type": "module", | ||
"main": "./dist-cjs/index.js", | ||
"module": "./dist-esm/index.js", | ||
"types": "./dist-ts/index.d.ts", | ||
"exports": { | ||
".": { | ||
"types": "./dist-ts/index.d.ts", | ||
"import": "./dist-esm/index.js", | ||
"require": "./dist-cjs/index.js" | ||
} | ||
}, | ||
"dependencies": { | ||
"@ty-ras/data-frontend": "^2.0.1" | ||
}, | ||
"devDependencies": { | ||
"@ava/get-port": "2.0.0", | ||
"@babel/core": "7.22.11", | ||
"@babel/eslint-parser": "7.22.11", | ||
"@typescript-eslint/eslint-plugin": "6.5.0", | ||
"@typescript-eslint/parser": "6.5.0", | ||
"@types/node": "18.16.3", | ||
"ava": "5.3.1", | ||
"c8": "8.0.1", | ||
"eslint": "8.48.0", | ||
"eslint-plugin-jsdoc": "46.5.0", | ||
"eslint-plugin-path-import-extension": "0.9.0", | ||
"eslint-plugin-type-only-import": "0.9.0", | ||
"eslint-config-prettier": "9.0.0", | ||
"eslint-plugin-prettier": "5.0.0", | ||
"eslint-plugin-sonarjs": "0.21.0", | ||
"madge": "6.1.0", | ||
"prettier": "3.0.2", | ||
"ts-node": "10.9.1", | ||
"typescript": "5.1.6" | ||
}, | ||
"scripts": { | ||
"build:run": "yarn run lint && yarn run tsc", | ||
"build:ci": "yarn run clear-build-artifacts && yarn run compile-d-ts-files && yarn run tsc --outDir ./dist-esm && yarn run tsc --module CommonJS --outDir ./dist-cjs && yarn run remove-empty-js-files && yarn run generate-stub-package-json-for-cjs && yarn run format-output-files", | ||
"clear-build-artifacts": "rm -rf dist dist-ts dist-cjs dist-esm build", | ||
"compile-d-ts-files": "yarn run tsc --removeComments false --emitDeclarationOnly --declaration --declarationDir ./dist-ts && yarn run tsc:plain --project tsconfig.out.json", | ||
"format-output-files": "yarn run format-output-files-ts && yarn run format-output-files-js", | ||
"format-output-files-ts": "eslint --no-eslintrc --config '.eslintrc.out-ts.cjs' --fix --fix-type layout './dist-ts/**/*.ts'", | ||
"format-output-files-js": "eslint --no-eslintrc --config '.eslintrc.out.cjs' --fix 'dist-cjs/**/*js' 'dist-esm/**/*js'", | ||
"generate-stub-package-json-for-cjs": "../../scripts/generate-stub-package-json.cjs", | ||
"lint": "yarn run lint:eslint && yarn run lint:circular", | ||
"lint:circular": "madge --circular --no-color --no-spinner --extensions ts --warning ./src", | ||
"lint:eslint": "eslint ./src --ext .ts,.tsx", | ||
"remove-empty-js-files": "../../scripts/remove-empty-js-files.cjs", | ||
"tsc": "tsc --project tsconfig.build.json", | ||
"tsc:plain": "tsc", | ||
"test:coverage": "c8 --temp-directory /tmp ava", | ||
"test:run": "c8 --temp-directory /tmp --reporter text ava" | ||
}, | ||
"resolutions": { | ||
"dependency-tree": "10.0.9", | ||
"precinct": "11.0.5", | ||
"typescript": "5.1.6" | ||
} | ||
} |
Oops, something went wrong.