Skip to content
This repository has been archived by the owner on Aug 15, 2023. It is now read-only.

refactor: move code to monorepo subfolder #72

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ jobs:
- uses: actions/setup-node@v2
- run: yarn install
- name: Run check code
run: make check-code
run: make dealer-check-code
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ jobs:
- uses: actions/setup-node@v2
- run: yarn install
- name: Run integration tests
run: docker-compose up -d && make integration-in-ci
run: docker-compose up -d && make dealer-integration-in-ci
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ jobs:
- uses: actions/setup-node@v2
- run: yarn install
- name: Run unit tests
run: make unit-in-ci
run: make dealer-unit-in-ci
40 changes: 15 additions & 25 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,32 +1,22 @@
BIN_DIR=node_modules/.bin
clean-deps:
docker compose down

test: unit integration

unit:
yarn test:unit

integration:
yarn test:integration

test-in-ci:
start-deps:
docker compose up -d
. ./.envrc && \
LOG_LEVEL=error node_modules/.bin/jest --bail --runInBand --ci --reporters=default --reporters=jest-junit
direnv reload

reset-deps: clean-deps start-deps

integration-in-ci:
docker compose up -d
. ./.envrc && \
sleep 10 && \
yarn migrate-ts up && \
LOG_LEVEL=error $(BIN_DIR)/jest --config ./test/jest-integration.config.js --bail --runInBand --ci --reporters=default --reporters=jest-junit
dealer-integration-in-ci:
sleep 10
yarn dealer migrate-ts up
yarn dealer ci:test:integration

unit-in-ci:
. ./.envrc && \
LOG_LEVEL=warn $(BIN_DIR)/jest --config ./test/jest-unit.config.js --ci --bail
dealer-check-code:
yarn dealer tsc-check
yarn dealer eslint-check
yarn dealer build

