From e8f57a69dcc48978073fce0f3cd7b56fcee4e278 Mon Sep 17 00:00:00 2001 From: chyzwar Date: Mon, 23 Oct 2023 09:55:31 +0200 Subject: [PATCH] chore(): added docs, update presets --- .gitignore | 7 +-- Readme.md | 2 +- lerna.json | 1 + packages/eslint-config/Readme.md | 24 ++++++++ packages/eslint-config/rules/typescript.js | 10 ++++ packages/runner/Readme.md | 64 +++++++++++++++++++++- packages/tsconfig/Readme.md | 24 ++++++++ packages/tsconfig/api.json | 4 +- packages/tsconfig/bundler.json | 1 + packages/tsconfig/lib.json | 1 + packages/tsconfig/react.json | 1 + 11 files changed, 129 insertions(+), 10 deletions(-) create mode 100644 packages/eslint-config/Readme.md create mode 100644 packages/tsconfig/Readme.md diff --git a/.gitignore b/.gitignore index 0aaff95..9d89479 100644 --- a/.gitignore +++ b/.gitignore @@ -4,9 +4,9 @@ node_modules .yarn/install-state.gz # testing -/coverage +coverage -# production +# build lib build buildInfo.json @@ -19,6 +19,3 @@ buildInfo.json npm-debug.log* yarn-debug.log* yarn-error.log* - -# Ignore build files -buildInfo.json \ No newline at end of file diff --git a/Readme.md b/Readme.md index feb7767..99a0f15 100644 --- a/Readme.md +++ b/Readme.md @@ -25,7 +25,7 @@ Extend preset: "src/**/*" ] } -`````` +``` ## @chyzwar/eslint-config diff --git a/lerna.json b/lerna.json index 7c36b77..8c81041 100644 --- a/lerna.json +++ b/lerna.json @@ -1,3 +1,4 @@ + { "workspaces": [ "packages/*", diff --git a/packages/eslint-config/Readme.md b/packages/eslint-config/Readme.md new file mode 100644 index 0000000..771ae1b --- /dev/null +++ b/packages/eslint-config/Readme.md @@ -0,0 +1,24 @@ +## @chyzwar/eslint-config + +Strict preset for eslint. Intention is to include plugin dependacies and make it easy manage configs in one place. It support number of sub-presets: + +- node +- react + +### Instalation + +``` +yarn add eslint @chyzwar/eslint-config +``` + +### Examples + +Example of usage in eslint.cjs +```js +module.exports = { + extends: "@hyper/eslint-config/node", + parserOptions: { + tsconfigRootDir: __dirname, + }, +}; +``` \ No newline at end of file diff --git a/packages/eslint-config/rules/typescript.js b/packages/eslint-config/rules/typescript.js index f6c5ce5..d6b782a 100644 --- a/packages/eslint-config/rules/typescript.js +++ b/packages/eslint-config/rules/typescript.js @@ -1,6 +1,16 @@ module.exports = { + /** + * @see https://typescript-eslint.io/rules/consistent-type-exports + */ + "@typescript-eslint/consistent-type-exports": "error", + + /** + * @see https://typescript-eslint.io/rules/consistent-type-imports + */ + "@typescript-eslint/consistent-type-imports": "error", + /** * Good rule but do not play nicely with Promises * @see https://github.com/typescript-eslint/typescript-eslint/issues/1956 diff --git a/packages/runner/Readme.md b/packages/runner/Readme.md index 86654a2..d8c0fb0 100644 --- a/packages/runner/Readme.md +++ b/packages/runner/Readme.md @@ -1,8 +1,68 @@ -# Runnner +## Runnner Simple task runner inspired by: - [just](https://github.com/microsoft/just) - [undertaker](https://github.com/gulpjs/undertaker) -## Examples +### Instalation + +yarn add @chyzwar/runner + +### Examples + +Example of config file runner.config.js +```js +import {spawnTask, dockerTask, parallelTask, seriesTask} from "@hyper/runner"; + +spawnTask("build:watch", + "yarn", ["build:watch"], +); + +spawnTask("start:ui", + "yarn", ["start"], + { + cwd: "./packages/ui" + } +); +spawnTask("build:ui", + "yarn", ["build"], + { + cwd: "./packages/ui" + } +); + +spawnTask("start:api", + "yarn", ["start"], + { + cwd: "./packages/api" + } +); +spawnTask("build:api", + "yarn", ["build"], + { + cwd: "./packages/api" + } +); + +dockerTask("postgres", "postgres", { + interactive: true, + rm: true, + name: "PostgresDB", + ports: [ + "5434:5432" + ], + env: { + POSTGRES_PASSWORD: "postgres", + }, +}); + + +seriesTask("start:prod", ["build:api", "build:ui", "start:api:prod"]) +parallelTask("start", [ + "build:watch", + "postgres", + "start:api", + "start:ui" +]) +``` \ No newline at end of file diff --git a/packages/tsconfig/Readme.md b/packages/tsconfig/Readme.md new file mode 100644 index 0000000..90bb178 --- /dev/null +++ b/packages/tsconfig/Readme.md @@ -0,0 +1,24 @@ +## @chyzwar/tsconfig + +### Instalation +``` +yarn add "@chyzwar/tsconfig +``` + +### Usage + +Extend preset: + +```json +{ + "extends": "@chyzwar/tsconfig/lib.json", + "compilerOptions": { + "outDir": "lib", + "rootDir": "src", + "tsBuildInfoFile": "./lib/buildInfo.json" + }, + "include": [ + "src/**/*" + ] +} +``` \ No newline at end of file diff --git a/packages/tsconfig/api.json b/packages/tsconfig/api.json index 83c670a..47f4e91 100644 --- a/packages/tsconfig/api.json +++ b/packages/tsconfig/api.json @@ -1,8 +1,8 @@ { "compileOnSave": true, "compilerOptions": { - "moduleResolution": "node16", - "module": "ES2022", + "moduleResolution": "Node16", + "module": "Node16", "target": "ES2022", "newLine": "lf", "jsx": "react", diff --git a/packages/tsconfig/bundler.json b/packages/tsconfig/bundler.json index 68c98bc..1544bac 100644 --- a/packages/tsconfig/bundler.json +++ b/packages/tsconfig/bundler.json @@ -14,6 +14,7 @@ "allowUnreachableCode": false, "strict": true, + "alwaysStrict": true, "noFallthroughCasesInSwitch": true, "noImplicitReturns": true, "noUnusedLocals": false, diff --git a/packages/tsconfig/lib.json b/packages/tsconfig/lib.json index d805a5f..03a12ba 100644 --- a/packages/tsconfig/lib.json +++ b/packages/tsconfig/lib.json @@ -14,6 +14,7 @@ "allowUnreachableCode": false, "strict": true, + "alwaysStrict": true, "noFallthroughCasesInSwitch": true, "noImplicitReturns": true, "noUnusedLocals": false, diff --git a/packages/tsconfig/react.json b/packages/tsconfig/react.json index ab19186..5204bf5 100644 --- a/packages/tsconfig/react.json +++ b/packages/tsconfig/react.json @@ -14,6 +14,7 @@ "allowUnreachableCode": false, "strict": true, + "alwaysStrict": true, "noFallthroughCasesInSwitch": true, "noImplicitReturns": true, "noUnusedLocals": false,