Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: update monorepo integration library #537

Merged
merged 18 commits into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 0 additions & 28 deletions .eslintrc.js

This file was deleted.

14 changes: 12 additions & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
*.inc text
*.ini text
*.js text
*.mjs text
*.cjs text
*.json text
*.jsx text
*.less text
Expand Down Expand Up @@ -55,7 +57,7 @@
Dockerfile text

# Documentation
*.ipynb text
*.ipynb text eol=lf
*.markdown text diff=markdown
*.md text diff=markdown
*.mdwn text diff=markdown
Expand Down Expand Up @@ -120,6 +122,8 @@ yarn.lock text -diff
browserslist text
Makefile text
makefile text
# Fixes syntax highlighting on GitHub to allow comments
tsconfig.json linguist-language=JSON-with-Comments

# Heroku
Procfile text
Expand Down Expand Up @@ -199,9 +203,15 @@ Procfile text
# Executables
*.exe binary
*.pyc binary
# Prevents massive diffs caused by vendored, minified files
**/.yarn/releases/** binary
**/.yarn/plugins/** binary

# RC files (like .babelrc or .eslintrc)
*.*rc text

# Ignore files (like .npmignore or .gitignore)
*.*ignore text
*.*ignore text

# Prevents massive diffs from built files
dist/* binary
5 changes: 1 addition & 4 deletions .husky/commit-msg
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx --no -- commitlint --edit ${1}
pnpm dlx commitlint --edit $1
4 changes: 0 additions & 4 deletions .husky/pre-commit

This file was deleted.

3 changes: 2 additions & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
enable-pre-post-scripts=true
# enable-pre-post-scripts: disabled by default(pnpm 8).
enable-pre-post-scripts=true
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
**/dist/
**/dist
5 changes: 3 additions & 2 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
module.exports = {
const config = {
printWidth: 120,
tabWidth: 2,
singleQuote: true,
trailingComma: 'none',
arrowParens: 'avoid',
htmlWhitespaceSensitivity: 'strict',
vueIndentScriptAndStyle: true,
endOfLine: 'auto'
};

export default config;
4 changes: 0 additions & 4 deletions .vscode/cspell.json

This file was deleted.

4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2023 LiaoLiao
Copyright (c) 2021-2024 LiaoLiao

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
SOFTWARE.
92 changes: 13 additions & 79 deletions compose.yaml
Original file line number Diff line number Diff line change
@@ -1,86 +1,20 @@
# initialize:
# sudo docker compose exec cluster-1_master-1 redis-cli --cluster create 127.0.0.1:16380 127.0.0.1:16381 127.0.0.1:16382 --cluster-yes
# sudo docker compose exec cluster-2_master-1 redis-cli --cluster create 127.0.0.1:16480 127.0.0.1:16481 127.0.0.1:16482 --cluster-yes
# sudo docker compose exec cluster-m1 redis-cli -a mycluster --cluster create 127.0.0.1:7380 127.0.0.1:7381 127.0.0.1:7382 --cluster-yes

services:
cluster-1_master-1:
image: bitnami/redis-cluster:latest
environment:
- REDIS_PORT_NUMBER=16380
- REDIS_PASSWORD=cluster1
- REDIS_NODES=cluster-1_master-1 cluster-1_master-2 cluster-1_master-3
- REDIS_CLUSTER_DYNAMIC_IPS=no
- REDIS_CLUSTER_ANNOUNCE_IP=0.0.0.0
- REDISCLI_AUTH=cluster1
network_mode: host
cluster-1_master-2:
image: bitnami/redis-cluster:latest
environment:
- REDIS_PORT_NUMBER=16381
- REDIS_PASSWORD=cluster1
- REDIS_NODES=cluster-1_master-1 cluster-1_master-2 cluster-1_master-3
- REDIS_CLUSTER_DYNAMIC_IPS=no
- REDIS_CLUSTER_ANNOUNCE_IP=0.0.0.0
redis:
image: redis/redis-stack-server:latest
network_mode: host
cluster-1_master-3:
image: bitnami/redis-cluster:latest
environment:
- REDIS_PORT_NUMBER=16382
- REDIS_PASSWORD=cluster1
- REDIS_NODES=cluster-1_master-1 cluster-1_master-2 cluster-1_master-3
- REDIS_CLUSTER_DYNAMIC_IPS=no
- REDIS_CLUSTER_ANNOUNCE_IP=0.0.0.0
network_mode: host

cluster-2_master-1:
image: bitnami/redis-cluster:latest
environment:
- REDIS_PORT_NUMBER=16480
- REDIS_PASSWORD=cluster2
- REDIS_NODES=cluster-2_master-1 cluster-2_master-2 cluster-2_master-3
- REDIS_CLUSTER_DYNAMIC_IPS=no
- REDIS_CLUSTER_ANNOUNCE_IP=0.0.0.0
- REDISCLI_AUTH=cluster2
- 'REDIS_ARGS=--port 6380 --requirepass myredis --appendonly yes'
cluster-m1:
image: redis:latest
network_mode: host
cluster-2_master-2:
image: bitnami/redis-cluster:latest
environment:
- REDIS_PORT_NUMBER=16481
- REDIS_PASSWORD=cluster2
- REDIS_NODES=cluster-2_master-1 cluster-2_master-2 cluster-2_master-3
- REDIS_CLUSTER_DYNAMIC_IPS=no
- REDIS_CLUSTER_ANNOUNCE_IP=0.0.0.0
command: 'redis-server --port 7380 --requirepass mycluster --cluster-enabled yes --cluster-config-file nodes.conf --appendonly yes'
cluster-m2:
image: redis:latest
network_mode: host
cluster-2_master-3:
image: bitnami/redis-cluster:latest
environment:
- REDIS_PORT_NUMBER=16482
- REDIS_PASSWORD=cluster2
- REDIS_NODES=cluster-2_master-1 cluster-2_master-2 cluster-2_master-3
- REDIS_CLUSTER_DYNAMIC_IPS=no
- REDIS_CLUSTER_ANNOUNCE_IP=0.0.0.0
command: 'redis-server --port 7381 --requirepass mycluster --cluster-enabled yes --cluster-config-file nodes.conf --appendonly yes'
cluster-m3:
image: redis:latest
network_mode: host

redis-1:
image: bitnami/redis:latest
environment:
- REDIS_PORT_NUMBER=6380
- ALLOW_EMPTY_PASSWORD=yes
networks:
- dev
ports:
- '6380:6380'
command: /opt/bitnami/scripts/redis/run.sh --maxmemory 16mb
redis-2:
image: bitnami/redis:latest
environment:
- REDIS_PORT_NUMBER=6381
- ALLOW_EMPTY_PASSWORD=yes
networks:
- dev
ports:
- '6381:6381'
command: /opt/bitnami/scripts/redis/run.sh --maxmemory 16mb

networks:
dev:
command: 'redis-server --port 7382 --requirepass mycluster --cluster-enabled yes --cluster-config-file nodes.conf --appendonly yes'
32 changes: 32 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';
import globals from 'globals';
import jest from 'eslint-plugin-jest';
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';

export default tseslint.config({
extends: [
eslint.configs.recommended,
...tseslint.configs.recommendedTypeChecked,
{
...jest.configs['flat/recommended']
},
{
...jest.configs['flat/style']
},
eslintPluginPrettierRecommended
],
languageOptions: {
parserOptions: {
project: ['./packages/*/tsconfig.json'],
tsconfigRootDir: import.meta.dirname
},
ecmaVersion: 2023,
sourceType: 'commonjs',
globals: {
...globals.node,
...globals.jest
}
},
ignores: ['.prettierrc.js', 'eslint.config.js', '**/dist/**/*']
});
92 changes: 39 additions & 53 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,65 +1,51 @@
{
"name": "@liaoliaots/root",
"version": "9",
"description": "Redis(ioredis) module for Nest framework (node.js).",
"name": "@liaoliaots/nestjs-monorepo",
"version": "10",
"description": "Redis module for Nest framework (node.js).",
"author": "LiaoLiao <[email protected]>",
"private": true,
"license": "MIT",
"keywords": [
"redis",
"ioredis",
"sentinel",
"cluster",
"nestjs",
"nest",
"nodejs",
"node",
"typescript",
"javascript",
"health",
"healthcheck",
"healthchecks",
"diagnostics"
],
"type": "module",
"scripts": {
"prepare": "husky install"
"prepare": "husky"
},
"devDependencies": {
"@commitlint/cli": "17.3.0",
"@commitlint/config-conventional": "17.3.0",
"@nestjs/common": "9.2.1",
"@nestjs/core": "9.2.1",
"@nestjs/platform-fastify": "9.2.1",
"@nestjs/terminus": "9.1.4",
"@nestjs/testing": "9.2.1",
"@types/jest": "29.2.5",
"@types/node": "16.18.11",
"@typescript-eslint/eslint-plugin": "5.47.1",
"@typescript-eslint/parser": "5.47.1",
"concurrently": "7.6.0",
"eslint": "8.31.0",
"eslint-config-prettier": "8.5.0",
"eslint-plugin-jest": "27.2.0",
"eslint-plugin-prettier": "4.2.1",
"eslint-plugin-tsdoc": "0.2.17",
"fastify": "4.10.2",
"husky": "8.0.2",
"ioredis": "5.2.4",
"istanbul-badges-readme": "1.8.4",
"jest": "29.3.1",
"jest-extended": "3.2.0",
"lint-staged": "13.1.0",
"prettier": "2.8.1",
"reflect-metadata": "0.1.13",
"rimraf": "3.0.2",
"rxjs": "7.8.0",
"ts-jest": "29.0.3",
"tsc-alias": "1.8.2",
"typescript": "4.9.4"
"@commitlint/cli": "19.5.0",
"@commitlint/config-conventional": "19.5.0",
"@eslint/js": "9.10.0",
"@nestjs/common": "10.4.1",
"@nestjs/core": "10.4.1",
"@nestjs/platform-fastify": "10.4.1",
"@nestjs/terminus": "10.2.3",
"@nestjs/testing": "10.4.1",
"@tsconfig/node20": "20.1.4",
"@types/eslint__js": "8.42.3",
"@types/jest": "29.5.13",
"@types/node": "20.16.5",
"concurrently": "9.0.1",
"eslint": "9.10.0",
"eslint-config-prettier": "9.1.0",
"eslint-plugin-jest": "28.8.3",
"eslint-plugin-prettier": "5.2.1",
"fastify": "4.28.1",
"globals": "15.9.0",
"husky": "9.1.6",
"istanbul-badges-readme": "1.9.0",
"jest": "29.7.0",
"jest-extended": "4.0.2",
"lint-staged": "15.2.10",
"prettier": "3.3.3",
"reflect-metadata": "0.2.2",
"rimraf": "6.0.1",
"rxjs": "7.8.1",
"ts-jest": "29.2.5",
"tsc-alias": "1.8.10",
"typescript": "5.6.2",
"typescript-eslint": "8.5.0"
},
"engines": {
"node": ">=14",
"pnpm": ">=7"
"node": ">=20",
"pnpm": ">=8"
},
"commitlint": {
"extends": [
Expand Down
3 changes: 3 additions & 0 deletions packages/node-redis/.lintstagedrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
'{lib,test}/**/*.ts': ['prettier --write', 'eslint', () => 'tsc -p tsconfig.build.json --noEmit']
};
21 changes: 21 additions & 0 deletions packages/node-redis/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 LiaoLiao

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Loading
Loading