check-code:
yarn tsc-check
yarn eslint-check
yarn prettier-check
yarn build
dealer-unit-in-ci:
. ./.envrc && yarn dealer ci:test:unit
4 changes: 2 additions & 2 deletions ci/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,8 @@ jobs:
outputs:
- name: image
params:
CONTEXT: repo
DOCKERFILE: "repo/src/servers/graphql/Dockerfile"
CONTEXT: repo/dealer
DOCKERFILE: "repo/dealer/Dockerfile"
run:
path: build
- put: fake-galoyapi-image
Expand Down
File renamed without changes.
File renamed without changes.
63 changes: 63 additions & 0 deletions dealer/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
"name": "dealer",
"version": "1.0.0",
"main": "index.js",
"repository": "[email protected]:GaloyMoney/dealer.git",
"author": "Sebastien Verreault <[email protected]>",
"license": "MIT",
"scripts": {
"tsc-check": "tsc --noEmit --skipLibCheck",
"eslint-check": "eslint \"src/**/*.ts\"",
"eslint-fix": "eslint \"src/**/*.ts\" --fix",
"build-og": "tsc -p tsconfig-build.json --skipLibCheck",
"build": "tsc -p tsconfig-build.json --skipLibCheck; cp -r ./src/database/sql ./lib/database/ && cp -r ./src/servers/price/proto ./lib/servers/price/",
"test:unit": "jest --config ./test/jest-unit.config.js --bail --verbose $TEST | yarn pino-pretty -c -l",
"test:integration": "jest --config ./test/jest-integration.config.js --bail --verbose $TEST | yarn pino-pretty -c -l",
"ci:test:unit": "LOGLEVEL=warn yarn jest --config ./test/jest-unit.config.js --ci --bail",
"ci:test:integration": "LOGLEVEL=warn yarn jest --config ./test/jest-integration.config.js --ci --bail",
"servers:graphql:pretty": "yarn build && node lib/servers/graphql/WalletGraphqlServer.js | pino-pretty -c -l",
"servers:graphql:elk": "yarn build && node lib/servers/graphql/WalletGraphqlServer.js | pino-elasticsearch",
"servers:exporter:pretty": "yarn build && node lib/servers/exporter/exporter.js | pino-pretty -c -l",
"servers:exporter:elk": "yarn build && node lib/servers/exporter/exporter.js | pino-elasticsearch",
"servers:price:pretty": "yarn build && node lib/servers/price/index.js | pino-pretty -c -l",
"servers:price-client:pretty": "yarn build && node lib/servers/price/sample_client.js | pino-pretty -c -l",
"app:scheduler:pretty": "yarn build && node lib/app/scheduler.js | pino-pretty -c -l",
"app:scheduler:elk": "yarn build && node lib/app/scheduler.js | pino-elasticsearch",
"app:dealer:pretty": "yarn build && node lib/app/dealer.js | pino-pretty -c -l",
"app:dealer:elk": "yarn build && node lib/app/dealer.js | pino-elasticsearch",
"migrate-js": "node-pg-migrate --create-schema true --schema dealer --migration-filename-format utc --migration-file-language js",
"migrate-sql": "node-pg-migrate --create-schema true --schema dealer --migration-filename-format utc --migration-file-language sql",
"migrate-ts": "node-pg-migrate --create-schema true --schema dealer --migration-filename-format utc --migration-file-language ts --tsconfig ./tsconfig.json "
},
"dependencies": {
"@apollo/client": "^3.3.21",
"@grpc/grpc-js": "^1.5.3",
"@opentelemetry/instrumentation-grpc": "^0.27.0",
"@profusion/apollo-validation-directives": "^2.1.5",
"apollo-server-errors": "^2.5.0",
"apollo-server-express": "^2.25.2",
"black-scholes-model": "^1.0.10",
"ccxt": "^1.61.93",
"csv-parse": "^4.16.0",
"dateformat": "^4.5.1",
"dotenv": "^10.0.0",
"express": "^4.17.1",
"graphql": "^15.5.1",
"graphql-middleware": "^6.1.3",
"graphql-tools": "^8.1.0",
"humps": "^2.0.1",
"js-yaml": "^4.1.0",
"lodash": "^4.17.21",
"node-cron": "^3.0.0",
"node-fetch": "^2.6.1",
"node-pg-migrate": "^6.0.0",
"pg": "^8.7.1",
"pg-promise": "^10.11.0",
"pino": "^7.0.0-rc.1",
"pino-http": "^5.6.0",
"prom-client": "^13.2.0",
"ts-md5": "^1.2.10",
"typescript": "^4.5.5",
"uuid": "^8.3.2"
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 8 additions & 0 deletions dealer/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "../tsconfig.base.json",
"compilerOptions": {
"outDir": "lib",
"baseUrl": "./"
},
"include": ["src/**/*", "migrations/**/*", "test/**/*"]
}
75 changes: 75 additions & 0 deletions eslintrc.base.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
{
"env": {
"browser": true,
"es6": true,
"node": true
},
"ignorePatterns": ["/*.js", "dist", "coverage"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "tsconfig.json",
"sourceType": "module"
},
"plugins": ["eslint-plugin-import", "@typescript-eslint", "prettier"],
"extends": [
"eslint:recommended",
"plugin:import/recommended",
"plugin:import/typescript",
"plugin:@typescript-eslint/recommended",
"prettier"
],
"rules": {
// Customized rules
"@typescript-eslint/no-extra-semi": "off", // Prettier work
"@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/prefer-for-of": "error",
"@typescript-eslint/unified-signatures": "error",

"import/no-deprecated": "error",
"import/no-extraneous-dependencies": "error",
"import/no-unassigned-import": "error",
"import/no-unresolved": "off",
"import/order": ["error", { "newlines-between": "always-and-inside-groups" }],

"prettier/prettier": [
"error",
{
"semi": false,
"trailingComma": "all",
"printWidth": 90,
"quoteProps": "consistent",
"singleQuote": false,
"tabWidth": 2,
"useTabs": false,
"bracketSpacing": true,
"arrowParens": "always",
"proseWrap": "preserve",
"endOfLine": "lf"
}
],

"arrow-body-style": "off",

"prefer-arrow-callback": "error",
"no-duplicate-imports": "error",
"no-empty-function": "error",
"no-empty": ["error", { "allowEmptyCatch": true }],
"no-new-wrappers": "error",
"no-param-reassign": "error",
"no-return-await": "error",
"no-sequences": "error",
"no-throw-literal": "error",
"no-void": "error",

// Temporarily disabled recommended rules
"@typescript-eslint/explicit-module-boundary-types": "off",
"no-async-promise-executor": "off"
},
"settings": {
"import/resolver": {
"node": {
"paths": ["."]
}
}
}
}
Loading